Skip to content
SSRF Write-up Intermediate

pdfreactor SSRF to root level local files read which lead to RCE

The PDFReactor HTML-to-PDF parser did not escape HTML tags, allowing an attacker to inject an iframe that loaded external sites and local files via file:/// URLs. Because the service ran as root, the attacker could read /etc/shadow and private SSH keys, then log in to the server.

Armaan Pathan Follow

Published on medium.com

What is PDFReacter? - PDFReacter is a parser which parses HTML content from HTML to PDF.

Armaan Pathan, 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 application and PDFReactor failed to sanitise or escape user-supplied HTML before rendering it to PDF, and the rendering process ran with root privileges.

Impact

An attacker could read arbitrary local files and, because the service ran as root, obtain private SSH keys and gain remote shell access to the server.

What the attacker needed

Ability to submit HTML into a form; ability to export the form to PDF; PDFReactor runs with root privileges

How it was found

  1. Insert an HTML payload into a form field.
  2. Export the form to PDF and observe that the HTML is rendered.
  3. Use an iframe to load an external site, confirming SSRF.
  4. Use an iframe with a file:/// URL to read local files such as /etc/passwd.
  5. Read /etc/shadow to confirm root privileges.
  6. Fetch private SSH keys and use them to SSH into the server.

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.

PDFReactor is a tool that turns HTML into PDF files. The application did not clean up (escape) HTML tags before passing them to PDFReactor, so an attacker could add an iframe (a frame that loads another page) pointing to internal files or external sites. Since the PDF generator ran with high privileges, the attacker could read sensitive system files and steal SSH keys to take over the server.

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 Armaan Pathan

View all

9 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.