How I Escalated Simple HTML Injection to SSRF via PDF Rendering
The certificate generator rendered user-supplied HTML without sanitisation, allowing an attacker to inject an iframe that caused the server-side PDF renderer to fetch internal resources. This SSRF was used to reach the AWS instance metadata service and retrieve temporary IAM credentials.
medium.com
Published on medium.com
hello everyone, it’s been a while since I wrote something here, but yeah, I guess I’m back.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the certificate generator passed unsanitised user input into an HTML template that was rendered by a headless browser or PDF engine, which automatically fetched remote resources such as iframes.
Impact
The attacker could obtain temporary AWS credentials, which, depending on the IAM role's permissions, could grant access to other AWS services such as S3 or DynamoDB.
What the attacker needed
Access to the certificate generator; a paid course to unlock the feature
How it was found
- Submit a certificate request with an HTML tag in the title parameter and observe that it is rendered in the output.
- Replace the title with an iframe pointing to an attacker-controlled server and set up a listener.
- Generate the certificate and confirm that the server makes a DNS and HTTP request to the listener.
- Inject an iframe targeting the AWS instance metadata service to retrieve the IAM role name.
- Inject an iframe targeting the specific IAM role to leak temporary AWS credentials.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The certificate generator let users type their name and title, and the server turned that text into a PDF. Because the server did not clean the input, an attacker could put an iframe (a web page inside a page) in the title. When the server made the PDF, it followed the iframe link and fetched a private cloud address, leaking secret keys.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.