Opinions are like Bugs - Every Spec has one.
An HTML sanitiser library (Loofah, via libxml2) treated an abruptly closed comment as still open, so an iframe hidden inside it survived filtering. The PDF generator that later rendered the input followed the newer HTML5 rules, closed the comment early and rendered the iframe, enabling SSRF to the cloud metadata service and escalation to RCE.
## Opinions are like Bugs - Every Spec has one.
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 a parser differential: libxml2's older comment parsing treats an abruptly closed comment as continuing to the next closing sequence, while the HTML5 spec and the PDF renderer close it immediately.
Impact
An attacker could bypass the HTML sanitiser, make the PDF generator fetch internal resources such as the cloud metadata service, steal IAM credentials and escalate to remote code execution.
What the attacker needed
Ability to submit HTML that is sanitised; PDF export that renders HTML; server can reach metadata service
The fix
The issue was patched in the most recent version of libxml2, and parsers depending on old versions or old spec behaviour should be updated.
How it was found
- Generate a PDF report and inspect metadata to identify the PDF generator
- Confirm the generator fetches remote resources by injecting an image pointing at a collaborator
- Map which tags and attributes the allowlist permits
- Fuzz comment variants across codepoints and render them in a PDF report
- Observe a callback for the variant using the greater-than codepoint
- Use the surviving iframe to reach the metadata service and obtain 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.
A sanitiser is a filter that removes dangerous HTML before it is stored or shown. Here the filter and the PDF renderer disagreed about where an HTML comment ends, so the filter thought a hidden iframe was harmless while the renderer actually drew it. That let the attacker make the server fetch an internal address and leak cloud credentials.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.