# Server Side Request Forgery (SSRF) via Analytics Reports

Unsanitized template element name reflected into PDF-rendering error message allowed iframe injection, yielding SSRF to AWS metadata and temporary credentials.

- Payout: $25,000
- Severity: critical
- Program: HackerOne
- Found by: megaman_
- Disclosed: 2023-12-08
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/2262382
- Library page: https://bugbountylibrary.com/r/h1%3A2262382
- Tags: area:web domain:web impact:data-leak impact:internal-access impact:privesc kind:bounty platform:hackerone sev:critical tech:aws technique:chained vuln:ssrf vuln:xss

**Target:** Analytics report PDF generation (template element rendering)
**Root cause:** The error message 'Missing template for element: #{element[:template]}' interpolated the attacker-controlled template value without sanitization, and that HTML was fed into the PDF conversion library, which rendered the injected iframe server-side.
**Steps:**
1. Create an analytics report containing a template element with a crafted template name.
2. Set the template value to an HTML payload such as `<iframe src="http://169.254.169.254/latest/meta-data/iam/security-credentials/">` so it lands in the 'Missing template' error string.
3. Trigger PDF generation of the report so the error HTML is passed to the PDF library.
4. The PDF renderer fetches the iframe URL server-side, returning internal AWS metadata/credentials in the rendered output.
**How found:** Researcher noticed the template element value was reflected unsanitized into an error message that gets rendered into a PDF, and hypothesized the PDF renderer would fetch embedded iframe URLs server-side.
**Exploitation:** Attacker injects an iframe pointing at the EC2/AWS metadata endpoint into the template element name; when the report PDF is generated, the server-side renderer fetches the internal URL and the response (temporary AWS credentials) is captured in the PDF, enabling access to internal AWS services.
**Escalation:** From SSRF to AWS metadata credential theft, then potential manipulation of AWS resources, data loss, and account takeover.
**Insight:** Error messages that interpolate user input and are later fed to a rendering engine (PDF/HTML-to-image) are a hidden SSRF sink; test template/partial names and other 'missing X' error paths for reflected HTML that the renderer will fetch.

