Skip to content

Fix SSRF scan failing open on malformed punycode hostnames - #704

Open
MaiDormo wants to merge 2 commits into
AikidoSec:mainfrom
MaiDormo:fix-idna-exception-in-ssrf-options
Open

Fix SSRF scan failing open on malformed punycode hostnames#704
MaiDormo wants to merge 2 commits into
AikidoSec:mainfrom
MaiDormo:fix-idna-exception-in-ssrf-options

Conversation

@MaiDormo

Copy link
Copy Markdown

get_hostname_options() decodes xn-- hostnames with IDNA without guarding the call. A malformed punycode label (for example xn--a.attacker.com, valid at DNS level under an attacker-owned domain) raises UnicodeError, which propagates through find_hostname_in_context() and gets swallowed by the catch-all in run_vulnerability_scan(). The SSRF scan therefore fails open and requests to private IPs go through unblocked.

This PR wraps the decode in try/except UnicodeError and falls back to the raw hostname, so the scan still runs against the requested host.

Changes:

  • Guard the IDNA decode and skip the decoded variant when it fails
  • Add tests: plain hostname, valid punycode, malformed punycode (label and subdomain forms)

Related: #703

MaiDormo and others added 2 commits August 21, 2026 23:43
get_hostname_options() decoded xn-- hostnames with IDNA without guarding
the call. A malformed punycode label (e.g. xn--a.attacker.com) raised
UnicodeError, which propagated through find_hostname_in_context() and was
swallowed by the catch-all in run_vulnerability_scan(), so the SSRF scan
failed open. Fall back to the raw hostname when decoding fails.

@timokoessler timokoessler left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! Somebody else from the team will review and merge this PR in the next days.

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.

2 participants