Vulnerabilities > CVE-2015-5602 - Permissions, Privileges, and Access Controls vulnerability in Sudo Project Sudo

047910
CVSS 0.0 - NONE
Attack vector
UNKNOWN
Attack complexity
UNKNOWN
Privileges required
UNKNOWN
Confidentiality impact
UNKNOWN
Integrity impact
UNKNOWN
Availability impact
UNKNOWN
sudo-project
CWE-264
nessus
exploit available

Summary

sudoedit in Sudo before 1.8.15 allows local users to gain privileges via a symlink attack on a file whose full path is defined using multiple wildcards in /etc/sudoers, as demonstrated by "/home/*/*/file.txt."

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Accessing, Modifying or Executing Executable Files
    An attack of this type exploits a system's configuration that allows an attacker to either directly access an executable file, for example through shell access; or in a possible worst case allows an attacker to upload a file and then execute it. Web servers, ftp servers, and message oriented middleware systems which have many integration points are particularly vulnerable, because both the programmers and the administrators must be in synch regarding the interfaces and the correct privileges for each interface.
  • Leverage Executable Code in Non-Executable Files
    An attack of this type exploits a system's trust in configuration and resource files, when the executable loads the resource (such as an image file or configuration file) the attacker has modified the file to either execute malicious code directly or manipulate the target process (e.g. application server) to execute based on the malicious configuration parameters. Since systems are increasingly interrelated mashing up resources from local and remote sources the possibility of this attack occurring is high. The attack can be directed at a client system, such as causing buffer overrun through loading seemingly benign image files, as in Microsoft Security Bulletin MS04-028 where specially crafted JPEG files could cause a buffer overrun once loaded into the browser. Another example targets clients reading pdf files. In this case the attacker simply appends javascript to the end of a legitimate url for a pdf (http://www.gnucitizen.org/blog/danger-danger-danger/) http://path/to/pdf/file.pdf#whatever_name_you_want=javascript:your_code_here The client assumes that they are reading a pdf, but the attacker has modified the resource and loaded executable javascript into the client's browser process. The attack can also target server processes. The attacker edits the resource or configuration file, for example a web.xml file used to configure security permissions for a J2EE app server, adding role name "public" grants all users with the public role the ability to use the administration functionality. The server trusts its configuration file to be correct, but when they are manipulated, the attacker gains full control.
  • Blue Boxing
    This type of attack against older telephone switches and trunks has been around for decades. A tone is sent by an adversary to impersonate a supervisor signal which has the effect of rerouting or usurping command of the line. While the US infrastructure proper may not contain widespread vulnerabilities to this type of attack, many companies are connected globally through call centers and business process outsourcing. These international systems may be operated in countries which have not upgraded Telco infrastructure and so are vulnerable to Blue boxing. Blue boxing is a result of failure on the part of the system to enforce strong authorization for administrative functions. While the infrastructure is different than standard current applications like web applications, there are historical lessons to be learned to upgrade the access control for administrative functions.
  • Restful Privilege Elevation
    Rest uses standard HTTP (Get, Put, Delete) style permissions methods, but these are not necessarily correlated generally with back end programs. Strict interpretation of HTTP get methods means that these HTTP Get services should not be used to delete information on the server, but there is no access control mechanism to back up this logic. This means that unless the services are properly ACL'd and the application's service implementation are following these guidelines then an HTTP request can easily execute a delete or update on the server side. The attacker identifies a HTTP Get URL such as http://victimsite/updateOrder, which calls out to a program to update orders on a database or other resource. The URL is not idempotent so the request can be submitted multiple times by the attacker, additionally, the attacker may be able to exploit the URL published as a Get method that actually performs updates (instead of merely retrieving data). This may result in malicious or inadvertent altering of data on the server.
  • Target Programs with Elevated Privileges
    This attack targets programs running with elevated privileges. The attacker would try to leverage a bug in the running program and get arbitrary code to execute with elevated privileges. For instance an attacker would look for programs that write to the system directories or registry keys (such as HKLM, which stores a number of critical Windows environment variables). These programs are typically running with elevated privileges and have usually not been designed with security in mind. Such programs are excellent exploit targets because they yield lots of power when they break. The malicious user try to execute its code at the same level as a privileged system call.

