π‘οΈ Sentinel: [CRITICAL] Fix SSRF bypass via IPv4-mapped IPv6 addresses#56
Conversation
- Add check to unwrap `ipv4_mapped` IPv6 addresses before evaluating SSRF protection properties. - Add unit tests for IPv4-mapped loopback, link-local, unspecified, multicast, and reserved addresses to prevent regressions. Co-authored-by: ManupaKDU <95234271+ManupaKDU@users.noreply.github.com>
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
π¨ Severity: CRITICAL
π‘ Vulnerability: Attackers could bypass SSRF IP blocklists (e.g., checking
is_link_localto block AWS metadata endpoints like169.254.169.254) by passing the equivalent IPv4-mapped IPv6 address (e.g.,::ffff:169.254.169.254). Python'sipaddressmodule evaluatesis_link_localandis_unspecifiedasFalsefor these mapped addresses, allowing them past validation logic. The underlying OS networking stack then natively routes the IPv6 mapped packet to the IPv4 target, resulting in SSRF.π― Impact: An attacker could use this network scanning utility to probe internal cloud infrastructure metadata endpoints or loopback services, gaining unauthorized access or mapping internal architecture.
π§ Fix: Explicitly unwrapped the mapped IPv4 address using
getattr(ip_obj, 'ipv4_mapped', None)and applied the security validation blocklist directly to the underlyingIPv4Addressobject if it exists.β Verification: Added a comprehensive unit test suite in
test_testping1.pyvalidating that IPv4-mapped loops, link-locals, multicasters, unspecifieds, and reserved addresses are strictly rejected. Tests pass withpython3 -m unittest test_testping1.py.PR created automatically by Jules for task 1602020334448431204 started by @ManupaKDU