Advanced Web Cache Poisoning Scanner
"Exposing the shadows in your cache"
CacheShadow is a comprehensive security tool designed to detect cache poisoning vulnerabilities in web applications. It tests for multiple attack vectors including unkeyed headers, query parameter pollution, path normalization issues, and more.
- β 27+ Unkeyed Header Tests - X-Forwarded-Host, X-Original-URL, Host, etc.
- β Query Parameter Injection - Tests 15+ common parameters
- β Path Normalization - 14+ path variation tests
- β HTTP Method Override - Tests method override headers
- β Fat GET Requests - GET with body content testing
- β Header Normalization - Case and format variation tests
- β Response Splitting - CRLF injection detection
- β Vary Header Bypass - Cache key enforcement testing
- β Cache Deception - Static extension tricks
- β Multi-threaded Scanning - Fast path enumeration
- β Confidence Scoring - High/Medium/Low ratings
- β Proxy Support - Works with Burp Suite/ZAP
- β JSON Export - Detailed reporting
- Python 3.7 or higher
- pip package manager
# Clone the repository
git clone https://github.com/1amrahul/CacheShadow.git
cd CacheShadow
# Install dependencies
pip install -r requirements.txt
# Make executable (Linux/Mac)
chmod +x cache_poison_scanner.py
# Or use the installer
chmod +x install.sh
./install.shpython3 cache_poison_scanner.py -u https://example.compython3 cache_poison_scanner.py -u https://example.com -v -o results.jsonpython3 cache_poison_scanner.py -u https://example.com --crawl --threads 5python3 cache_poison_scanner.py -u https://example.com --proxy http://127.0.0.1:8080 --no-ssl-verifypython3 cache_poison_scanner.py -u https://example.com --inspect-onlypython3 cache_poison_scanner.py -u https://example.com --delay 2 --timeout 15Required:
-u, --url URL Target URL to scan
Optional:
-v, --verbose Enable verbose output
-o, --output FILE Save results to JSON file
--timeout SECONDS Request timeout (default: 10)
--delay SECONDS Delay between requests (default: 1.0)
--proxy URL HTTP proxy (e.g., http://127.0.0.1:8080)
--threads NUM Thread count for scanning (default: 2)
--crawl Crawl and test common paths
--inspect-only Only inspect caching configuration
--no-ssl-verify Disable SSL verification
-h, --help Show help message
Tests headers that may not be included in the cache key:
- Host, X-Forwarded-Host, X-Original-Host
- X-Forwarded-Proto, X-Forwarded-Scheme
- X-Real-IP, CF-Connecting-IP, True-Client-IP
- Referer, Origin, User-Agent
- And 15+ more headers
Tests common query parameters:
- utm_source, utm_medium, utm_campaign
- fbclid, gclid, ref, source
- callback, redirect, return, next
Tests path normalization:
/%2e/,//,/./,/%2e%2e//;/,/..;/,/%00/,/%0a/
- HTTP Method Override (X-HTTP-Method-Override)
- Fat GET Requests (GET with body)
- Header Normalization (case, underscores)
- Response Splitting (CRLF injection)
- Vary Header Bypass
- Cache Deception Attacks
[*] Testing Unkeyed Headers for Cache Poisoning
[!] Reflection found with X-Forwarded-Host, but not cached (yet).
[!!!] CACHE POISONING CONFIRMED!
Header: X-Original-URL β Payload: evil.example.com/POISON-abc123def4
Poisoned URL: https://target.com
SCAN COMPLETED
Found 3 potential vulnerabilities:
- High Confidence: 2
- Medium Confidence: 1
The tool provides automatic mitigation advice:
- Cache Key Configuration - Include all user-controllable headers
- Vary Header - Specify which headers affect caching
- Input Sanitization - Validate and sanitize all headers
- Reflection Prevention - Avoid reflecting untrusted input
- Normalization - Implement proper cache key normalization
- Private Content - Use
Cache-Control: privatefor user data
WARNING: This tool is designed for authorized security testing only.
- β Use only on systems you own or have explicit written permission to test
- β Obtain proper authorization before scanning
- β Follow responsible disclosure practices
- β Never use on production systems without approval
- β Unauthorized testing may be illegal in your jurisdiction
The authors assume no liability for misuse or damage caused by this tool.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by research from PortSwigger, James Kettle, and the security community
- Built upon techniques documented in cache poisoning research papers
- Thanks to all contributors and testers
- GitHub Issues: Report bugs or request features
Made with β€οΈ for security researchers