This document outlines the security improvements made to the Web Vulnerability Scanner.
- Issue: URL parameter passed directly to subprocess without sanitization
- Fix: Added
--separator to prevent URL from being interpreted as wget options - Location: mirror.py:148
- Impact: Prevents arbitrary command execution via malicious URLs
- Issue: Scanner could be tricked into accessing internal networks
- Fix: Implemented
is_safe_url()validation that blocks:- Private IP ranges (10.x.x.x, 192.168.x.x, 172.16-31.x.x)
- Localhost (127.0.0.1, ::1)
- Link-local and reserved IPs
- Non-HTTP/HTTPS protocols
- Location: mirror.py:26-57
- Impact: Prevents scanner from being used to attack internal infrastructure
- Issue: Malicious URLs could write files outside intended directory
- Fix: Implemented path sanitization with:
- Removal of
..components - Path normalization
- Real path verification to ensure files stay within output directory
- Removal of
- Location: mirror.py:262-276
- Impact: Prevents writing files to arbitrary locations on filesystem
- Issue: Downloaded files created with default (potentially insecure) permissions
- Fix:
- Output directory created with 0750 permissions
- Individual files set to 0640 permissions
- Location: mirror.py:114, 312
- Impact: Prevents unauthorized users from reading potentially sensitive data
- Issue: Scanner tried to write all responses as text, causing crashes on binary files
- Fix: Added binary content detection and appropriate file handling
- Location: mirror.py:282-309
- Impact: Prevents crashes and data corruption
- Issue: No limits on crawling could lead to resource exhaustion
- Fix: Added configurable limits:
max_pages: Maximum pages to crawl (default: 1000)max_depth: Maximum crawl depth (default: 10)rate_limit: Delay between requests (default: 0.5s)
- Location: mirror.py:13-24, 167
- Impact: Prevents memory exhaustion and server overload
- Issue: No validation of URL formats or directory paths
- Fix: Added validation for:
- URL format (must be http:// or https://)
- Directory existence
- Configuration file JSON validity
- Location: main.py:25-35, 55-70
- Impact: Provides clear error messages and prevents crashes
- Fixed Missing Import: Added
import reto mirror.py (line 4) - Fixed Method Signatures: Corrected analyze() signatures in broken_authentication.py and idor.py
- Fixed Context Checks: Corrected list-in-list comparison bugs in xss_vulnerabilities.py
- Fixed Link Parsing: Properly handles both
hrefandsrcattributes
- Improved error messages throughout
- Proper exit codes on failures
- Better handling of missing dependencies (wget)
- JSON parse error handling in config loading
- Created
scanner_config.jsonfor default settings - Created
requirements.txtfor Python dependencies - Created
.gitignoreto prevent credential leaks
-
Never commit credentials:
- Use
auth_config.jsonfor credentials (excluded in .gitignore) - Never commit
auth_config.jsonto version control
- Use
-
Validate scan targets:
- Only scan websites you have permission to test
- Verify URLs before scanning
- Be aware of rate limits
-
Secure output files:
- Review output reports for sensitive data before sharing
- Store reports securely (0640 permissions)
- Delete reports when no longer needed
-
Network safety:
- SSRF protection blocks internal networks by default
- Do not disable safety checks
- Run scanner in isolated environments when possible
-
Adding new features:
- Always validate user input
- Use parameterized queries/commands
- Avoid shell=True in subprocess calls
- Sanitize file paths
-
Plugin development:
- Plugins are loaded dynamically from detections/
- Only add trusted plugins
- Review plugin code for security issues
-
Dependencies:
- Keep dependencies updated
- Review security advisories for used libraries
- Pin dependency versions in requirements.txt
- Dynamic Analysis: Scanner performs static analysis only
- JavaScript Rendering: Does not execute JavaScript (no headless browser)
- OAuth/MFA: Complex authentication flows not supported
- Rate Limiting: Basic implementation; may need tuning for some sites
If you discover a security vulnerability, please report it responsibly:
- Do not open a public issue
- Contact the maintainer directly
- Provide detailed reproduction steps
- Allow time for fixes before public disclosure
- 2025-01-XX: Comprehensive security audit completed
- 21 issues identified and fixed
- 3 critical, 3 high, 7 medium, 4 low, 4 code quality
- All issues resolved