CVE-2026-46643: Snappy Binary Path Is Never Shell-escaped Vulnerability
HIGHCVE-2026-46643 is a HIGH binary path is never shell-escaped vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Snappy libraries in the Packagist ecosystem. The issue involves binary path is never shell-escaped due to an inverted is_executable check. Remediation is available by upgrading affected packages to version 1.7.1.
CVE-2026-46643 at a Glance
How to Fix CVE-2026-46643
To remediate this vulnerability, upgrade all affected Snappy dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade KnpLabs/knp-snappy to 1.7.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for KnpLabs/knp-snappy
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-46643, inspect your project dependencies for Snappy:
inspect dependencies for KnpLabs/knp-snappy
Analyze the terminal output to locate any version of Snappy in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.7.1), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Snappy, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-46643 Affected Snappy Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
KnpLabs/knp-snappy
|
Packagist |
< 1.7.1
|
1.7.1
|
References
Frequently Asked Questions
What is CVE-2026-46643?
Which Snappy versions are affected?
What version fixes CVE-2026-46643?
Is KnpLabs/knp-snappy affected?
What CWE is associated with CVE-2026-46643?
How can I check Packagist dependencies for CVE-2026-46643?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-vpr4-p6fq-85jc",
"modified" : "2026-06-11T13:30:23Z",
"published" : "2026-05-21T20:22:16Z",
"aliases" : [ "CVE-2026-46643" ],
"summary" : "Snappy: Binary path is never shell-escaped due to an inverted is_executable check",
"details" : "### Impact\n\nOn 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.\n\nThe 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.\n\n#### Proof of concept:\n\n```php\n $pdf = new Knp\\Snappy\\Pdf(‘wkhtmltopdf; touch /tmp/snappy_rce’);\n $pdf->generate(‘https://example.com’, ‘/tmp/out.pdf’);\n // /tmp/snappy_rce is created.\n```\n\n**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.\n\n### Patches\n\nThe version 1.7.1 will resolve this security advisory.\n\n### Workarounds\n\nBefore calling the constructor, ensure `\\is_executable($path)` is truthy.\n\n```php\n// Bad example\n$pdf = new Knp\\Snappy\\Pdf('/path/to/binary');\n```\n\n```php\n// Better example\n$pathToBinary = '/path/to/binary';\n\nif (!\\is_executable($pathToBinary)) {\n throw new \\RuntimeException();\n}\n\n$pdf = new Knp\\Snappy\\Pdf('/path/to/binary');\n```",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "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"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "KnpLabs/knp-snappy"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.7.1"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 1.7.0"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/KnpLabs/snappy/security/advisories/GHSA-vpr4-p6fq-85jc"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-46643"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/KnpLabs/snappy"
}, {
"type" : "WEB",
"url" : "https://github.com/KnpLabs/snappy/releases/tag/v1.7.1"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-78" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-05-21T20:22:16Z",
"nvd_published_at" : "2026-06-10T20:17:28Z"
}
}