Skip to content

AAK-SSRF-BRACKETED-HOST-001: SSRF guard classifies an IPv6 hostname it never unbracketed

Severity
HIGH
Category
Transport Security (transport-security)
Scanner
agent_audit_kit/scanners/ssrf_bracketed_host.py
Auto-fixable
No.
SARIF name
SsrfBracketedHostBypass

What it detects

A URL allow-list reads .hostname from a parsed URL and passes it to an IP-classification call, without removing the brackets WHATWG keeps around an IPv6 literal. net.isIP("[::1]") returns 0, so the branch holding the private-address checks never runs and the guard falls through to its default-allow tail. A caller asking for http://[::1]/ reaches loopback through a check written to stop exactly that. The guard being present is why the missing-allow-list rules stay silent on it.

How to fix

Strip the surrounding brackets before classifying the host, and make the guard default to deny rather than allow when classification fails.

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-SSRF-BRACKETED-HOST-001

Limitations

JS/TS only. Python's urlsplit().hostname already strips the brackets, so the same code shape is not vulnerable there and is deliberately not flagged. Reads one file at a time, so a guard whose bracket handling lives in an imported helper is not seen.

References


All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-SSRF-BRACKETED-HOST-001.md: the page then shows that text, with the registry reference appended under it.