技能 编程开发 Webshell 威胁狩猎

Webshell 威胁狩猎

v20260317
hunting-for-webshells-in-web-servers
针对 Web 根目录的文件进行熵值、敏感函数和修改时间检测,结合签名和扩展名过滤快速定位可疑 Webshell,有助于安全运维的主动巡检。
获取技能
228 次下载
概览

Instructions

  1. Install dependencies: pip install yara-python
  2. Identify web server document roots to scan (e.g., /var/www/html, /opt/lampp/htdocs).
  3. Run the agent to scan for webshells:
    • Shannon entropy analysis flags files with entropy > 5.5
    • Pattern matching detects eval(), base64_decode(), system(), passthru(), shell_exec()
    • File modification time analysis finds recently changed files
    • Extension filtering targets .php, .jsp, .asp, .aspx, .cgi, .py files
python scripts/agent.py --webroot /var/www/html --output webshell_report.json

Examples

High-Entropy PHP Webshell Detection

File: /var/www/html/uploads/img_thumb.php
Entropy: 6.12 (threshold: 5.5)
Patterns matched: eval(), base64_decode(), str_rot13()
Last modified: 2025-12-01 03:42:00 (outside business hours)
Verdict: SUSPICIOUS - likely obfuscated webshell
信息
Category 编程开发
Name hunting-for-webshells-in-web-servers
版本 v20260317
大小 8.55KB
更新时间 2026-03-18
语言