Skip to content
XXE Write-up Intermediate

XSS to XXE in Prince v10 and below (CVE-2018-19858)

Prince versions 10 and below process XML without disabling external entities, allowing an attacker to read local files or perform SSRF. The author demonstrates this by injecting an iframe pointing to a malicious XML file into a web wrapper that converts HTML to PDF.

Corben Leo Follow

Published on corben.io

This is a vulnerability I found while participating in a bug-bounty program earlier this year. It affects Prince, a software that converts "HTML, XHTML, or one of the many XML-based document formats" to PDF.

Corben Leo, on corben.io

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 XML parser in Prince does not disable external entity resolution, allowing SYSTEM entities to be processed.

Impact

An attacker could read local files, perform SSRF attacks (including access to cloud metadata), and cause denial of service.

What the attacker needed

Prince version 10 or below; A web wrapper that passes user input to Prince; Ability to inject HTML into the wrapper (XSS)

The fix

The issue was fixed in Prince version 11.

How it was found

  1. Host an XML file containing an external entity declaration that references a local file.
  2. Submit HTML containing an iframe whose src points to the hosted XML file to the PDF conversion endpoint.
  3. Prince retrieves the XML, processes the entity, and includes the file contents in the generated 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.

XML External Entities (XXE) is a flaw where an XML parser processes special instructions that can pull in data from other files or URLs. Here, Prince, a tool that turns HTML into PDF, does not block these instructions, so an attacker can make it read local files or access internal servers. The attacker first needs a way to get their own HTML into the PDF conversion, often through a cross-site scripting (XSS) flaw in the web page that uses Prince.

What is XXE?

An XML parser resolves entities the attacker defines, reading local files or making the server send requests.

More by Corben Leo

View all

9 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

XML external entities (XXE)

The lesson behind this report.

An XML parser resolves entities the attacker defines, reading local files or making the server send requests.