常見(jiàn)的木馬基本上有如下特征
1.接收外部變量
常見(jiàn)如:$_GET,$_POST
更加隱蔽的$_FILES,$_REQUEST…
2.執行函數
獲取數據后還需執行它
常見(jiàn)如:eval,assert,preg_replace
隱藏變種:
- $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.寫(xiě)入文件
獲取更多的權限
如:copy,file_get_contents,exec
一般的建議是打開(kāi)safe_mode 或使用disable_functions 等來(lái)提升安全性;
可能有些程序無(wú)法正常運行,基本的安全設置
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
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請
點(diǎn)擊舉報。