Skip to main content
Founding Partner + 7-Day Trial
Tier B Enterprise Fleet · 12-Language Immunity EngineAutoExtinguish: true (4-Gate Vericoding)

Opt-in rule (--rule IMM-REDIR-001 or CIPHERMAP_EXPERIMENTAL_REDIR=1) · AutoExtinguish: true.

Commercial boundary: ciphermap immunity scan, immunity extinguish --apply, immunity attest (CycloneDX 1.6 CISA IBOM & OpenVEX 0.2.0), and ciphermap mcp require Tier B Enterprise Fleet. Offline proof and IBOM verification (--verify-proof, attest --verify) and the ciphermap demo sandbox run Free.

Back to docs
IMM-REDIR-001MEDIUMCWE-601 · OWASP ASVS V5.1.5 · NIST SP 800-53 Rev. 5 (SI-10, CM-7)

Unvalidated Open Redirect from Raw HTTP Parameter

Severity: MEDIUM

Passing raw query parameters (next, returnTo, redirect_uri, continue) directly into http.Redirect, res.redirect, or RedirectResponse allows attackers to craft phishing and OAuth token-leakage links using external origins or protocol-relative '//evil.example' and '/\evil.example' paths. IMM-REDIR-001 is available via --rule IMM-REDIR-001 or CIPHERMAP_EXPERIMENTAL_REDIR=1 and synthesizes strict relative-path guards.

Remediation checklist

  • Restrict post-login returnTo/next redirect targets to relative paths beginning with a single '/' while explicitly rejecting '//' and '/\' authority prefixes.
  • When cross-subdomain redirects are required, parse the URL and match hostname + scheme against a strict static allowlist.
  • Run targeted audits during auth flows with ciphermap immunity scan . --rule IMM-REDIR-001 --offline.

Illustrative Code Examples

These fragments explain migration direction. They are not complete applications or compiler-verified patches for your project.

Vulnerable — raw query parameter passed into HTTP redirect

terminal · zsh
// Go: '//evil.example' redirects victim off-origin
http.Redirect(w, r, r.URL.Query().Get("next"), http.StatusFound)

Remediated — strict single-slash relative path guard

terminal · zsh
// Go: enforces local relative path and blocks '//' & '/\' bypasses
next := r.URL.Query().Get("next")
if !strings.HasPrefix(next, "/") || strings.HasPrefix(next, "//") || strings.Contains(next, "\\") {
  next = "/dashboard"
}
http.Redirect(w, r, next, http.StatusFound)

Scan your own repository for IMM-REDIR-001 locally (0 code egress)

Preview proposed changes free with ciphermap fix . --dry-run --offline --no-telemetry. Eligibility depends on the installed build, call shape, module format, and migration context. The bundled RSA fixture has a classical key-size candidate; that does not make it post-quantum secure. Persisted digests and unsupported contexts may be declined. Applying supported candidates requires an entitlement, explicit verifier consent, and the required project tools. Review the actual verification result before adopting a change.

Other rule families