Skip to content
SSRF Write-up Intermediate

How an Unsanitized PDF Export Engine Led to Local File Inclusion

The invoice PDF export feature passed user-supplied HTML into a headless Chrome renderer without sanitisation, allowing an attacker to make the server fetch external URLs and read local files. This could expose system files and, potentially, cloud metadata credentials.

T4nv1 Follow

Published on medium.com

When auditing modern enterprise applications, reporting features like “Export to PDF,” “Generate Invoice,” or “Download Summary” are frequently overlooked. Developers often treat these functions as simple rendering utilities, using headless browser engines or HTML-to-PDF conversion libraries (such as Puppeteer…

T4nv1, on medium.com

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 PDF rendering service passed unsanitised user HTML to a headless browser that was not restricted from loading local files or making outbound requests.

Impact

An attacker could read local files and potentially access cloud metadata to obtain credentials, though the report only demonstrated reading /etc/passwd.

What the attacker needed

An account able to generate invoices; ability to submit custom HTML in invoice fields

The fix

The issue was fixed by disabling local file access in headless Chrome, restricting outbound connections through a proxy, and sanitising user HTML.

How it was found

  1. Submit a PDF render request with simple HTML in the footer field and confirm the output is formatted.
  2. Replace the footer with an iframe pointing to an external listener and observe an incoming request.
  3. Check the User-Agent of the incoming request to identify the rendering engine.
  4. Submit an iframe with a file:// URL to /etc/passwd and open the generated PDF to read the file.

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 PDF export feature took HTML from the user and rendered it on the server using a hidden browser. Because that browser could load any address, including local files, an attacker could make the server show files it should not, like the list of system users.

What is SSRF?

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.

More by T4nv1

View all

113 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.