{"id":"CVE-2026-46637","aliases":["DEBIAN-CVE-2026-46637","EUVD-2026-44509","GHSA-jv8m-2544-3pg3","UBUNTU-CVE-2026-46637"],"status":"published","title":"Twig: HTML-output filters in twig/* extras incorrectly declared `is_safe =\u003e ['all']`","description":"Twig is a template language for PHP. Prior to 3.26.0, several filters in twig/markdown-extra and twig/cssinliner-extra are registered with is_safe =\u003e [all], causing Twig to treat plain text or HTML output as safe in HTML, JavaScript, CSS, URL, and other contexts where the output is not properly escaped. This issue is fixed in version 3.26.0.","severity":{"version":"4.0","score":5.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","level":"medium","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-10","score":0.00305,"percentile":0.23515,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-116","CWE-79"],"published":"2026-05-21T21:27:20Z","modified":"2026-10-28T02:30:39Z","fixes":[{"ecosystem":"Packagist","package":"twig/markdown-extra","fixed_in":["3.26.0"],"sources":["ghsa","osv"]},{"ecosystem":"Packagist","package":"twig/cssinliner-extra","fixed_in":["3.26.0"],"sources":["ghsa","osv"]},{"ecosystem":"Debian:12","package":"php-twig","fixed_in":["3.5.1-1+deb12u3"],"sources":["osv"]},{"ecosystem":"Debian:13","package":"php-twig","fixed_in":["3.27.0-0+deb13u1"],"sources":["osv"]},{"ecosystem":"Debian:14","package":"php-twig","fixed_in":["3.26.0-1"],"sources":["osv"]}],"affected":[{"source":"ghsa","ecosystem":"Packagist","package":"twig/markdown-extra","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.26.0"}]}]},{"source":"ghsa","ecosystem":"Packagist","package":"twig/cssinliner-extra","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.26.0"}]}]},{"source":"osv","ecosystem":"Debian:12","package":"php-twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.5.1-1+deb12u3"}]}],"versions":["3.5.1-1","3.5.1-1+deb12u1","3.5.1-1+deb12u2"]},{"source":"osv","ecosystem":"Debian:13","package":"php-twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.27.0-0+deb13u1"}]}],"versions":["3.20.0-2","3.21.1-1","3.21.1-2","3.21.1-3","3.22.0-1","3.22.0-2","3.22.1-1","3.22.1-2","3.22.1-3","3.22.2-1","3.22.2-2","3.23.0-1","3.23.0-2","3.24.0-1","3.26.0-0+deb13u1","3.26.0-1"]},{"source":"osv","ecosystem":"Debian:14","package":"php-twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.26.0-1"}]}],"versions":["3.20.0-2","3.21.1-1","3.21.1-2","3.21.1-3","3.22.0-1","3.22.0-2","3.22.1-1","3.22.1-2","3.22.1-3","3.22.2-1","3.22.2-2","3.23.0-1","3.23.0-2","3.24.0-1"]},{"source":"osv","ecosystem":"Packagist","package":"twig/markdown-extra","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.26.0"}]}],"versions":["v2.12.0","v2.12.1","v2.12.2","v2.12.3","v2.12.4","v2.12.5","v2.13.0","v2.13.1","v2.14.0","v2.14.1","v2.14.11","v2.14.2","v2.14.3","v2.14.5","v2.14.7","v2.14.8","v2.14.9","v2.15.0","v2.15.4","v2.15.5","v2.15.6","v2.16.0","v3.0.0","v3.0.0-BETA1","v3.0.1","v3.0.2","v3.0.3","v3.0.4","v3.0.5","v3.1.0","v3.1.1","v3.10.0","v3.11.0","v3.12.0","v3.13.0","v3.15.0","v3.16.0","v3.17.0","v3.18.0","v3.19.0","v3.2.1","v3.20.0","v3.21.0","v3.22.0","v3.23.0","v3.24.0","v3.3.0","v3.3.1","v3.3.3","v3.3.4","v3.3.5","v3.3.8","v3.4.0","v3.5.0","v3.5.1","v3.6.0","v3.7.0","v3.7.1","v3.8.0","v3.9.0"]},{"source":"osv","ecosystem":"Packagist","package":"twig/cssinliner-extra","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.26.0"}]}],"versions":["v2.12.0","v2.12.1","v2.12.2","v2.12.3","v2.12.4","v2.12.5","v2.13.0","v2.13.1","v2.14.0","v2.14.1","v2.14.2","v2.14.3","v2.14.7","v2.14.8","v2.14.9","v2.15.0","v2.15.5","v2.15.6","v2.16.0","v3.0.0","v3.0.0-BETA1","v3.0.1","v3.0.2","v3.0.3","v3.0.4","v3.0.5","v3.1.0","v3.1.1","v3.10.0","v3.11.0","v3.12.0","v3.13.0","v3.15.0","v3.16.0","v3.17.0","v3.18.0","v3.19.0","v3.2.1","v3.20.0","v3.21.0","v3.22.0","v3.23.0","v3.24.0","v3.3.0","v3.3.3","v3.3.4","v3.3.5","v3.4.0","v3.5.0","v3.5.1","v3.6.0","v3.7.0","v3.7.1","v3.8.0","v3.9.0"]},{"source":"osv","ecosystem":"Ubuntu:Pro:20.04:LTS","package":"php-twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["2.11.3-2","2.12.1-1","2.12.2-1","2.12.3-1","2.12.5-1","2.12.5-1ubuntu0.1~esm1","2.12.5-1ubuntu0.1~esm2"]},{"source":"osv","ecosystem":"Ubuntu:Pro:22.04:LTS","package":"php-twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["3.3.2-1ubuntu3","3.3.4-1","3.3.6-1","3.3.7-1","3.3.8-2ubuntu4","3.3.8-2ubuntu4+esm1","3.3.8-2ubuntu4+esm2"]},{"source":"osv","ecosystem":"Ubuntu:Pro:24.04:LTS","package":"php-twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["3.7.0-1","3.7.1-1","3.8.0-2","3.8.0-2ubuntu0.1~esm1","3.8.0-2ubuntu1","3.8.0-2ubuntu1+esm1"]},{"source":"osv","ecosystem":"Ubuntu:25.10","package":"php-twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["3.20.0-2ubuntu1"]},{"source":"osv","ecosystem":"Ubuntu:26.10","package":"php-twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["3.23.0-2build7","3.27.1-1","3.28.0-1"]},{"source":"osv","ecosystem":"Ubuntu:Pro:26.04:LTS","package":"php-twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["3.20.0-2ubuntu1","3.23.0-2build5","3.23.0-2build7","3.23.0-2ubuntu0.1~esm1"]}],"products":[{"vendor":"symfony","product":"twig"},{"vendor":"twig","product":"cssinliner-extra"},{"vendor":"twig","product":"markdown-extra"},{"vendor":"twigphp","product":"twig"}],"references":[{"url":"https://github.com/twigphp/Twig/security/advisories/GHSA-jv8m-2544-3pg3","tags":["x_refsource_CONFIRM","Vendor Advisory","advisory","web"]},{"url":"https://github.com/twigphp/Twig/commit/84982072c79a7417b0d158a401d91344f3658299","tags":["x_refsource_MISC","Patch","fix"]},{"url":"https://github.com/twigphp/Twig/commit/e36489d3521ecbfc08bdcc61294302557035f14a","tags":["x_refsource_MISC","Patch","fix"]},{"url":"https://github.com/twigphp/Twig/releases/tag/v3.26.0","tags":["x_refsource_MISC","Release Notes","web"]},{"url":"https://github.com/FriendsOfPHP/security-advisories/blob/master/twig/cssinliner-extra/CVE-2026-46637.yaml","tags":["web"]},{"url":"https://github.com/FriendsOfPHP/security-advisories/blob/master/twig/markdown-extra/CVE-2026-46637.yaml","tags":["web"]},{"url":"https://symfony.com/cve-2026-46637","tags":["web"]},{"url":"https://github.com/advisories/GHSA-jv8m-2544-3pg3"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/46xxx/CVE-2026-46637.json","tags":["advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-46637","tags":["advisory"]},{"url":"https://security-tracker.debian.org/tracker/CVE-2026-46637","tags":["advisory"]},{"url":"https://github.com/twigphp/Twig","tags":["package"]},{"url":"https://ubuntu.com/security/CVE-2026-46637","tags":["report"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2026-46637","tags":["report"]},{"url":"https://symfony.com/blog/cve-2026-46637-html-output-filters-in-twig-extras-incorrectly-declared-is-safe-all","tags":["report"]}],"sources":{"cve":[{"id":"CVE-2026-46637","title":"Twig: HTML-output filters in twig/* extras incorrectly declared `is_safe =\u003e ['all']`","description":"Twig is a template language for PHP. Prior to 3.26.0, several filters in twig/markdown-extra and twig/cssinliner-extra are registered with is_safe =\u003e [all], causing Twig to treat plain text or HTML output as safe in HTML, JavaScript, CSS, URL, and other contexts where the output is not properly escaped. This issue is fixed in version 3.26.0.","status":"published","published":"2026-07-14T21:25:20.141Z","modified":"2026-07-16T15:05:57.087Z","cvss":[{"version":"4.0","score":5.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","level":"medium","assessor":"cna"}],"cwes":["CWE-116"],"updated_at":"2026-11-02T13:46:55.086623Z"}],"euvd":[{"id":"EUVD-2026-44509","description":"Twig is a template language for PHP. Prior to 3.26.0, several filters in twig/markdown-extra and twig/cssinliner-extra are registered with is_safe =\u003e [all], causing Twig to treat plain text or HTML output as safe in HTML, JavaScript, CSS, URL, and other contexts where the output is not properly escaped. This issue is fixed in version 3.26.0.","status":"published","published":"2026-07-14T21:25:20Z","modified":"2026-07-16T15:05:57Z","cvss":[{"version":"4.0","score":5.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","level":"medium"}],"updated_at":"2026-11-02T18:19:51.881225Z"}],"ghsa":[{"id":"GHSA-jv8m-2544-3pg3","title":"Twig: HTML-output filters in twig/* extras incorrectly declared `is_safe =\u003e ['all']`","description":"### Description\n\nSeveral filters in the `twig/*` extras packages are registered with `is_safe =\u003e ['all']`, which tells Twig's autoescaper to treat their output as safe in every context (`html`, `js`, `css`, `url`, ...). The output of these filters is plain text or HTML markup, neither of which is safe in every escaping context.\n\nAffected filters:\n\n- `html_to_markdown` (`twig/markdown-extra`) emits plain Markdown text. `league/html-to-markdown` decodes HTML entities when producing code spans and fenced blocks, so an attacker-controlled `\u003ccode\u003e\u0026lt;img src=x onerror=alert(1)\u0026gt;\u003c/code\u003e` becomes `` `\u003cimg src=x onerror=alert(1)\u003e` ``, which renders live when interpolated into an HTML page.\n- `markdown_to_html` (`twig/markdown-extra`) emits HTML. Safe in an HTML context but not in JS, CSS or URL contexts (e.g. when interpolated into an inline `\u003cscript\u003e` block).\n- `inline_css` (`twig/cssinliner-extra`) emits HTML with inlined styles. Same constraint as `markdown_to_html`.\n\nIn all three cases, `is_safe =\u003e ['all']` causes the autoescaper to emit the output verbatim in any context, even when the developer never wrote `|raw`. In a context such as a JS string or a URL parameter, this produces unescaped HTML and is exploitable as XSS.\n\n### Resolution\n\n- `html_to_markdown` no longer claims to be safe in any escaping context; its plain-text output is now autoescaped for the surrounding context.\n- `markdown_to_html` and `inline_css` are now declared `is_safe =\u003e ['html']`, asserting only what they actually guarantee.\n\n### Credits\n\nTwig would like to thank Claude Mythos Preview (via Project Glasswing) for reporting the issue and providing the fix for `html_to_markdown` and `markdown_to_html` in `twig/markdown-extra`, and Christophe Coevoet for extending the audit to `inline_css` in `twig/cssinliner-extra`.","status":"published","published":"2026-05-21T21:27:20Z","modified":"2026-05-21T21:27:21Z","cvss":[{"version":"4.0","score":1.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:U","level":"low"}],"cwes":["CWE-116"],"updated_at":"2026-11-02T14:40:13.628377Z"}],"nvd":[{"id":"CVE-2026-46637","description":"Twig is a template language for PHP. Prior to 3.26.0, several filters in twig/markdown-extra and twig/cssinliner-extra are registered with is_safe =\u003e [all], causing Twig to treat plain text or HTML output as safe in HTML, JavaScript, CSS, URL, and other contexts where the output is not properly escaped. This issue is fixed in version 3.26.0.","status":"published","published":"2026-07-14T22:16:56.41Z","modified":"2026-07-16T16:19:08.693Z","cvss":[{"version":"4.0","score":5.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","level":"medium","assessor":"secondary"},{"version":"3.1","score":5.4,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N","level":"medium","assessor":"primary"}],"cwes":["CWE-116","CWE-79"],"updated_at":"2026-11-02T14:12:29.879716Z"}],"osv":[{"id":"CVE-2026-46637","title":"Twig: HTML-output filters in twig/* extras incorrectly declared `is_safe =\u003e ['all']`","description":"Twig is a template language for PHP. Prior to 3.26.0, several filters in twig/markdown-extra and twig/cssinliner-extra are registered with is_safe =\u003e [all], causing Twig to treat plain text or HTML output as safe in HTML, JavaScript, CSS, URL, and other contexts where the output is not properly escaped. This issue is fixed in version 3.26.0.","status":"published","published":"2026-07-14T21:25:20.141Z","modified":"2026-10-28T02:30:39.142607009Z","cvss":[{"version":"4.0","score":5.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","level":"medium"}],"cwes":["CWE-116"],"updated_at":"2026-11-02T15:45:06.231145Z"},{"id":"DEBIAN-CVE-2026-46637","description":"Twig is a template language for PHP. Prior to 3.26.0, several filters in twig/markdown-extra and twig/cssinliner-extra are registered with is_safe =\u003e [all], causing Twig to treat plain text or HTML output as safe in HTML, JavaScript, CSS, URL, and other contexts where the output is not properly escaped. This issue is fixed in version 3.26.0.","status":"published","published":"2026-07-14T22:16:56.41Z","modified":"2026-10-01T03:02:41.586207924Z","cvss":[{"version":"3.1","score":5.4,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"updated_at":"2026-11-02T15:45:56.444225Z"},{"id":"GHSA-jv8m-2544-3pg3","title":"Twig: HTML-output filters in twig/* extras incorrectly declared `is_safe =\u003e ['all']`","description":"### Description\n\nSeveral filters in the `twig/*` extras packages are registered with `is_safe =\u003e ['all']`, which tells Twig's autoescaper to treat their output as safe in every context (`html`, `js`, `css`, `url`, ...). The output of these filters is plain text or HTML markup, neither of which is safe in every escaping context.\n\nAffected filters:\n\n- `html_to_markdown` (`twig/markdown-extra`) emits plain Markdown text. `league/html-to-markdown` decodes HTML entities when producing code spans and fenced blocks, so an attacker-controlled `\u003ccode\u003e\u0026lt;img src=x onerror=alert(1)\u0026gt;\u003c/code\u003e` becomes `` `\u003cimg src=x onerror=alert(1)\u003e` ``, which renders live when interpolated into an HTML page.\n- `markdown_to_html` (`twig/markdown-extra`) emits HTML. Safe in an HTML context but not in JS, CSS or URL contexts (e.g. when interpolated into an inline `\u003cscript\u003e` block).\n- `inline_css` (`twig/cssinliner-extra`) emits HTML with inlined styles. Same constraint as `markdown_to_html`.\n\nIn all three cases, `is_safe =\u003e ['all']` causes the autoescaper to emit the output verbatim in any context, even when the developer never wrote `|raw`. In a context such as a JS string or a URL parameter, this produces unescaped HTML and is exploitable as XSS.\n\n### Resolution\n\n- `html_to_markdown` no longer claims to be safe in any escaping context; its plain-text output is now autoescaped for the surrounding context.\n- `markdown_to_html` and `inline_css` are now declared `is_safe =\u003e ['html']`, asserting only what they actually guarantee.\n\n### Credits\n\nTwig would like to thank Claude Mythos Preview (via Project Glasswing) for reporting the issue and providing the fix for `html_to_markdown` and `markdown_to_html` in `twig/markdown-extra`, and Christophe Coevoet for extending the audit to `inline_css` in `twig/cssinliner-extra`.","status":"published","published":"2026-05-21T21:27:20Z","modified":"2026-09-10T03:51:06.308160656Z","cvss":[{"version":"4.0","score":1.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:U","level":"low"}],"cwes":["CWE-116"],"updated_at":"2026-11-02T15:46:51.10002Z"},{"id":"UBUNTU-CVE-2026-46637","description":"Twig is a template language for PHP. Prior to 3.26.0, several filters in twig/markdown-extra and twig/cssinliner-extra are registered with is_safe =\u003e [all], causing Twig to treat plain text or HTML output as safe in HTML, JavaScript, CSS, URL, and other contexts where the output is not properly escaped. This issue is fixed in version 3.26.0.","status":"published","published":"2026-07-14T22:16:00Z","modified":"2026-10-17T13:00:15.039500392Z","cvss":[{"version":"4.0","score":5.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","level":"medium"},{"version":"3.1","score":5.4,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"updated_at":"2026-11-02T16:56:30.797112Z"}]}}
