fix(aiohttp/ssrf): block IPv6 unspecified address (::) to close wildcard bypass

Adds ::/128 to _BLOCKED_NETWORKS — the IPv6 unspecified/wildcard address was
missing, allowing an attacker to bypass SSRF protection by resolving a hostname
to :: which binds to all local interfaces.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Drishna Trivedi 2026-05-20 11:57:30 +05:30
parent a9cdbca55d
commit fc7718c182
2 changed files with 4 additions and 0 deletions

View file

@ -44,6 +44,7 @@ _BLOCKED_NETWORKS = [
ipaddress.ip_network("169.254.0.0/16"), # Link-local / AWS IMDS
ipaddress.ip_network("172.16.0.0/12"),
ipaddress.ip_network("192.168.0.0/16"),
ipaddress.ip_network("::/128"), # IPv6 unspecified / wildcard
ipaddress.ip_network("::1/128"),
ipaddress.ip_network("fc00::/7"),
ipaddress.ip_network("fe80::/10"), # IPv6 link-local

View file

@ -26,6 +26,9 @@ class TestBlockedAddress:
def test_ipv6_ula_blocked(self):
assert _is_blocked_address(ipaddress.ip_address("fc00::1"))
def test_ipv6_unspecified_blocked(self):
assert _is_blocked_address(ipaddress.ip_address("::"))
def test_0_0_0_0_blocked(self):
assert _is_blocked_address(ipaddress.ip_address("0.0.0.0"))