Circumventing Browser Security Mechanisms For SSRF
A screenshot feature used headless Chrome to render user-supplied HTML, and the authors found that sandbox restrictions and mixed-content blocking prevented direct access to internal HTTP resources such as the cloud metadata endpoint. By combining a Chrome renderer exploit with an XSS on a same-site subdomain, they spoofed the origin of one frame to match the top window and then read the metadata through a newly created iframe.
While hacking on a private bug bounty program, we discovered a feature that generated screenshots of a user-controlled HTML page. We begun testing this functionality for SSRF.
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 headless Chrome version was outdated and the application allowed user-controlled HTML to be rendered, enabling a renderer exploit combined with a same-site XSS to spoof the origin and bypass the same-origin policy.
What the attacker needed
Screenshot feature rendering user HTML; outdated headless Chrome; XSS on a same-site subdomain; renderer exploit for that Chrome version
How it was found
- Submit user-controlled HTML to the screenshot feature, which is rendered by headless Chrome.
- Observe that iframes are sandboxed and HTTP resources are blocked by mixed content.
- Find XSS on a subdomain of the top window's domain.
- Use a Chrome renderer exploit to modify the SecurityOrigin of the XSS subdomain to match the top window's origin.
- Modify the top window's DOM to create an iframe pointing to the AWS metadata endpoint.
- Read the metadata from the iframe.
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.
A website let users submit HTML that was rendered in a headless browser to make a screenshot. The browser normally stops a page from reading internal addresses like a cloud server's metadata page, but the researchers used a browser bug plus a cross-site scripting flaw on another subdomain to bypass that protection and read the internal page.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.