Exploit-Db

descriptionSudo <= 1.8.14 - Unauthorized Privilege. CVE-2015-5602. Local exploit for linux platform
fileexploits/linux/local/37710.txt
idEDB-ID:37710
last seen2016-02-04
modified2015-07-28
platformlinux
port
published2015-07-28
reporterdaniel svartman
sourcehttps://www.exploit-db.com/download/37710/
titleSudo <= 1.8.14 - Unauthorized Privilege
typelocal

Nessus

  • NASL familyDebian Local Security Checks
    NASL idDEBIAN_DLA-382.NASL
    descriptionWhen sudo is configured to allow a user to edit files under a directory that they can already write to without using sudo, they can actually edit (read and write) arbitrary files. Daniel Svartman reported that a configuration like this might be introduced unintentionally if the editable files are specified using wildcards, for example : operator ALL=(root) sudoedit /home/*/*/test.txt The default behaviour of sudo has been changed so that it does not allow editing of a file in a directory that the user can write to, or that is reached by following a symlink in a directory that the user can write to. These restrictions can be disabled, but this is strongly discouraged. For the oldoldstable distribution (squeeze), this has been fixed in version 1.7.4p4-2.squeeze.6. For the oldstable distribution (wheezy) and the stable distribution (jessie), this will be fixed soon. NOTE: Tenable Network Security has extracted the preceding description block directly from the DLA security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues.
    last seen2020-03-17
    modified2016-01-11
    plugin id87826
    published2016-01-11
    reporterThis script is Copyright (C) 2016-2020 Tenable Network Security, Inc.
    sourcehttps://www.tenable.com/plugins/nessus/87826
    titleDebian DLA-382-1 : sudo security update
    code
    #%NASL_MIN_LEVEL 80502
    #
    # (C) Tenable Network Security, Inc.
    #
    # The descriptive text and package checks in this plugin were
    # extracted from Debian Security Advisory DLA-382-1. The text
    # itself is copyright (C) Software in the Public Interest, Inc.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(87826);
      script_version("2.3");
      script_set_attribute(attribute:"plugin_modification_date", value:"2020/03/12");
    
      script_cve_id("CVE-2015-5602");
    
      script_name(english:"Debian DLA-382-1 : sudo security update");
      script_summary(english:"Checks dpkg output for the updated packages.");
    
      script_set_attribute(
        attribute:"synopsis", 
        value:"The remote Debian host is missing a security update."
      );
      script_set_attribute(
        attribute:"description", 
        value:
    "When sudo is configured to allow a user to edit files under a
    directory that they can already write to without using sudo, they can
    actually edit (read and write) arbitrary files. Daniel Svartman
    reported that a configuration like this might be introduced
    unintentionally if the editable files are specified using wildcards,
    for example :
    
    operator ALL=(root) sudoedit /home/*/*/test.txt
    
    The default behaviour of sudo has been changed so that it does not
    allow editing of a file in a directory that the user can write to, or
    that is reached by following a symlink in a directory that the user
    can write to. These restrictions can be disabled, but this is strongly
    discouraged.
    
    For the oldoldstable distribution (squeeze), this has been fixed in
    version 1.7.4p4-2.squeeze.6.
    
    For the oldstable distribution (wheezy) and the stable distribution
    (jessie), this will be fixed soon.
    
    NOTE: Tenable Network Security has extracted the preceding description
    block directly from the DLA security advisory. Tenable has attempted
    to automatically clean and format it as much as possible without
    introducing additional issues."
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://lists.debian.org/debian-lts-announce/2016/01/msg00005.html"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://packages.debian.org/source/squeeze-lts/sudo"
      );
      script_set_attribute(
        attribute:"solution", 
        value:"Upgrade the affected sudo, and sudo-ldap packages."
      );
      script_set_cvss_base_vector("CVSS2#AV:L/AC:L/Au:N/C:C/I:C/A:C");
      script_set_cvss_temporal_vector("CVSS2#E:POC/RL:OF/RC:C");
      script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
      script_set_attribute(attribute:"exploit_available", value:"true");
    
      script_set_attribute(attribute:"plugin_type", value:"local");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:debian:debian_linux:sudo");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:debian:debian_linux:sudo-ldap");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:debian:debian_linux:6.0");
    
      script_set_attribute(attribute:"patch_publication_date", value:"2016/01/10");
      script_set_attribute(attribute:"plugin_publication_date", value:"2016/01/11");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_copyright(english:"This script is Copyright (C) 2016-2020 Tenable Network Security, Inc.");
      script_family(english:"Debian Local Security Checks");
    
      script_dependencies("ssh_get_info.nasl");
      script_require_keys("Host/local_checks_enabled", "Host/Debian/release", "Host/Debian/dpkg-l");
    
      exit(0);
    }
    
    
    include("audit.inc");
    include("debian_package.inc");
    
    
    if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
    if (!get_kb_item("Host/Debian/release")) audit(AUDIT_OS_NOT, "Debian");
    if (!get_kb_item("Host/Debian/dpkg-l")) audit(AUDIT_PACKAGE_LIST_MISSING);
    
    
    flag = 0;
    if (deb_check(release:"6.0", prefix:"sudo", reference:"1.7.4p4-2.squeeze.6")) flag++;
    if (deb_check(release:"6.0", prefix:"sudo-ldap", reference:"1.7.4p4-2.squeeze.6")) flag++;
    
    if (flag)
    {
      if (report_verbosity > 0) security_hole(port:0, extra:deb_report_get());
      else security_hole(0);
      exit(0);
    }
    else audit(AUDIT_HOST_NOT, "affected");
    
  • NASL familyDebian Local Security Checks
    NASL idDEBIAN_DSA-3440.NASL
    descriptionWhen sudo is configured to allow a user to edit files under a directory that they can already write to without using sudo, they can actually edit (read and write) arbitrary files. Daniel Svartman reported that a configuration like this might be introduced unintentionally if the editable files are specified using wildcards, for example : operator ALL=(root) sudoedit /home/*/*/test.txt The default behaviour of sudo has been changed so that it does not allow editing of a file in a directory that the user can write to, or that is reached by following a symlink in a directory that the user can write to. These restrictions can be disabled, but this is strongly discouraged.
    last seen2020-06-01
    modified2020-06-02
    plugin id87852
    published2016-01-12
    reporterThis script is Copyright (C) 2016-2018 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/87852
    titleDebian DSA-3440-1 : sudo - security update
  • NASL familyFedora Local Security Checks
    NASL idFEDORA_2015-6A267387C0.NASL
    descriptionsudo-1.8.15-1.fc21 - update to 1.8.15 - fixes CVE-2015-5602 sudo-1.8.15-1.fc22 - update to 1.8.15 - fixes CVE-2015-5602 sudo-1.8.15-1.fc23 - update to 1.8.15 - fixes CVE-2015-5602 Note that Tenable Network Security has extracted the preceding description block directly from the Fedora security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues.
    last seen2020-06-05
    modified2016-03-04
    plugin id89266
    published2016-03-04
    reporterThis script is Copyright (C) 2016-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/89266
    titleFedora 22 : sudo-1.8.15-1.fc22 (2015-6a267387c0)
  • NASL familyFreeBSD Local Security Checks
    NASL idFREEBSD_PKG_2E8CDD36C3CC11E5B5FE002590263BF5.NASL
    descriptionMITRE reports : sudoedit in Sudo before 1.8.15 allows local users to gain privileges via a symlink attack on a file whose full path is defined using multiple wildcards in /etc/sudoers, as demonstrated by
    last seen2020-06-01
    modified2020-06-02
    plugin id88149
    published2016-01-26
    reporterThis script is Copyright (C) 2016-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/88149
    titleFreeBSD : sudo -- potential privilege escalation via symlink misconfiguration (2e8cdd36-c3cc-11e5-b5fe-002590263bf5)
  • NASL familyGentoo Local Security Checks
    NASL idGENTOO_GLSA-201606-13.NASL
    descriptionThe remote host is affected by the vulnerability described in GLSA-201606-13 (sudo: Unauthorized privilege escalation in sudoedit) sudoedit in sudo is vulnerable to the escalation of privileges by local users via a symlink attack. This can be exploited by a file whose full path is defined using multiple wildcards in &ldquo;/etc/sudoers&rdquo;, as demonstrated by &ldquo;/home/*/*/file.txt&rdquo;. Impact : Local users are able to gain unauthorized privileges on the system. Workaround : There is no known work around at this time.
    last seen2020-06-01
    modified2020-06-02
    plugin id91844
    published2016-06-27
    reporterThis script is Copyright (C) 2016-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/91844
    titleGLSA-201606-13 : sudo: Unauthorized privilege escalation in sudoedit
  • NASL familyFedora Local Security Checks
    NASL idFEDORA_2015-386863DF8A.NASL
    descriptionsudo-1.8.15-1.fc21 - update to 1.8.15 - fixes CVE-2015-5602 sudo-1.8.15-1.fc22 - update to 1.8.15 - fixes CVE-2015-5602 sudo-1.8.15-1.fc23 - update to 1.8.15 - fixes CVE-2015-5602 Note that Tenable Network Security has extracted the preceding description block directly from the Fedora security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues.
    last seen2020-06-05
    modified2016-03-04
    plugin id89210
    published2016-03-04
    reporterThis script is Copyright (C) 2016-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/89210
    titleFedora 23 : sudo-1.8.15-1.fc23 (2015-386863df8a)

