CVE-2026-46637
mediumpriority · track · 22EPSS 0.003 · 23 %ileEUUSEPSS · scored 2026-10-26
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 => [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.
cvss
Technical severity, 0–10. One row per scoring source.
base score 0–10 · higher = more severe · hover a vector to decode⚠ sources disagree · low–medium · 1.2–5.4
ssvc
A stakeholder decision — act, attend, or track — from exploitation and impact.
weaknesses
The CWE weakness classes this flaw belongs to.
affected products (6)
Products and version ranges known to be affected.
advisories (1)
Vendor and ecosystem advisories describing this.
- GHSA-jv8m-2544-3pg3Twig: HTML-output filters in twig/* extras incorrectly declared `is_safe => ['all']`2026-05-21ghsa · osvUS
### Description Several filters in the `twig/*` extras packages are registered with `is_safe => ['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. Affected filters: - `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 `<code><img src=x onerror=alert(1)></code>` becomes `` `<img src=x onerror=alert(1)>` ``, which renders live when interpolated into an HTML page. - `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 `<script>` block). - `inline_css` (`twig/cssinliner-extra`) emits HTML with inlined styles. Same constraint as `markdown_to_html`. In all three cases, `is_safe => ['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. ### Resolution - `html_to_markdown` no longer claims to be safe in any escaping context; its plain-text output is now autoescaped for the surrounding context. - `markdown_to_html` and `inline_css` are now declared `is_safe => ['html']`, asserting only what they actually guarantee. ### Credits Twig 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`.
also known as (3)
Other names and identifiers for this entity.
sources
Which sources assert this record, and when.
references (13)
External citations — patches, advisories, analysis.
- https://github.com/twigphp/Twig/commit/84982072c79a7417b0d158a401d91344f3658299cnnvd
- https://github.com/twigphp/Twig/commit/e36489d3521ecbfc08bdcc61294302557035f14acnnvd
- https://github.com/twigphp/Twig/releasesPatchcnnvd
- https://github.com/twigphp/Twig/releases/tag/v3.26.0cnnvd
- https://github.com/twigphp/Twig/security/advisories/GHSA-jv8m-2544-3pg3cnnvd
- https://github.com/twigphp/Twig/commit/84982072c79a7417b0d158a401d91344f3658299enisa_euvd
- https://github.com/twigphp/Twig/commit/e36489d3521ecbfc08bdcc61294302557035f14aenisa_euvd
- https://github.com/twigphp/Twig/releases/tag/v3.26.0enisa_euvd
Attackers weaponise vulnerabilities like this against internet-exposed services. See what is exposed on your perimeter with a free passive scan.
Free scan