Protocol Smuggling and Scheme Exploitation
What you'll learn: How attackers extend SSRF attacks by abusing non-HTTP URL schemes like file://, gopher://, and dict:// to perform actions beyond simple HTTP requests.
Beyond HTTP: Exploiting URL Schemes
Most SSRF defenses focus on blocking access to internal HTTP endpoints. However, many URL parsing libraries support multiple URL schemes beyond http:// and https://. When an application blindly processes user-supplied URLs, attackers can smuggle requests through alternative protocols to bypass restrictions and access unexpected resources.
Common Exploitable Schemes
file:// Scheme
Reads local files directly from the server's filesystem:
file:///etc/passwd
file:///C:/Windows/System32/config/SAM
dict:// Scheme
Originally for dictionary queries, but can probe internal services and banner-grab:
dict://internal-server:6379/info
Useful for Redis, Memcached, and other text-based protocols.
gopher:// Scheme
The most powerful: sends arbitrary TCP data to any port, enabling protocol smuggling:
gopher://internal-db:3306/_SELECT%20version();
Can craft raw SMTP, Redis, or even HTTP requests with full control over headers and body.
Why This Matters
Think of it like this: you've locked the front door (HTTP endpoints), but the attacker discovers you left side doors (other protocols) wide open. By switching from http:// to file:// or gopher://, attackers can:
- Read sensitive local files
- Interact with internal databases
- Send emails through internal SMTP servers
- Exploit services that don't speak HTTP
Key Takeaway: SSRF protections must validate both the target destination and the URL scheme itself—blocking internal IPs alone is insufficient when attackers can switch protocols to access local files or craft raw network requests through gopher:// and similar schemes.