WEB入侵排查
一、Webshell排查
1、内容关键词匹配
- webshell特征匹配(一般不建议使用,存在漏报和误报,而且比较多)
find /var/www/ -name "*.php" |xargs egrep 'assert|phpspy|c99sh|milw0rm|eval|\(gunerpress|\(base64_decoolcode|spider_bc|shell_exec|passthru|\(\$\_\POST\[|eval \(str_rot13|\.chr\(|\$\{\"\_P|eval\(\$\_R|file_put_contents\(\.\*\$\_|base64_decode'
2、WEB日志
- 查看日志中是否存在可疑的可执行文件,如
upload/aaa/ias.php
、upload/index.jsp
等
3、查找异常修改时间的文件
如果有安全设备更好,比如青藤云,可以直接分析时间段内落地的文件。不知道咋写有想法可以多问问GPT。
Linux
# 查找60分钟内内容修改的文件 find ./ -name '*' -mmin -60 # +60表示60分钟之前修改过的 # 查找24小时内内容修改的文件 find ./ -name "*" -mtime 0 # 查找48小时内状态修改的文件 find ./ -ctime -2 # 查找 2022-10-24 - 2022-11-26 间修改过的文件 find ./ -type f -newermt 2022-10-24 ! -newermt 2022-11-26
Windows
# 未测试过 Get-ChildItem -Path. -File | Where-Object { ($_.LastWriteTime -gt [datetime]'2022-10-24') -and ($_.LastWriteTime -lt [datetime]'2022-11-26') }
4、内存马
- 重启(暴力清除,而且可能无法提取内存马)
- arthas
- java-memshell-scanner
- FindShell
- copagent
5、文件对比
如果代码量太大的情况下,可以通过对比上个版本代码和现有代码的差异性,来确定修改过的文件
Beyond Compare:
Git
git status
二、Webshell查杀工具
D盾_Web查杀
阿D出品,使用自行研发不分扩展名的代码分析引擎,能分析更为隐藏的 WebShell 后门行为。
兼容性:只提供 Windows 版本。
工具下载地址:http://www.d99net.net
河马
专注 WebShell 查杀研究,拥有海量 WebShell 样本和自主查杀技术,采用传统特征+云端大数据双引擎的查杀技术。查杀速度快、精度高、误报低。
兼容性:支持 Windows、Linux,支持在线查杀。
Web Shell Detector
Web Shell Detector 具有 WebShell 签名数据库,可帮助识别高达 99% 的 WebShell。
兼容性:提供 PHP、Python 脚本,可跨平台,在线检测。
官方网站:http://www.shelldetector.com
github项目地址:https://github.com/emposha/PHP-Shell-Detector
CloudWalker(牧云)
一个可执行的命令行版本 Webshell 检测工具。目前,项目已停止更新。
兼容性:提供 Linux版本,Windows 暂不支持。
在线查杀 demo:https://webshellchop.chaitin.cn
GitHub 项目地址:https://github.com/chaitin/cloudwalker
PHP Malware Finder
PHP-malware-finder 是一款优秀的检测webshell和恶意软件混淆代码的工具
兼容性:提供Linux 版本,Windows 暂不支持。
GitHub 项目地址:https://github.com/jvoisin/php-malware-finder
findWebshell
这个项目是一款基于 Python 开发的 WebShell 检查工具,可以根据特征码匹配检查任意类型的 WebShell 后门。
GitHub 项目地址:https://github.com/he1m4n6a/findWebshell