{"id":"CVE-2026-46643","aliases":["CVE-2026-46643","GHSA-vpr4-p6fq-85jc"],"related":["CVE-2026-49260"],"kind":"vulnerability","state":"published","title":"Snappy: Binary path is never shell-escaped due to an inverted is_executable check","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### 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```","format":"markdown","source":"ghsa"},{"lang":"es","text":"Snappy es una biblioteca PHP que permite la generación de miniaturas, instantáneas o PDF a partir de una URL o una página HTML. Antes de la versión 1.7.1, en POSIX, escapeshellarg(’/usr/bin/wkhtmltopdf’) devuelve la cadena literal ’/usr/bin/wkhtmltopdf’ con los caracteres de comilla simple incluidos. is_executable() busca entonces un archivo cuyo nombre real contiene esos caracteres de comilla, el cual esencialmente nunca existe. La rama segura es código muerto y $command siempre pasa al valor crudo y sin escapar. El resto de los argumentos (opciones, entrada, salida) se escapan correctamente, por lo que la inyección tiene que aterrizar en la propia cadena binaria. Eso ocurre siempre que la ruta binaria se obtiene de una configuración influenciada por el usuario, se deriva de variables de entorno que en última instancia provienen de datos de solicitud, o se concatena con cualquier fragmento controlado por el usuario. Este problema ha sido parcheado en la versión 1.7.1.","source":"nvd"}],"published":"2026-05-21T20:22:16.000Z","modified":"2026-10-25T23:10:00.167Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"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","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"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","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"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","rating":"HIGH"}],"cwes":["CWE-78"],"affected":[{"ranges":[{"version":"< 1.7.1","status":"affected"}],"vendor":"KnpLabs","product":"snappy","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.7.1"}],"ecosystem":"Packagist","package":"KnpLabs/knp-snappy","purl":"pkg:composer/KnpLabs/knp-snappy","source":"ghsa"}],"references":[{"url":"https://github.com/KnpLabs/snappy/security/advisories/GHSA-vpr4-p6fq-85jc","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/KnpLabs/snappy/releases/tag/v1.7.1","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-46643","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/KnpLabs/snappy","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2026-06-11T12:28:59.555Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-46643","url":"https://www.cve.org/CVERecord?id=CVE-2026-46643","licence":"CVE Terms of Use","modified":"2026-06-11T16:15:41.695Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-vpr4-p6fq-85jc","url":"https://github.com/advisories/GHSA-vpr4-p6fq-85jc","licence":"CC-BY-4.0","modified":"2026-09-10T03:51:07.228Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-46643","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-46643","licence":"Public domain","modified":"2026-10-25T23:10:00.167Z"}],"updatedAt":"2026-11-25T22:59:24.361Z","epss":{"score":0.002,"percentile":0.1046,"date":"2026-12-01T12:00:22.000Z"}}