Gemini CLI fixes SSRF vulnerability with enhanced DNS validation and SNI preservation

diegogodinezr · ghdev · 2026-08-29

This PR enhances security in WebFetchTool by improving destination address validation and connection routing. Key changes include asynchronous DNS resolution with validation of all returned IPs, filtering private or reserved ranges (e.g., RFC 1918, loopback), and implementing transport layer connection pinning via Undici to bind directly to resolved IPs. It preserves TLS SNI to ensure proper HTTPS handshakes and adopts a fail-closed approach to prevent DNS rebinding or SSRF attacks.

Original post →

More from Infra

Infra channel →