{"id":"CVE-2026-46633","published":"2026-07-14T21:14:24Z","modified":"2026-11-04T00:01:29Z","title":"Twig: PHP code injection via `{% use %}` template name","vendor":"twigphp","product":"Twig","tier":"tail","description":{"text":"Twig is a template language for PHP. Starting in 1.15.1 and prior to 3.26.0, Compiler::string() does not escape single quotes when a template name from a {% use %} tag is placed inside a PHP single-quoted string literal, allowing a crafted template name to terminate the string and inject arbitrary PHP expressions into the compiled cache file. This issue is fixed in version 3.26.0.","provenance":"source","from":"CVE.org"},"cvss":{"score":8.7,"severity":"HIGH","version":"4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00774,"percentile":0.56643,"provenance":"source"},"cwes":[{"id":"CWE-94","name":"Improper Control of Generation of Code"}],"references":[{"url":"https://github.com/twigphp/Twig/security/advisories/GHSA-7p85-w9px-jpjp","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/twigphp/Twig/commit/679447fa29083043665482ccf7d64372472621b8","tags":["x_refsource_MISC"]},{"url":"https://github.com/twigphp/Twig/commit/a2c6db7ea7d2c90923e6708019ec1442526d1c30","tags":["x_refsource_MISC"]},{"url":"https://github.com/twigphp/Twig/commit/e9ff55f6910832428e48a35b2e0748189ad49ae3","tags":["x_refsource_MISC"]},{"url":"https://gist.github.com/vladko312/d61b950f168c791db4786b83dc7a81e6","tags":["x_refsource_MISC"]},{"url":"https://github.com/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2026-46633.yaml","tags":["x_refsource_MISC"]},{"url":"https://github.com/twigphp/Twig/releases/tag/v3.26.0","tags":["x_refsource_MISC"]},{"url":"https://symfony.com/cve-2026-46633","tags":["x_refsource_MISC"]}],"priority":{"score":17.4,"factors":[{"name":"EPSS percentile","points":11.33},{"name":"CVSS severity","points":6.09}]},"vendorSlug":"twigphp","affectedVersions":[{"vendor":"twigphp","product":"Twig","versions":[">= 1.15.1, < 3.26.0"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"total","timestamp":"2026-07-15T00:00:00+00:00","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"Packagist","package":"twig/twig","vulnerableRanges":[">=1.15.1, <3.26.0"],"patched":["3.26.0"],"from":["GHSA-7p85-w9px-jpjp"],"provenance":"source"}],"summary":{"text":"A flaw in Twig, the PHP template language, lies in its Compiler::string() method: before version 3.26.0 it fails to escape single quotes when a template name from a {% use %} tag is embedded in a PHP single-quoted string literal. An attacker who can supply a crafted template name can break out of that literal and inject arbitrary PHP into the compiled cache file, which is possible over the network with low-privilege authenticated access and no user interaction.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T20:50:14Z"},"euvd":{"id":"EUVD-2026-44558","exploited":false,"provenance":"source"}}