SSRF to RCE: Full Chain Analysis in Modern Web Frameworks
Affiliate disclosure: When you buy through links on BestPocketTech we may earn a commission at no extra cost to you. As an Amazon Associate we earn from qualifying purchases. Our recommendations are based on independent research and editorial standards.
Overview
Server-side request forgery remains one of the highest-impact classes in cloud-hosted applications. This analysis covers the full escalation path from initial SSRF discovery through privilege escalation to code execution.
Attack Surface
Modern web frameworks that process user-supplied URLs are the primary target. Key sinks include:
- Webhook delivery endpoints
- PDF generation services (wkhtmltopdf, headless Chrome)
- Image proxy and thumbnail services
- XML/JSON external entity processing
Metadata Service Abuse
On cloud infrastructure, the primary target is always the instance metadata service:
http://169.254.169.254/latest/meta-data/iam/security-credentials/
http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/
http://169.254.169.254/metadata/instance?api-version=2021-02-01
Redis Escalation
If the SSRF reaches an internal Redis instance on port 6379, code execution is achievable via config set and cron injection:
gopher://127.0.0.1:6379/_%2A1%0D%0A%248%0D%0Aflushall%0D%0A
Mitigations
- Allowlist outbound destinations at the network layer
- Block RFC 1918 ranges and link-local addresses in URL validators
- Require
169.254.169.254blocking at the load balancer - Use IMDSv2 token-required mode on AWS