
SonicWall security audit toolkit with vulnerable CTF lab (CVE-2021-20038, CVE-2024-53704)
Automated security assessment framework for SonicWall appliances. For authorized penetration testing engagements only.
# 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
| Module | Description | Risk Level |
|---|---|---|
ssl | SSL/TLS config: certs, protocols, ciphers, HSTS | Passive |
cve | Known CVE detection via fingerprinting | Passive |
auth | Default creds, session security, rate limiting | Active (low) |
web | Headers, info disclosure, API exposure, methods | Passive/Active |
ssl)cve)auth)web)Reports are saved to reports/ (configurable with --output-dir):
sonicwall_audit_YYYYMMDD_HHMMSS.json — Machine-readablesonicwall_audit_YYYYMMDD_HHMMSS.txt — Human-readable with severity ratings| Code | Meaning |
|---|---|
| 0 | No critical or high findings |
| 1 | High severity findings |
| 2 | Critical severity findings |
A Docker-based practice lab with real exploitable vulnerabilities simulating two critical SonicWall CVEs. Both containers replicate real SonicWall response patterns so the audit toolkit can be tested against them.
cd lab && docker-compose up --build -d
| Container | Port | CVE | Challenge |
|---|---|---|---|
sonicwall-sma100 | 8443 | CVE-2021-20038 | Stack buffer overflow in CGI binary → RCE |
sonicwall-sslvpn |
Exploit skeletons are in lab/exploits/, working solutions in lab/solutions/.
Full walkthrough: 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
Edit modules/cve_scanner.py and add entries to 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"],
}
Then implement the corresponding _check_cve_yyyy_nnnnn(self, cve_info) method.
| 4433 |
| CVE-2024-53704 |
| SSLVPN auth bypass via cookie forgery |