Fix SSRF scan failing open on malformed punycode hostnames - #704
Open
MaiDormo wants to merge 2 commits into
Open
Fix SSRF scan failing open on malformed punycode hostnames#704MaiDormo wants to merge 2 commits into
MaiDormo wants to merge 2 commits into
Conversation
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.
Only affects Python 3.8
timokoessler
approved these changes
Aug 22, 2026
timokoessler
left a comment
Member
There was a problem hiding this comment.
Thanks for your contribution! Somebody else from the team will review and merge this PR in the next days.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
get_hostname_options()decodesxn--hostnames with IDNA without guarding the call. A malformed punycode label (for examplexn--a.attacker.com, valid at DNS level under an attacker-owned domain) raisesUnicodeError, which propagates throughfind_hostname_in_context()and gets swallowed by the catch-all inrun_vulnerability_scan(). The SSRF scan therefore fails open and requests to private IPs go through unblocked.This PR wraps the decode in
try/except UnicodeErrorand falls back to the raw hostname, so the scan still runs against the requested host.Changes:
Related: #703