Skip to main content

KnpLabs Snappy EUVDEUVD-2026-36111

| CVE-2026-46643 HIGH
OS Command Injection (CWE-78)
2026-05-21 https://github.com/KnpLabs/snappy GHSA-vpr4-p6fq-85jc
7.5
CVSS 4.0 · Vendor: https://github.com/KnpLabs/snappy
Share

Severity by source

Vendor (https://github.com/KnpLabs/snappy) PRIMARY
7.5 HIGH
CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
vuln.today AI
6.4 MEDIUM

Requires attacker influence over the Snappy binary path configuration (PR:H, AC:H for the non-default tainted-path precondition); local vector matches the library API surface; full C/I/A impact via code execution as the PHP process.

3.1 AV:L/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H

Primary rating from Vendor (https://github.com/KnpLabs/snappy).

CVSS VectorVendor: https://github.com/KnpLabs/snappy

CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
X

Lifecycle Timeline

6
Analysis Updated
Jun 10, 2026 - 20:28 vuln.today
v3 (cvss_changed)
Analysis Updated
Jun 10, 2026 - 20:28 vuln.today
v2 (cvss_changed)
Re-analysis Queued
Jun 10, 2026 - 20:22 vuln.today
cvss_changed
CVSS changed
Jun 10, 2026 - 20:22 NVD
7.5 (HIGH)
Source Code Evidence Fetched
May 21, 2026 - 21:00 vuln.today
Analysis Generated
May 21, 2026 - 21:00 vuln.today

DescriptionCVE.org

Impact

On POSIX, escapeshellarg(‘/usr/bin/wkhtmltopdf’) returns the literal string ‘/usr/bin/wkhtmltopdf’ with the single-quote characters included. is_executable() then looks for a file whose actual name contains those quote characters, which essentially never exists. The safe branch is dead code and $command always falls through to the raw, unescaped value.

The rest of the arguments (options, input, output) are escaped correctly, so injection has to land in the binary string itself. That happens whenever the binary path is sourced from configuration that is user-influenced, derived from environment variables that ultimately come from request data, or concatenated with any user-controlled fragment.

Proof of concept:
php
 $pdf = new Knp\Snappy\Pdf(‘wkhtmltopdf; touch /tmp/snappy_rce’);
 $pdf->generate(‘https://example.com’, ‘/tmp/out.pdf’);
 // /tmp/snappy_rce is created.

Impact: command execution as the PHP process when the binary path is attacker-influenced. Even in deployments where the binary is hard-coded, this is a defensive-in-depth regression: downstream packages reasonably assume Snappy shell-escapes the binary because the code looks like it does.

Patches

The version 1.7.1 will resolve this security advisory.

Workarounds

Before calling the constructor, ensure \is_executable($path) is truthy.

php
// Bad example
$pdf = new Knp\Snappy\Pdf('/path/to/binary');
php
// Better example
$pathToBinary = '/path/to/binary';

if (!\is_executable($pathToBinary)) {
  throw new \RuntimeException();
}

$pdf = new Knp\Snappy\Pdf('/path/to/binary');

AnalysisAI

Command injection in KnpLabs Snappy PHP library (versions <= 1.7.0) allows attackers to execute arbitrary OS commands when the wkhtmltopdf/wkhtmltoimage binary path is attacker-influenced. An inverted is_executable() check around escapeshellarg() renders the safe branch dead code, causing the binary path to be concatenated unescaped into the shell command. Publicly available exploit code exists (vendor-published PoC in the advisory), but no public exploit identified at time of analysis in CISA KEV.

Technical ContextAI

Snappy is a widely used PHP wrapper around the wkhtmltopdf and wkhtmltoimage binaries for generating PDFs and images from HTML. The root cause maps to CWE-78 (OS Command Injection): the library wraps the binary path with escapeshellarg() and then guards selection of the escaped value behind is_executable() - but on POSIX systems escapeshellarg('/usr/bin/wkhtmltopdf') returns the path wrapped in literal single quotes, so is_executable() is called against a path that includes those quote characters and always returns false. The safe branch is therefore unreachable, and the raw, unescaped binary string is interpolated into the shell command line. The affected package is identified as pkg:composer/knplabs_knp-snappy in CPE data.

RemediationAI

Vendor-released patch: upgrade knplabs/knp-snappy to 1.7.1 or later via Composer (composer require knplabs/knp-snappy:^1.7.1), per the release notes at https://github.com/KnpLabs/snappy/releases/tag/v1.7.1 and the GHSA at https://github.com/KnpLabs/snappy/security/advisories/GHSA-vpr4-p6fq-85jc; note the v1.7.1 changelog warns that the fix also prevents passing arguments directly via the binary string (issue #550), so any code that relied on appending flags to the binary path must be refactored to use the proper option APIs. If immediate upgrade is not possible, the vendor-recommended workaround is to validate the binary path with \is_executable($pathToBinary) and throw before constructing Knp\Snappy\Pdf or Image, which closes the injection only when the path is not attacker-controlled - it does not help if an attacker can write a malicious file at a valid executable path. As a stronger compensating control, hard-code the binary path as a constant in code (not configuration, not env) and ensure no user input is ever concatenated into it; the trade-off is reduced deployment flexibility across environments with differing binary locations.

More in PHP

View all
CVE-2012-1823 CRITICAL POC
9.8 May 11

sapi/cgi/cgi_main.c in PHP before 5.3.12 and 5.4.x before 5.4.2, when configured as a CGI script (aka php-cgi), does not

CVE-2016-1555 CRITICAL POC
9.8 Apr 21

(1) boardData102.php, (2) boardData103.php, (3) boardDataJP.php, (4) boardDataNA.php, and (5) boardDataWW.php in Netgear

CVE-2024-11680 CRITICAL POC
9.8 Nov 26

ProjectSend versions prior to r1720 are affected by an improper authentication vulnerability. Rated critical severity (C

CVE-2025-49113 CRITICAL POC
9.9 Jun 02

Roundcube Webmail contains a critical PHP object deserialization vulnerability (CVE-2025-49113, CVSS 9.9) that allows au

CVE-2017-9841 CRITICAL POC
9.8 Jun 27

Util/PHP/eval-stdin.php in PHPUnit before 4.8.28 and 5.x before 5.6.3 allows remote attackers to execute arbitrary PHP c

CVE-2025-0108 HIGH POC
8.8 Feb 12

Palo Alto Networks PAN-OS management web interface contains an authentication bypass allowing unauthenticated attackers

CVE-2021-25298 HIGH POC
8.8 Feb 15

Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re

CVE-2021-25296 HIGH POC
8.8 Feb 15

Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re

CVE-2013-4983 CRITICAL POC
10.0 Sep 10

The get_referers function in /opt/ws/bin/sblistpack in Sophos Web Appliance before 3.7.9.1 and 3.8 before 3.8.1.1 allows

CVE-2023-6553 CRITICAL POC
9.8 Dec 15

The Backup Migration plugin for WordPress is vulnerable to Remote Code Execution in all versions up to, and including, 1

CVE-2024-46506 CRITICAL POC
10.0 May 13

NetAlertX (formerly PiAlert) versions 23.01.14 through 24.x before 24.10.12 allow unauthenticated command injection thro

CVE-2024-8353 CRITICAL POC
9.8 Sep 28

The GiveWP - Donation Plugin and Fundraising Platform plugin for WordPress is vulnerable to PHP Object Injection in all

Share

EUVD-2026-36111 vulnerability details – vuln.today

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy