Skip to content

Don't follow HTTP redirects off the scan target - #24

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-b4d6
Draft

Don't follow HTTP redirects off the scan target#24
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-b4d6

Conversation

@cursor

@cursor cursor Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Bug and impact

Target-facing HTTP fetchers (header audit, stack fingerprint, service probe, web fingerprint, HTTP auth enum) used urllib.request.urlopen, which follows 3xx by default — including cross-host hops.

Trigger: Scan an authorized public host with headers/stack/probe/full enabled. The host returns 302 Location: http://169.254.169.254/latest/meta-data/ (or RFC1918). The agent connects to that destination. On a cloud VM this can pull IMDS into scan evidence (_body_snippet, fingerprints, "open" web-root findings).

LLM URLs, SIEM, vuln_prober, takeover, and active validation already refuse redirects. These auditors did not.

Root cause

Incomplete hardening: urlopen follows redirects unless a custom HTTPRedirectHandler raises. The remaining fetchers never installed one.

Fix

Shared src/http_fetch.urlopen_no_redirect surfaces 3xx as HTTPError and never fetches the Location. Existing HTTPError handlers already return that status/headers, so 302s are audited in place instead of chasing metadata.

Validation

python3 -m pytest test_http_ssrf_redirect.py — 7 passed (local origin 302s to a second server; destination hit count stays 0; normal 200 still fetched).
Related suites (test_header_audit, test_probers, test_web_fingerprint, test_stack_fingerprint, test_service_enum, test_active_validation, test_security_hardening, test_takeover) — 220 passed.

Open in Web View Automation 

Header, stack, service, and web fetchers used urllib's default
redirect following. A public target that 302s to metadata or
RFC1918 made the agent connect there (scanner SSRF). Return the
3xx instead, matching LLM/SIEM/vuln_prober/takeover hardening.

Co-authored-by: dmitryflynn <dmitryflynn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant