{"id":"GHSA-c5fp-p67m-gq56","summary":"Snappy : SSRF and local file read via the xsl-style-sheet option","details":"### Impact\n\nIt impacts applications where:\n- the PHP daemon run with root permissions ;\n- the application is either running outside a container or has sensitive file access ;\n\nIt could happens with this kind of workflows:\n\n```php\n$stylesheet = $_GET['stylesheet']; // = ‘file:///etc/passwd’\n$pdf = new Knp\\Snappy\\Pdf(‘/usr/local/bin/wkhtmltopdf’);\n $pdf-\u003egenerate(‘page.html’, ‘out.pdf’, [\n   ‘xsl-style-sheet’ =\u003e $stylesheet\n ]);\n```\n\n### Patches\n\nA list a schema with `http` and `https` by default is used to validate the remote path by default.\n\n### Workarounds\n\nDevelopers should ensure usage cannot allow (in any case) a user to pass a free input directly to the Snappy library.\n\n```php\n// Bad example\n$pdf = new Knp\\Snappy\\Pdf(‘/usr/local/bin/wkhtmltopdf’);\n $pdf-\u003egenerate(‘page.html’, ‘out.pdf’, [\n   ‘xsl-style-sheet’ =\u003e $_GET['input'],\n ]);\n```\n\nInstead developers can list available available stylesheets and pick the right one with the user input.\n\n```php\n// Better\n$allowedStylesheets = [\n    'invoice' =\u003e '/app/xsl/invoice.xsl',\n    'report'  =\u003e '/app/xsl/report.xsl',\n];\n\n$key = $_GET['stylesheet'] ?? '';\n\nif (!array_key_exists($key, $allowedStylesheets)) {\n    throw new \\RuntimeException('Unknown stylesheet.');\n}\n\n$pdf = new Knp\\Snappy\\Pdf('/usr/local/bin/wkhtmltopdf');\n$pdf-\u003egenerate('page.html', 'out.pdf', [\n    'xsl-style-sheet' =\u003e $allowedStylesheets[$key],\n]);\n```\n\n### References\n\nRead more about SSRF at [owasp.org/www-community/attacks/Server_Side_Request_Forgery](https://owasp.org/www-community/attacks/Server_Side_Request_Forgery)","aliases":["CVE-2026-46683"],"modified":"2026-09-10T03:50:46.558387018Z","published":"2026-05-21T20:20:01Z","related":["CVE-2026-49359"],"database_specific":{"cwe_ids":["CWE-918"],"severity":"MODERATE","github_reviewed":true,"github_reviewed_at":"2026-05-21T20:20:01Z","nvd_published_at":"2026-06-10T20:17:29Z"},"references":[{"type":"WEB","url":"https://github.com/KnpLabs/snappy/security/advisories/GHSA-c5fp-p67m-gq56"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-46683"},{"type":"PACKAGE","url":"https://github.com/KnpLabs/snappy"},{"type":"WEB","url":"https://github.com/KnpLabs/snappy/releases/tag/v1.7.0"}],"affected":[{"package":{"name":"knplabs/knp-snappy","ecosystem":"Packagist","purl":"pkg:composer/knplabs/knp-snappy"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.7.0"}]}],"versions":["0.1.0","0.1.1","0.1.2","0.2.0","0.2.1","0.3.0","0.3.1","0.3.2","0.3.3","0.3.4","0.4","0.4.1","0.4.2","0.4.3","v0.5.0","v1.0","v1.0.1","v1.0.2","v1.0.3","v1.0.4","v1.1.0","v1.2.0","v1.2.1","v1.3.0","v1.3.1","v1.4.0","v1.4.1","v1.4.2","v1.4.3","v1.4.4","v1.5.0","v1.5.1","v1.6.0"],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/05/GHSA-c5fp-p67m-gq56/GHSA-c5fp-p67m-gq56.json","last_known_affected_version_range":"\u003c= 1.6.0"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V4","score":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:L/SI:L/SA:N"}]}