sudo: Privilege escalation via improper get_process_ttyname() parsing

Public Date: May 30, 2017, 12:00 am
Updated -
Resolved Status
Important Impact

Red Hat Product Security has been made aware of a local vulnerability affecting the Linux sudo package that allows for privilege escalation.  The vulnerability has been assigned CVE-2017-1000367. This issue was publicly disclosed on May 30th, 2017 and has been rated as Important

A flaw was found in the way the get_process_ttyname() function obtained information about the controlling terminal of the sudo process from the status file in the /proc filesystem. A local attacker who has any level of sudo access on the system, could use this flaw to execute arbitrary commands as root or in certain conditions escalate his privileges to root.

All sudo packages shipped with Red Hat Enterprise Linux are compiled with SELinux support, and SELinux is enabled by default.

Background Information

Sudo (superuser do) allows a system administrator to give certain users (or groups of users) the ability to run some (or all) commands as root while logging all commands and arguments. Sudo operates on a per-command basis.

A local user who has any level of sudo access on the system, can use this flaw to run arbitrary commands as root or escalate his privileges to root.


Red Hat would like to thank Qualys Security for reporting this flaw.

Successful exploitation of this vulnerability could allow a local attack to escalation privileges and potentially malicious code.

Red Hat Product Security has rated this update as having a security impact of Important.    

Impacted Products

The following Red Hat product versions are impacted:

  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6 
  • Red Hat Enterprise Linux 7

Diagnose your vulnerability

Determine if your system is vulnerable

Use the detection script below to determine if your system is currently vulnerable to this flaw.  To verify the legitimacy of the script, you can download the detached GPG signature as well.  The current version of the script is 1.0.

Take Action

All Red Hat customers running affected products are strongly recommended to update as soon as patches are available. Details about impacted packages are noted below.

Updates for Affected Products

Red Hat Enterprise Linux 7sudoRHSA-2017:1382
Red Hat Enterprise Linux 6sudoRHSA-2017:1382
Red Hat Enterprise Linux 5 ELS*sudo


*An active ELS subscription is required for access to this patch.

Please contact Red Hat sales or your specific sales representative for more information if your account does not have an active ELS subscription.

Ansible Playbook

An Ansible  playbook is available to address this issue.  The playbook will update sudo to the latest available version, and will alert you afterward if you still have a vulnerable version of sudo installed.  To run the playbook, list the hosts you wish to update in the HOSTS variable:

# ansible-playbook -e HOSTS=web01,db02 cve-2017-1000367.yml

If after an update, a host is still vulnerable, the play will fail with the message "Vulnerable version still installed".


Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

According to this sudo vulnerability can only be effective in case the SELinux is enabled. Does this mean only enforcing mode or permissive mode too?

Hi Jaroslav, Our analysis team reviewed this aspect. We can confirm that this issue with sudo would be there independent of using SELinux in either enforcing or permissive mode.

The article has been updated to clearly state that sudo is compiled with SELinux support, and that our default installation has SELinux enabled by default.

Regards, Cliff

Just to verify, if SELinux is in disabled mode, this vulnerability in sudo cannot be exploited?

I am asking because I ran the script on a RHEL6 system with SELinux disabled, and the script said sudo was vulnerable.



The script checks if sudo is installed and then compares it against the vulnerable versions. It does run a POC or check to see if SELinux is enabled on the system. So in your case you have a version of sudo installed that is considerable to be vulnerable and you should update to protect your systems.

There is no POC check nor is there a check to see if SELinux is enabled on the box in version 1.0 of the script. Version 1.0 is the latest version of the script as of this writing.

Here's what the script does.

basic_args does argument parsing.
basic_reqs checks for the rpm command on the box.
check_supported_kernel checks for the RHEL[5-7].
check_package checks the sudo package version against the list of vulnerable versions.
"main" just checks if sudo is installed, calls the functions in order, and then prints the results.

Is there a later version of the script that hasn't been released?

And, again, is a box vulnerable if SELinux is set to disabled?

Hi, It is our strong recommendation, irrespective of SELinux, to apply the fixed RPM's to systems that you manage.


Cliff, I understand the recommendation is to patch. However, can you just reply to the direct question Wayne asked? "Is the box vulnerable if SELinux is disabled". The answer is important to people that maintain large PRODUCTION systems (i.e. to prioritize when the patch gets applied). If we know the boxes are not vulnerable is SELinux is disabled then we can focus first on the boxes with SELinux enabled. Thanks and kind regards Cosmin

Alert description pages states: "Sudo versions affected: Sudo 1.8.6p7 through 1.8.20 inclusive."

But the RH provided "diagnose" script (which can be downloaded [here] detects as "vulnerable" a much wider range of versions:


Could someone clarify?

Red Hat does back port bug fixes, features and capabilities and so we cannot depend solely on upstream guidance.

During our code review all newest versions have the impacted code within our packages, including the 1.7 sudo RHEL 5 packages. We recommend to apply the fix to your systems.