CVE-2026-46637·PHP vulnerability
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.
- Severity
- medium
- Software
- PHP
- Fixed in
- 3.26.0
- Published
How likely is exploitation
FIRST's Exploit Prediction Scoring System puts the probability of this CVE being exploited in the next 30 days at 0.31% — higher than 23% of all published CVEs. EPSS is an independent forecast of exploitation, not a severity rating: it says nothing about how much damage a successful attack does, which is what a CVSS score measures.
Affected versions
Until: 3.26.0
Fixed in: 3.26.0
How to fix this CVE
Upgrade PHP and its Twig template engine to version 3.26.0 or later to remediate unsafe filter handling in markdown-extra and cssinliner-extra extensions. These filters were incorrectly marked as safe across all contexts, allowing potential output injection in HTML, JavaScript, CSS, and URL contexts. Update immediately to prevent template-based injection attacks.
sudo dnf update php php-twigDefensia detects this vulnerability
How to check if you are affected
- Step 1: Check installed PHP version with `php -v` and verify Twig installation with `php -r "echo phpversion('twig');"` or inspect composer.json for twig/twig version
- Step 2: Search for usage of markdown-extra and cssinliner-extra filters in application templates with `find /var/www -name '*.twig' -o -name '*.html.twig' | xargs grep -l 'markdown_extra\|css_inline'`
- Step 3: Review application logs for suspicious template rendering errors or unexpected output in HTTP responses containing CSS, JavaScript, or URL attributes with `grep -i 'twig\|template' /var/log/apache2/error.log /var/log/nginx/error.log`
- Step 4: Verify the fix by running `php -r "echo (version_compare(phpversion('twig'), '3.26.0', '>=') ? 'Patched' : 'Vulnerable');"` to confirm Twig version is 3.26.0 or higher
FAQ
What is CVE-2026-46637?
CVE-2026-46637 is a security vulnerability in Twig's markdown-extra and cssinliner-extra filters that incorrectly mark their output as safe across all contexts, potentially allowing attackers to inject malicious content through template injection when these filters process untrusted input.
Is CVE-2026-46637 being actively exploited?
No, CVE-2026-46637 is not listed on the CISA Known Exploited Vulnerabilities (KEV) catalog and no public exploit code is currently available, though this does not eliminate the need for timely patching.
What versions of PHP are affected by CVE-2026-46637?
All versions of PHP using Twig prior to version 3.26.0 are affected, particularly those with twig/markdown-extra and twig/cssinliner-extra extensions installed.
How do I check if my server is vulnerable to CVE-2026-46637?
Run `composer show twig/twig` in your PHP application directory to display the installed Twig version; if it is below 3.26.0, your system is vulnerable.
Does Defensia detect CVE-2026-46637?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If PHP and Twig are installed on a monitored server, CVE-2026-46637 will appear in your dashboard with remediation steps.
Related PHP CVEs
References
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2026-46637. Free for 1 server.
Get started free