CVE-2026-46643 Snappy: Binary path is never shell-escaped due to an inverted is_executable check
Attackers can execute arbitrary commands if the binary path is influenced by user-controlled configuration or environment variables due to improper shell escaping.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Local or same network only
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2026-46643?
CVE-2026-46643 is a high-severity command injection vulnerability in KnpLabs snappy, published on 10 Jun 2026. It can only be exploited from the same machine or local network, with no action from the victim.
Official description
Snappy is a PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. Prior to version 1.7.1, 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. This issue has been patched in version 1.7.1.
Weakness: CWE-78
Which versions are affected by CVE-2026-46643?
2 open source packages ship an affected version, including KnpLabs/knp-snappy.
| Package | Affected | Fixed in |
|---|---|---|
KnpLabs/knp-snappy Packagist | All versions | 1.7.1 |
KnpLabs/knp-snappy Packagist | All versions | 1.7.1 |
How do I fix CVE-2026-46643?
Upgrade KnpLabs/knp-snappy to 1.7.1 or later.
Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.
Is CVE-2026-46643 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-46643 exists.
Sources
Also known as GHSA-vpr4-p6fq-85jc.