
Advisory for pdf-image ⌯⌲ 10 000 weekly downloads
pdf-image through version 2.0.0 allows OS command injection via
the pdfFilePath argument. The package builds shell command strings
with util.format() and executes them with child_process.exec().
If an application passes an attacker-controlled file path into
PDFImage, shell metacharacters in that path can lead to arbitrary
command execution.
| Product | Affected versions | Fixed version |
|---|---|---|
| pdf-image | all versions through 2.0.0 | no fix available as of 2026-03-24 |
CVE-2026-26830CWE-78 - OS Command Injection9.8 (Critical)CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:Hindex.jsThe vulnerable code path reaches constructGetInfoCommand() and
constructConvertCommandForPage(), both of which interpolate the PDF
path into a shell command before calling child_process.exec().
Any application that accepts a user-controlled PDF path and passes it
to pdf-image can end up executing attacker-supplied shell commands
on the host system.
const { PDFImage } = require("pdf-image");
const pdfImage = new PDFImage('test.pdf"; touch /tmp/pwned; echo "');
pdfImage.getInfo();
If the injected command runs, the process creates /tmp/pwned.
No fixed npm release is available at the time of writing.
If you still depend on this package:
PDFImage.execFile() or spawn() with an array.