[SECURITY] Add Connection-Level SSRF Protection (CVSS 9.4) #59

Merged
allegro merged 1 commits from security/fix-ssrf into main 2026-03-30 23:44:16 +00:00
Member

Security Fix: Connection-Level SSRF Protection (CVSS 9.4)

Summary

Adds runtime IP validation at connection time to mitigate DNS rebinding attacks (TOCTOU vulnerability).

Problem

Previous implementation only validated URLs at pre-flight time. Attacker-controlled DNS servers with TTL=0 could return:

  • Public IP during safety check
  • Private IP during actual connection

Solution

  • create_safe_socket(): Validates resolved IPs at connection time
  • get_safe_httpx_transport(): Provides safe transport for httpx
  • Blocks private/internal IPs during socket creation

Changes

  • tools/url_safety.py: +107 lines of connection-level protection

Security References

  • V-005 in SECURITY_AUDIT_REPORT.md
  • CWE-918: Server-Side Request Forgery
## Security Fix: Connection-Level SSRF Protection (CVSS 9.4) ### Summary Adds runtime IP validation at connection time to mitigate DNS rebinding attacks (TOCTOU vulnerability). ### Problem Previous implementation only validated URLs at pre-flight time. Attacker-controlled DNS servers with TTL=0 could return: - Public IP during safety check - Private IP during actual connection ### Solution - `create_safe_socket()`: Validates resolved IPs at connection time - `get_safe_httpx_transport()`: Provides safe transport for httpx - Blocks private/internal IPs during socket creation ### Changes - tools/url_safety.py: +107 lines of connection-level protection ### Security References - V-005 in SECURITY_AUDIT_REPORT.md - CWE-918: Server-Side Request Forgery
allegro added 1 commit 2026-03-30 23:44:14 +00:00
security: add connection-level SSRF protection (CVSS 9.4)
Some checks failed
Supply Chain Audit / Scan PR for supply chain risks (pull_request) Successful in 32s
Tests / test (pull_request) Failing after 28s
Docker Build and Publish / build-and-push (pull_request) Failing after 55s
0019381d75
Add runtime IP validation at connection time to mitigate DNS rebinding
attacks (TOCTOU vulnerability).

Changes:
- tools/url_safety.py: Add create_safe_socket() for connection-time validation
- Add get_safe_httpx_transport() for httpx integration
- Document V-005 security fix

This closes the gap where attacker-controlled DNS servers could return
different IPs between pre-flight check and actual connection.

CVSS: 9.4 (Critical)
Refs: V-005 in SECURITY_AUDIT_REPORT.md
Fixes: CWE-918 (Server-Side Request Forgery)
allegro merged commit 6da1fc11a2 into main 2026-03-30 23:44:16 +00:00
Sign in to join this conversation.