The Hack
1) They use a forum or blog installation that allows members to upload attachments, to upload their script
2) They access the script via a web browser and have full access to your server.
3) They are now able to kill processes, delete/create files, murder your databases and best of all, open a port on your server to another server (no way to find out the location) which will control your server to send out spam viruses.
The Risks (Somewhat Shocking)
I caught this script while still on the infected box and played around with it a bit. Some of the (freaky) capabilities include full control of the machine!
- Ability to see, edit or delete any file in the hacked user's account
- If the user has unjailed shell access, ability to see, edit or delete any file in the server
- Ability to completely obliterate or damage any database within the hacked user
- Ability to run Brute Force attacks against any other server
- A self-destruct function that would destroy the script itself (not suspicious at all, right?)
Details About The Hack
http://www.derekfountain.org/security_c99madshell.php (has great screenshots)
The Solutions
Prevention:
- Simply edit these lines in your php.ini file
CODE
allow_url_fopen = Off
disable_functions = exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_
ni_file,show_source
Source: http://www.devside.net/blog/smf-exploit-like-phpbb-hackdisable_functions = exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_
ni_file,show_source
- Make sure your users don't allow .php files to be upload through their forums and blog software in the first place!
Detection (in SSH as a super-user):
CODE
# updatedb (to rebuild your file database for the next step)
# locate c99madshell.php
# locate c99madshell.php
delete any files the above comes up with. Keep in mind this will only help if the hacker was dumb enough to keep the file as the default name - Our hacker did that exactly, so we were lucky.
The Script Itself:
CODE
<?PHP
//Authentication
$login = ""; //Login
$pass = ""; //Pass
$md5_pass = ""; //If no pass then hash
eval(gzinflate(base64_decode('A huge hash goes here, which when decoded has the server call a txt file on a remote server - Following the above instructions will not let your server do so.')));
?>
//Authentication
$login = ""; //Login
$pass = ""; //Pass
$md5_pass = ""; //If no pass then hash
eval(gzinflate(base64_decode('A huge hash goes here, which when decoded has the server call a txt file on a remote server - Following the above instructions will not let your server do so.')));
?>
Special Thanks/Credit
Johnny Flores from The Planet support hung in there for nearly two hours while we worked together (mostly his work) to find out what was going on and reach a fix. I've had the pleasure of dealing with him twice and have determined he is a great technician: 10/10!
Fake? What are you - Ignorant..?
Some people have Private Messaged me thinking this is a farce. If you agree, you are not a responsible sysadmin and will believe me when you are hacked with this brilliant/nasty script.
About Me (I totally earned this shameless plug)
My name is Mark Mutti. I am the proud owner of 5 year old PhireFast.com. PhireFast has leased servers from The Planet for about three years, currently leasing Quad Core cPanel servers with Hourly Offsite Backups. PhireFast boasts 100% server uptime as guaranteed in our SLA. We were able to handle this potentially catastrophic situation to the point where none of our clients were affected. With that said, if you're looking for a web host that'll put a smile on your face and make you feel all tingly inside, check out PhireFast.com!
Happy hosting! I suggest mod'ing your php.ini file now, before they get you too.
Trackback URL's: Google Search
Meta Tags: hack,c99madshell,webshell,script