Seebug

bulletinFamilyexploit
description<p># Exploit Title: sudo -e - a.k.a. sudoedit - &nbsp;unauthorized privilege escalation</p><p># Date: 07-23-2015</p><p># Exploit Author: Daniel Svartman</p><p># Version: Sudo &lt;=1.8.14</p><p># Tested on: RHEL 5/6/7 and Ubuntu (all versions)</p><p># CVE: CVE-2015-5602.</p><p>&nbsp;</p><p>Hello,</p><p>&nbsp;</p><p>I found a security bug in sudo (checked in the latest versions of sudo</p><p>running on RHEL and ubuntu) when a user is granted with root access to</p><p>modify a particular file that could be located in a subset of directories.</p><p>&nbsp;</p><p>It seems that sudoedit does not check the full path if a wildcard is used</p><p>twice (e.g. /home/*/*/file.txt), allowing a malicious user to replace the</p><p>file.txt real file with a symbolic link to a different location (e.g.</p><p>/etc/shadow).</p><p>&nbsp;</p><p>I was able to perform such redirect and retrieve the data from the</p><p>/etc/shadow file.</p><p>&nbsp;</p><p>I checked this against fixed directories and files (not using a wildcard)</p><p>and it does work with symbolic links created under the /home folder.</p> <p> In order for you to replicate this, you should configure the following line <p> in your /etc/sudoers file: </p><p> <user_to_grant_priv> ALL=(root) NOPASSWD: sudoedit /home/*/*/test.txt </p><p> Then, logged as that user, create a subdirectory within its home folder </p><p> (e.g. /home/<user_to_grant_priv>/newdir) and later create a symbolic link inside the new folder named test.txt pointing to /etc/shadow. </p><p> When you run sudoedit /home/<user_to_grant_priv>/newdir/test.txt you will </p><p> be allowed to access the /etc/shadow even if have not been granted with </p><p> such access in the sudoers file.</p>
idSSV:89279
last seen2017-11-19
modified2015-09-01
published2015-09-01
titleSudo <= 1.8.14 - Unauthorized Privilege