Command Injection Affecting xhtml2pdf package, versions [,0.2.19)


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
1.15% (67th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Command Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PYTHON-XHTML2PDF-20969951
  • published15 Oct 2026
  • disclosed14 Oct 2026
  • creditZachariah Mithani

Introduced: 14 Oct 2026

NewCVE-2026-110642  (opens in a new tab)
CWE-78  (opens in a new tab)

How to fix?

Upgrade xhtml2pdf to version 0.2.19 or higher.

Overview

xhtml2pdf is a PDF generator using HTML and CSS

Affected versions of this package are vulnerable to Command Injection in the startViewer function in xhtml2pdf/pisa.py, whose fallback path interpolates the file name into a shell string as os.system('open "%s"' % filename) after os.startfile raises. An attacker can execute arbitrary commands by supplying a file name such as x"; rm -rf ~; #.pdf, either as the destination the command line tool opens or as an argument passed directly, since the function is also public API.

Note: Only the command line tool is exploitable, and only when -s, --start-viewer, or --start is passed, the name comes from the -d destination or is derived from the source file name, the shell branch is reached only where os.startfile is unavailable rather than on Windows, the person invoking the tool already controls its arguments so no privilege boundary is crossed in ordinary use, exposure needs automation running the tool with -s over files an attacker can name, that flag opens a GUI viewer and is unusual for a server side job, and the library path through pisa.pisaDocument never reaches the function at all.

CVSS Base Scores

version 4.0
version 3.1