Chaining for Critical: Unauthorized to Cloud Administrator
An unauthenticated attacker could append .pdf to any endpoint to make the server render content with wkhtmltopdf, and by manipulating the Host header they could force the server to fetch remote HTML. That remote HTML contained an iframe pointing at the AWS metadata endpoint, allowing the attacker to steal cloud administrator credentials.
This post explores a real-world application penetration test where multiple vulnerabilities were chained to escalate from unauthenticated access to cloud administrator privileges.
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 application passed user-controlled URLs to wkhtmltopdf without validating or restricting them, and it trusted the Host header to determine where to fetch content, allowing server-side request forgery to the cloud metadata service.
Impact
An unauthenticated attacker could steal cloud administrator credentials, leading to full compromise of the cloud account.
What the attacker needed
Unauthenticated access to the application; ability to host a server reachable by the target; target runs wkhtmltopdf and is hosted in AWS
The fix
The application should validate and restrict URLs passed to wkhtmltopdf, avoid trusting the Host header for server-side requests, and enforce cloud metadata protections such as IMDSv2.
How it was found
- Send a request to any endpoint with .pdf appended to see if the response is generated by wkhtmltopdf.
- Set up an attacker-controlled HTTP server that returns a simple HTML page.
- Send a GET request to a .pdf endpoint with a modified Host header pointing to the attacker's server.
- Observe a callback from the target application to the attacker's server, confirming remote content inclusion.
- Host an HTML page containing an iframe pointing to the AWS metadata endpoint on the attacker's server.
- Send a request to a .pdf endpoint with the Host header set to the attacker's server, causing the application to render the iframe and reveal cloud credentials in the PDF.
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 application used a tool called wkhtmltopdf to turn web pages into PDF files. By adding .pdf to any web address, anyone could make the server create a PDF from that page. The attacker also changed the Host header (a small piece of information in every web request that says which website you want) so the server fetched a page from the attacker's own server. That page secretly told the server to look at a special cloud address that holds secret keys, and the PDF showed those 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.