Made of Everything You're Not

Because there's too much info for my brain.
  • Home
  • Projects
  • Portfolio
  • Resume
« Easily Add Gravatar to Your PHP Apps
A New Kind of Failure Point »

The Horrors of C99.php

If you were a sysadmin a few years ago, and you had php on your servers, you’re probably already familiar with c99. In case you haven’t had the personal pleasure, c99, or specifically c99.php (hint: check the source), is the name of a script used by hackers to gain access to a web server running php using an exploit technique called Remote File Inclusion.

The Horrors of C99.php

The Horrors of C99.php

A Little History

See, back in the day some php developers were pretty stupid. (Admit it; you were stupid once too.) What other explanation could there be for writing code that allowed the injection of arbitrary routines into a program. Trivially easy too.

To be fair, PHP was to blame a little for this as well. Given PHP’s high adoption, and design, by, and for, newbie programmers allowing such a technique by default was just ill conceived, and maybe even a little negligent. I understand the desire, and sometime need, for a technique that could be dangerous but to enable the feature by default…. damn man…

So, the risk was known, yet code was still being written (like the below example) that allowed remote file inclusion to be possible. Mostly because of the aforementioned default setting.

<?php
$color = 'blue';
if (isset( $_GET['COLOR'] ) )
{
	$color = $_GET['COLOR'];
}
require( $color . '.php' );
?>

BTW, if you currently write code that does anything like the above, frankly, you’re an idiot. You aren’t nearly as smart and clever as you think you are. I promise you this will bite you. Bad too.

About C99.php

So, using a technique like the above opens you up to learning first hand about c99.php. Finding information about the program itself is a little tricky but there are a couple examples that highlight just how devastating it can be.

When malicious intruders compromise a web server, there’s an excellent chance a famous Russian PHP script, r57shell, will follow. The r57shell PHP script gives the intruder a number of capabilities, including, but not limited to: downloading files, uploading files, creating backdoors, setting up a spam relay, forging email, bouncing a connection to decrease the risk of being caught, and even taking control of SQL databases. All these functions become readily available through an easy to use web interface, but now you can fight back.

Using the above explanation, which I agree with, c99.php acts as an interface to control your server. Once it’s on your server an attacker has easy access to view all the files and their contents, make changes to the system, upload new files, manipulate the database(s) and more.

Quite the nasty little script but pretty elegant in how it’s implemented. c99 is a completely standalone script; even the images are embedded inside using base64!

Until a month ago I would have thought the risk of encountering c99.php in the wild would have been small these days. Then, SMACK!!, a client had a site get hacked (quick CYA; that I didn’t’ work on :) ) using c99. So be warned. It’s out there and if you’re not smart, or if you’re a lazy, lazy, coder, c99 will get you.

Bookmark and Share

Tags: c99.php

This entry was written by Eric Lamb and posted on Monday, February 22nd, 2010 at 4:10 pm and is filed under Brain Dump, Code, IT. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

15 Comments

  1. littlebearz says:
    September 21, 2010 at 8:51 am

    The irony is that I’m using that script as a admin control panel, just add a simple auth to it and it works like a charm, I would love to send a thank you letter lmao.

    Reply
    • Anon says:
      February 1, 2011 at 9:55 am

      Hey littlebearz,

      Check the code of your c99 file to make sure it’s not sending logs and location to an e-mail address of the author or previous owner of the script. The e-mail can be in plaintext or base64, so I would go line by line looking for it.

      Reply
  2. peter says:
    November 25, 2010 at 9:36 pm

    A php shell (c99 is only one of them), does not only “acts as an interface to control your server”, it can be used to “root” a server, and then not only one website gets compromised (if its a shared hosting), the hacker would have real control of the entire server, and thats where the fun starts :P

    Reply
    • Eric Lamb says:
      December 28, 2010 at 1:51 pm

      Scary, scary stuff man… fun, no doubt, but pretty scary.

      Reply
  3. Mr Grumpy Chops says:
    March 25, 2011 at 2:14 pm

    It is very scary, what I would like to know is how to protect against it or stop it all together.

    Reply
  4. Travis says:
    April 4, 2011 at 10:37 pm

    Thanks for the explanation. It is scary seeing c99.php requests on your logs.

    Reply
  5. Seun says:
    August 15, 2011 at 8:52 pm

    Hello please i really need c99 and am just learning,……….please can someone tell me how to upload it into cpanel or how to hack it

    Reply
    • D says:
      January 29, 2012 at 9:49 pm

      1. Learn to use a CMS
      2. Learn to really apply a search engine
      3. Learn to code PHP
      4. Learn to use c99.php
      5. …
      6. Profit?

      Reply
  6. Josh says:
    October 21, 2011 at 11:21 pm

    And this is why you make sure to restrict file types in your upload scrips. As the age old saying goes, “never trust user submitted content.” Also be aware of nullbytes. :)

    Reply
  7. Anonymous says:
    October 31, 2011 at 5:25 am

    We are legion
    we are
    Ananymous

    Reply
    • Tony says:
      November 1, 2011 at 9:25 pm

      You are unable to spell…

      Reply
  8. munkz says:
    January 9, 2012 at 1:10 pm

    RemoveHandler .php .phtml .php3
    RemoveType .php .phtml .php3
    php_flag engine off

    and more even… find -name”*”

    Reply
  9. munkz says:
    January 9, 2012 at 1:12 pm

    RemoveHandler .php .phtml .php3
    RemoveType .php .phtml .php3
    php_flag engine off

    nuff said

    Reply
  10. freedom says:
    February 21, 2012 at 12:45 pm

    this shell sucks there are much better shells bigger and better dont be scared of a shell they are a very clever thing

    Reply
  11. freedom says:
    February 21, 2012 at 12:48 pm

    also c99.php has a back door in it and that sucks dont use this shell if you are ever going to test it out even to look at.

    Reply

Leave a Reply

Click here to cancel reply.

  • Subscribe: Entries | Comments
  • About Me

    Email Email
    Twitter Twitter
    310.739.3322
  • Categories

    • Brain Dump
    • Business
    • Code
    • IT
    • Programming
    • Rant
    • Servers
  • Archives

    • February 2012
    • October 2011
    • August 2011
    • July 2011
    • June 2011
    • May 2011
    • April 2011
    • March 2011
    • February 2011
    • January 2011
    • December 2010
    • November 2010
    • October 2010
    • September 2010
    • August 2010
    • July 2010
    • June 2010
    • May 2010
    • April 2010
    • March 2010
    • February 2010
    • January 2010
    • December 2009
    • November 2009
    • October 2009
    • September 2009
    • August 2009
    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008

Copyright © 2008 - 2012 Eric Lamb - All rights reserved