适用于 SonicWall 设备的自动化安全评估框架。 仅供授权的渗透测试使用。
# Install dependencies
pip install -r requirements.txt
# Run all modules against a target
python3 sonicwall_audit.py --target 192.168.1.1 --port 8443
# Run specific modules
python3 sonicwall_audit.py -t 192.168.1.1 -p 8443 -m ssl,cve
# Verbose output
python3 sonicwall_audit.py -t 192.168.1.1 -p 8443 -v
# JSON-only output
python3 sonicwall_audit.py -t 192.168.1.1 -p 8443 --format json
| 模块 | 描述 | 风险等级 |
|---|---|---|
ssl | SSL/TLS 配置:证书、协议、密码套件、HSTS | 被动 |
cve | 通过指纹识别检测已知 CVE | 被动 |
auth | 默认凭据、会话安全性、速率限制 | 主动(低) |
web | 响应头、信息泄露、API 暴露、方法 | 被动/主动 |
ssl)cve)auth)web)报告保存至 reports/(可通过 --output-dir 配置):
sonicwall_audit_YYYYMMDD_HHMMSS.json — 机器可读sonicwall_audit_YYYYMMDD_HHMMSS.txt — 人类可读,包含严重性评级| 代码 | 含义 |
|---|---|
| 0 | 无严重或高危发现 |
| 1 | 高危发现 |
| 2 | 严重发现 |
一个基于 Docker 的练习环境,包含真实可利用的漏洞,模拟两个关键的 SonicWall CVE。两个容器都复现了真实的 SonicWall 响应模式,以便对该审计工具包进行测试。
cd lab && docker-compose up --build -d
| 容器 | 端口 | CVE | 挑战 |
|---|---|---|---|
sonicwall-sma100 | 8443 | CVE-2021-20038 | CGI 二进制程序中的栈缓冲区溢出 → RCE |
sonicwall-sslvpn | 4433 | CVE-2024-53704 | 通过 Cookie 伪造绕过 SSLVPN 身份验证 |
漏洞利用骨架位于 lab/exploits/,完整解决方案位于 lab/solutions/。
完整演练:lab/WALKTHROUGH.md
sonicwall/
├── sonicwall_audit.py # Main entry point / orchestrator
├── validate_cves.py # Standalone CVE validator
├── requirements.txt
├── configs/
│ └── default.json # Default configuration
├── modules/
│ ├── base.py # Shared base class + HTTP utilities
│ ├── ssl_audit.py # SSL/TLS auditor
│ ├── cve_scanner.py # Known CVE scanner
│ ├── auth_tester.py # Authentication tester
│ ├── web_interface.py # Web interface auditor
│ ├── report_generator.py # JSON + text report output
│ ├── cve_2021_20038_validator.py # CVE-2021-20038 deep validator
│ └── cve_2024_53704_validator.py # CVE-2024-53704 deep validator
├── lab/ # Vulnerable practice lab (Docker)
│ ├── docker-compose.yml
│ ├── WALKTHROUGH.md
│ ├── cve-2021-20038/ # Buffer overflow container
│ ├── cve-2024-53704/ # Auth bypass container
│ ├── exploits/ # Skeleton exploits (fill in the blanks)
│ └── solutions/ # Working exploits (spoilers)
└── reports/ # Generated reports
# Returns non-zero exit code on critical/high findings
python3 sonicwall_audit.py -t $TARGET -p 8443 --format json -m ssl,cve,web
echo $? # 0=pass, 1=high, 2=critical
编辑 modules/cve_scanner.py,向 SONICWALL_CVES 添加条目:
{
"cve": "CVE-YYYY-NNNNN",
"cvss": 9.8,
"severity": "CRITICAL",
"title": "Description",
"description": "Full description",
"check": "_check_cve_yyyy_nnnnn", # method name
"remediation": "Update to version X.",
"affected_products": ["SonicOS"],
}
然后实现对应的 _check_cve_yyyy_nnnnn(self, cve_info) 方法。