Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1277426 (CVE-2015-5602)

Summary: CVE-2015-5602 sudo: Unauthorized privilege escalation in sudoedit
Product: [Other] Security Response Reporter: Adam Mariš <amaris>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: carnil, dkopecek, jrusnack, kzak, nexfwall, pkis, rsawhill, rsroka, sardella, slawomir
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: sudo 1.8.15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-11 15:07:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1277427    
Bug Blocks:    

Description Adam Mariš 2015-11-03 10:05:42 UTC
An unauthorized privilege escalation was found in sudoedit when a user is granted with root access to modify a particular file that could be located in a subset of directories. It seems that sudoedit does not check the full path if a wildcard is used twice (e.g. /home/*/*/file.txt), allowing a malicious user to replace the file.txt real file with a symbolic link to a different location (e.g. /etc/shadow), which results into unauthorized access. Affected versions are <= 1.8.14.

Reproducer can be found here:

https://www.exploit-db.com/exploits/37710/

Comment 1 Adam Mariš 2015-11-03 10:06:13 UTC
Created sudo tracking bugs for this issue:

Affects: fedora-all [bug 1277427]

Comment 2 Adam Mariš 2015-11-05 16:15:01 UTC
Upstream patch:

http://www.sudo.ws/repos/sudo/rev/9636fd256325

Comment 3 Fedora Update System 2015-11-08 06:50:56 UTC
sudo-1.8.15-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Comment 4 Fedora Update System 2015-11-08 09:48:45 UTC
sudo-1.8.15-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.

Comment 5 Stefan Cornelius 2015-11-11 15:05:50 UTC
Configurations like the one mentioned in comment #0, where a user has edit or execute privileges for files in a directory writeable by the user, are inherently dangerous.

It's (almost?) impossible to make such scenarios entirely secure and controllable. Even with the upstream patch, which disables following symlinks by default, there is no full protection.

I can only recommend to migrate to a more secure configuration.

Comment 7 Tomas Hoger 2016-01-19 12:53:31 UTC
Upstream bug report for this issue:

https://bugzilla.sudo.ws/show_bug.cgi?id=707

It notes that the fix in 1.8.15 does not completely address the issue.  Following additional changes were applied post 1.8.16:

https://www.sudo.ws/repos/sudo/rev/33272418bb10
https://www.sudo.ws/repos/sudo/rev/c2e36a80a279

And also related:

https://www.sudo.ws/repos/sudo/rev/b41c5b289f35
https://www.sudo.ws/repos/sudo/rev/574e4a840879
https://www.sudo.ws/repos/sudo/rev/3f559a389bf9
https://www.sudo.ws/repos/sudo/rev/fe50d0c1f1b9