Lucene search

K
seebugwww.seebug.orgSSV:89279
HistorySep 01, 2015 - 12:00 a.m.

Sudo <= 1.8.14 - Unauthorized Privilege

2015-09-0100:00:00
www.seebug.org
19

EPSS

0.001

Percentile

26.0%

<p># Exploit Title: sudo -e - a.k.a. sudoedit -  unauthorized privilege escalation</p><p># Date: 07-23-2015</p><p># Exploit Author: Daniel Svartman</p><p># Version: Sudo <=1.8.14</p><p># Tested on: RHEL 5/6/7 and Ubuntu (all versions)</p><p># CVE: CVE-2015-5602.</p><p> </p><p>Hello,</p><p> </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> </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> </p><p>I was able to perform such redirect and retrieve the data from the</p><p>/etc/shadow file.</p><p> </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>