SSRF in Webhooks, PDF Generators & URL Importers
How testers uncover Server-Side Request Forgery (SSRF) in webhooks, HTML-to-PDF renderers, and avatar/CSV importers—including DNS rebinding and cloud IMDS.
API Security · By Thimmagurudu Bathini, CTO · Published · 5 min read
Why Webhooks and PDF Renderers Trigger SSRF
Modern SaaS apps constantly fetch external URLs for webhook deliveries, link previews, avatar imports, and HTML-to-PDF exports. If outbound requests aren't restricted at the network layer, attackers can pivot through SSRF to probe internal VPC microservices or steal AWS/GCP/Azure metadata credentials.
# Attacker URL returns HTTP 302 -> http://169.254.169.254/latest/meta-data/
# Secure server worker:
# 1) Disables automatic redirects
# 2) Resolves DNS and blocks RFC1918/link-local/loopback CIDRs
# 3) Runs in an egress-only subnet with IMDSv2 enforcedCommon SSRF Filters and How They Break
| Defense Attempt | Common Bypass | Robust Fix |
|---|---|---|
| Block 127.0.0.1 / 169.254.169.254 | Alternative IP encodings (0x7f000001, IPv6 ::1, 0.0.0.0) | Resolve DNS first and block all private/link-local/loopback CIDRs |
| Allowlist Check Before Fetch | HTTP 302 redirect from allowed domain to internal IP | Disable redirects or re-validate resolved IP after every redirect |
| DNS Check at Validation Time | DNS rebinding (TTL=0) switches from public IP to 169.254.169.254 | Pin the validated IP at socket connection time + isolate egress VPC |
| IMDSv1 Open | Direct GET to metadata IP without token | Enforce IMDSv2 (PUT token required) on all cloud instances |
Testing Redirects, Alternate IPs & DNS Rebinding
- Test webhook registration, URL previewers, and image/document importers with HTTP redirects and alternate IP notations.
- Check HTML-to-PDF renderers (wkhtmltopdf, Puppeteer, WeasyPrint) for <iframe src=...> or <img src=...> SSRF.
- Verify IMDSv2 enforcement on AWS EC2/ECS or metadata-header protections on GCP/Azure.
- Test egress firewall isolation so app servers cannot reach internal admin subnets.
Isolating Egress Workers & Enforcing IMDSv2
Enforce IMDSv2 on cloud compute, isolate URL-fetching workers in a dedicated egress-only subnet with no internal VPC routes, and disable HTTP redirects.
Test webhooks, URL previews, and PDF exporters manually from ₹36,000 + 18% GST. Request a scoped proposal →
SSRF Testing & Prevention Questions
Is SSRF covered in web and API VAPT?
Yes—every webhook, file-import, and PDF-generation feature is manually tested for SSRF.
How do you prove SSRF safely without accessing real cloud keys?
We use controlled canary listeners and verify safe metadata reachability limits per your Rules of Engagement.