Testing aikido_zen 1.2.35 I noticed that get_hostname_options() decodes the hostname as IDNA without guarding the call:
punycode_decoded = raw_hostname.encode("ascii", errors="").decode("idna")
A hostname containing an invalid punycode label (for example xn--a.attacker.com, which is fine at DNS level under an attacker-owned domain) raises UnicodeError at this line. The exception propagates through find_hostname_in_context() and is swallowed by the catch-all in run_vulnerability_scan(), so the entire SSRF scan is skipped and the outgoing request to a private IP goes through unblocked.
Repro (Python 3.12, AIKIDO_BLOCK=true, Flask endpoint that fetches a user-supplied URL, both test hostnames resolving to 127.0.0.1):
http://attacker.com/ -> blocked with AikidoSSRF (expected)
http://xn--a.attacker.com/ -> not blocked, response returned
Suggested fix: catch UnicodeError from the idna decode and fall back to the ASCII/punycode form for input matching, or treat hosts that fail IDNA validation as suspicious. The scan should not abort silently.
Happy to share a small PoC script if useful.
Testing aikido_zen 1.2.35 I noticed that
get_hostname_options()decodes the hostname as IDNA without guarding the call:A hostname containing an invalid punycode label (for example
xn--a.attacker.com, which is fine at DNS level under an attacker-owned domain) raisesUnicodeErrorat this line. The exception propagates throughfind_hostname_in_context()and is swallowed by the catch-all inrun_vulnerability_scan(), so the entire SSRF scan is skipped and the outgoing request to a private IP goes through unblocked.Repro (Python 3.12,
AIKIDO_BLOCK=true, Flask endpoint that fetches a user-supplied URL, both test hostnames resolving to 127.0.0.1):http://attacker.com/-> blocked withAikidoSSRF(expected)http://xn--a.attacker.com/-> not blocked, response returnedSuggested fix: catch
UnicodeErrorfrom the idna decode and fall back to the ASCII/punycode form for input matching, or treat hosts that fail IDNA validation as suspicious. The scan should not abort silently.Happy to share a small PoC script if useful.