Skip to content

Commit 138f4fe

Browse files
committed
use get_hostname_options, normalize punycode
1 parent 8f51b51 commit 138f4fe

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

aikido_zen/sinks/socket.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
from aikido_zen.vulnerabilities import run_vulnerability_scan
99
from aikido_zen.thread.thread_cache import get_cache
1010
from aikido_zen.errors import AikidoSSRF
11+
from aikido_zen.vulnerabilities.ssrf.get_hostname_options import get_hostname_options
1112

1213

1314
@before
1415
def _getaddrinfo_before(func, instance, args, kwargs):
1516
"""Before wrapper for getaddrinfo - handles blocking"""
16-
host = get_argument(args, kwargs, 0, "host")
17+
host_argument = get_argument(args, kwargs, 0, "host")
1718

1819
# Check if we should block this outgoing request based on configuration
1920
cache = get_cache()
@@ -24,10 +25,12 @@ def _getaddrinfo_before(func, instance, args, kwargs):
2425
if context and cache.is_bypassed_ip(context.remote_address):
2526
return
2627

27-
if cache.config.should_block_outgoing_request(host):
28-
raise AikidoSSRF(
29-
f"Zen has blocked an outbound connection: socket.getaddrinfo to {host}"
30-
)
28+
hostnames = [host_argument] + get_hostname_options(host_argument)
29+
for host in hostnames:
30+
if cache.config.should_block_outgoing_request(host):
31+
raise AikidoSSRF(
32+
f"Zen has blocked an outbound connection: socket.getaddrinfo to {host}"
33+
)
3134

3235
op = "socket.getaddrinfo"
3336
register_call(op, "outgoing_http_op")

0 commit comments

Comments
 (0)