A few months ago, I wrote a diary about webshells and the numerous interesting features they offer. Theyre plenty of web shells available, there are easy to find and install. They are usually delivered as one big obfuscated (read: Base64, ROT13 encoded and gzip width:801px” />
Im pretty sure that some people are using web shells as a remote administration tool. Is it really a good idea? Not sure When we install a software on our computer, one of the recommendations is to check the hash of the files/archives with the one provided by the developer to be sure that the software has not been altered by any means. It could be a good idea to make the same with web shells!
While preparing a presentation about web shells and testing some of them in a lab, I found a specific version of the RC-Shell (v2.0.2011.0827) that started to generatesuspicious traffic. Almost at the same time, I was contacted by one of our readers that reported to me the same behaviour. He did some analysis on his side and the conclusion was thatthe web shell was backdoored! The PHP code contains anarray of Base64 encoded images which are icons used to identify the file types. In the backdoored version, the unknown padding:5px 10px”>
$images = array(
small_unk = iVBORw0KGgoAAAANSU …,
unknown = iVBORw0KGgoAAAANSU …
MD5 (unknown.png) = 1470521de78ef3d0795f83ea7af7c6ad
If you have a look at the picture metadata, you will see that the unknown width:800px” />
Multiple functions have been added to the web shell to deploy the backdoor. padding:5px 10px”>
function z8t($i, $o)//run backdoor
$r = @create_function($o, return @ . z7v($o, 0) .
Note: I found different versions of the web shell with different function names.
The decoding of the PNG image comment and the installation of the backdoor is available here. The code of the backdoor is located here. Basically, it collects juicy information (local PHP variables and details about the web shell and phone home via two channels:
So, be warned when you download and use tools from unknown or unreliable sources. Even underground tools can be backdoored!
Xavier Mertens (@xme)
ISC Handler – Freelance Security Consultant
(c) SANS Internet Storm Center. https://isc.sans.edu Creative Commons Attribution-Noncommercial 3.0 United States License.