Skip to main content

A high-concurrency CLI tool for detecting web cache poisoning vulnerabilities.

Project description

CachePoisonDetector (CPD-SEC)

PyPI version Python Versions CI License: MIT Code style: black

A high-concurrency CLI tool for detecting web cache poisoning vulnerabilities.

Overview

CPD-SEC is a security tool designed to identify vulnerabilities in web caching systems that allow cache poisoning attacks.

Installation

Using Pip (Recommended)

You can install CPD-SEC directly from PyPI:

pip install cpd-sec

From Source

  1. Clone the repository:

    git clone https://github.com/kankburhan/cpd.git
    cd cpd
    
  2. Install dependencies using Poetry:

    poetry install
    

    Alternatively, calculate dependencies to requirements.txt and use pip:

    pip install .
    

Usage

CPD-SEC supports multiple input methods and extensive configuration options.

1. Basic Scan (--url)

Scan a single target URL.

# Installed via pip
cpd-sec scan --url https://example.com

# Using poetry
poetry run cpd-sec scan --url https://example.com

2. Pipeline Mode (Stdin)

Pipe URLs from other tools (like waybackurls, gau, subfinder, or cat) directly into CPD-SEC. This is ideal for mass scanning.

# Scan URLs found by waybackurls
waybackurls target.com | cpd-sec scan

# Scan URLs from a file using cat
cat urls.txt | cpd-sec scan --concurrency 20

3. File Input (--file)

Read URLs from a text file (one URL per line).

cpd-sec scan --file urls.txt

4. Raw Request Scan (--request-file)

Scan using a raw HTTP request definition (e.g., copied from Burp Suite).

# Save your request to a file (e.g. request.txt)
cpd-sec scan --request-file request.txt

Alternative: Direct String (--raw) Use with caution due to shell escaping characters.

cpd-sec scan --raw "GET /api/foo HTTP/1.1
Host: example.com"

5. Advanced Options

Custom Headers (--header)

Add custom headers to every request (e.g., cookies, authorization). You can use this flag multiple times.

cpd-sec scan -u https://admin.example.com \
    -h "Cookie: session=12345" \
    -h "Authorization: Bearer XYZ"

Output to File (--output)

Save the findings to a JSON or HTML file.

JSON Output:

cpd-sec scan -u https://example.com --output results.json

HTML Report (NEW!): Generate a professional HTML security report with PoC details:

cpd-sec scan -u https://example.com --output report.html

Auto-Open Report (--open): Automatically open the HTML report in your browser:

cpd-sec scan -u https://example.com --output report.html --open

HTML reports include:

  • 🔬 Evidence section with cache headers and variant URLs
  • 🎯 Proof-of-Concept URLs ready for manual verification
  • 📋 Copy-paste curl commands with malicious headers
  • ⚠️ Reflected content sections showing where payloads appear

Concurrency (--concurrency)

Control the number of simultaneous requests (default: 50).

cpd-sec scan -f targets.txt --concurrency 100

Verbosity (--verbose, --quiet)

Control output levels.

cpd-sec scan -u https://example.com -v  # Debug logging
cpd-sec scan -u https://example.com -q  # Only show findings

5. Utilities

Validate Finding (validate)

Manually verify a vulnerability claim step-by-step.

cpd-sec validate --url https://target.com --header "X-Forwarded-Host: evil.com"

Update Tool (update)

Check for and install the latest version of CPD-SEC.

cpd-sec update

Features

  • Auto Update Check: Automatically checks for new versions on run. Auto Update
  • High Concurrency: Built with asyncio and aiohttp for speed.
  • Smart Baseline: Establishes a stable baseline to reduce false positives.
  • HTML Security Reports: Professional reports with PoC URLs, curl commands, and evidence details.
  • Advanced Poisoning Detection:
    • Header Injection: X-Forwarded-Host, X-Forwarded-Scheme, Fastly-Client-IP, etc.
    • Path Normalization: Exploits backend URL decoding differences (/foo\bar).
    • Query Parameter Normalization: Detects case-insensitive query param cache keys.
    • Fat GET: Sends request bodies with GET requests.
    • Unkeyed Query Params: Injects parameters to test cache key inclusion.
    • Method Override: Tests X-HTTP-Method-Override.
    • Cache Key Confusion: Tests URL encoding variants and cache key calculation.
  • Pipeline Ready: Designed to integrate into your reconnaissance workflow.

Contributing

We welcome contributions to improve CPD-SEC, especially for new poisoning signatures and false positive reductions.

Reporting False Positives

If you encounter a false positive (a reported vulnerability that is benign), please open an Issue with:

  1. Replication Output: The output of the validate command:
    cpd-sec validate --url <TARGET_URL> --header "KEY: VALUE"
    
  2. Context: Why you believe it is benign (e.g., "The server normalizes the path but returns the same content").

Contributing Code

  1. Fork the repository.
  2. Clone your fork locally.
  3. Install dependencies: poetry install.
  4. Create a Branch for your feature/fix.
  5. Add/Modify Signatures in cpd/logic/poison.py.
  6. Add Tests in tests/ to verify your changes.
  7. Submit a Pull Request!

Support & Donations

If CPD-SEC helped you find vulnerabilities and improve security, consider supporting its development!

💳 PayPal:
paypal.me/kankburhan

💰 Crypto (USDC):

0x4618393bf4ddc50eb3e75df849b46aca0d0f8e3c

Your support helps maintain and improve this open-source security tool. Thank you! 🙏

License

MIT License - see LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cpd_sec-0.8.0.tar.gz (53.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cpd_sec-0.8.0-py3-none-any.whl (61.7 kB view details)

Uploaded Python 3

File details

Details for the file cpd_sec-0.8.0.tar.gz.

File metadata

  • Download URL: cpd_sec-0.8.0.tar.gz
  • Upload date:
  • Size: 53.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.9.25 Linux/6.11.0-1018-azure

File hashes

Hashes for cpd_sec-0.8.0.tar.gz
Algorithm Hash digest
SHA256 ab3c558c22b5e61fda9bd7b5974059c388f4f7722254c35a710107a5a9100e91
MD5 3c3245475183eef7ac0c693d028680bb
BLAKE2b-256 5e2ea1cd5ce017f6a4ca7ccc8c364fd047ffea7b68b8c3c9d61056b3de5a374a

See more details on using hashes here.

File details

Details for the file cpd_sec-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: cpd_sec-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 61.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.9.25 Linux/6.11.0-1018-azure

File hashes

Hashes for cpd_sec-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9223c4592007fa877c71e091f083a03864d67ae18bca7fab2d43eed706009101
MD5 08d5e3e1a2c23f18e36248900bd0b651
BLAKE2b-256 1bebeee270cfe1587e75ef4effacf6eeaa578662fda1dc5d67374685675bb7ab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page