xhtml2pdf: OS command injection in startViewer via file name
Summary
xhtml2pdf before 0.2.19 passes input file names unescaped into os.system in pisa.startViewer(). An attacker who can supply an input file with a crafted name containing shell metacharacters can run operating system commands as the user who invokes the pisa tool. The attack requires that the pisa command-line tool is run with -s/--start-viewer on such a file.
Affected
- xhtml2pdf versions before 0.2.19
- Earliest affected version: Unknown.
Fixed in
- Version 0.2.19 or later
Workaround
- Do not run pisa with -s/--start-viewer on file names that users or external systems control.
- Run xhtml2pdf processes under a low-privilege account.
- No vendor workaround is known; upgrading is the fix.
Exploitation
- No evidence of exploitation in the wild was found.
- No public proof of concept was found.
- CISA SSVC assessment: exploitation none, automatable no, technical impact total.
Our recommendation
- Upgrade xhtml2pdf to 0.2.19 or later, including copies installed with pip in virtualenvs and containers.
- Check distribution packages and verify fixed versions with your distributor, as some trackers still list older versions.
- Review scripts and CI jobs that call pisa with -s and remove the option or validate file names.
- Monitor for unexpected child processes started by Python processes.
Public exploits
PoC-in-GitHub, Metasploit and Exploit-DB list nothing for this CVE.
Research sources
- VulnCheck advisory www.vulncheck.com
- xhtml2pdf release v0.2.19 github.com
- Fix commit f86380d github.com
- Fix pull request #835 github.com
- Vulnerable code in pisa.py at v0.2.18 github.com
- OSV Debian entry osv.dev
- Ubuntu security notice ubuntu.com
Researched and written up in English and German by an AI (Claude by Anthropic) based on NVD, CISA, EPSS and the sources listed. The vendor information is authoritative. Researched on 1 Nov 2026, 10:35.
Original description (NVD)
xhtml2pdf before 0.2.19 contains an OS command injection vulnerability in pisa.startViewer() that allows attackers to execute commands by interpolating unescaped file names into os.system. Attackers can supply an input file whose name contains a double quote and shell metacharacters, which runs OS commands as the invoking user when the pisa tool is used with -s/--start-viewer.
NVD references (5)
- https://github.com/xhtml2pdf/xhtml2pdf/blob/v0.2.18/xhtml2pdf/pisa.py#L393-L400
- https://github.com/xhtml2pdf/xhtml2pdf/commit/f86380dad15b3a6810201d08755a3ee6b19d5063
- https://github.com/xhtml2pdf/xhtml2pdf/pull/835
- https://github.com/xhtml2pdf/xhtml2pdf/releases/tag/v0.2.19
- https://www.vulncheck.com/advisories/xhtml2pdf-before-0.2.19-os-command-injection-via-startviewer-file-name
Sources
The tracker combines official, freely usable data sources – updated continuously:
- NVD (NIST) – CVEs, rating (CVSS), affected products
- CISA KEV – vulnerabilities confirmed by CISA as actively exploited
- CISA Vulnrichment – CISA assessment (SSVC) in the official CVE record
- FIRST EPSS – probability of exploitation
- Microsoft MSRC – Patch Tuesday: vulnerabilities, severity, updates
- PoC-in-GitHub – public proof-of-concept repositories
- Metasploit (Rapid7) – modules of the Metasploit Framework
- Exploit-DB (OffSec) – archive of public exploits (links only)
- Patch days: official vendor pages (linked per vendor) (Vendor patch days)
This product uses data from the NVD API but is not endorsed or certified by the NVD. EPSS data © FIRST.org.
Affected? We can help.
We check whether your systems are affected, install updates and close the gap – continuously with the System Health Checker if you wish.
