CVE-2026-46628: CWE-116: Improper Encoding or Escaping of Output in twigphp Twig
Twig, a PHP template language, has an improper encoding vulnerability in versions prior to 3.26.0. The deprecated spaceless filter is incorrectly registered as safe for HTML, which causes Twig's autoescaping mechanism to fail and emit unescaped attacker-controlled markup when spaceless is applied to untrusted input. This vulnerability is fixed in version 3.26.0.
AI Analysis
Technical Summary
CVE-2026-46628 describes a CWE-116 vulnerability in twigphp's Twig template engine. Before version 3.26.0, the deprecated spaceless filter was marked as safe for HTML output, bypassing Twig's autoescaping protections. This allows attacker-controlled input to be rendered without proper escaping, potentially leading to injection of malicious markup. The issue is resolved in Twig 3.26.0 by correcting the filter's safety registration.
Potential Impact
The vulnerability can cause unescaped attacker-controlled markup to be output in HTML contexts, which may lead to cross-site scripting (XSS) or other injection attacks if untrusted input is processed with the spaceless filter. The CVSS 4.0 base score is 5.1 (medium severity), indicating a moderate risk with network attack vector, low complexity, and no privileges required but user interaction needed.
Mitigation Recommendations
Upgrade Twig to version 3.26.0 or later, where this vulnerability is fixed. No official patch or temporary fix is indicated other than upgrading. Until upgraded, avoid applying the deprecated spaceless filter to untrusted input to reduce risk.
CVE-2026-46628: CWE-116: Improper Encoding or Escaping of Output in twigphp Twig
Description
Twig, a PHP template language, has an improper encoding vulnerability in versions prior to 3.26.0. The deprecated spaceless filter is incorrectly registered as safe for HTML, which causes Twig's autoescaping mechanism to fail and emit unescaped attacker-controlled markup when spaceless is applied to untrusted input. This vulnerability is fixed in version 3.26.0.
CVSS v4.0
Score 5.1medium
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
CVE-2026-46628 describes a CWE-116 vulnerability in twigphp's Twig template engine. Before version 3.26.0, the deprecated spaceless filter was marked as safe for HTML output, bypassing Twig's autoescaping protections. This allows attacker-controlled input to be rendered without proper escaping, potentially leading to injection of malicious markup. The issue is resolved in Twig 3.26.0 by correcting the filter's safety registration.
Potential Impact
The vulnerability can cause unescaped attacker-controlled markup to be output in HTML contexts, which may lead to cross-site scripting (XSS) or other injection attacks if untrusted input is processed with the spaceless filter. The CVSS 4.0 base score is 5.1 (medium severity), indicating a moderate risk with network attack vector, low complexity, and no privileges required but user interaction needed.
Mitigation Recommendations
Upgrade Twig to version 3.26.0 or later, where this vulnerability is fixed. No official patch or temporary fix is indicated other than upgrading. Until upgraded, avoid applying the deprecated spaceless filter to untrusted input to reduce risk.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-05-15T19:34:14.013Z
- Cvss Version
- 4.0
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 6a56aea068715ace4342b0d1
Added to database: 07/14/2026, 21:48:16 UTC
Last enriched: 07/21/2026, 22:48:24 UTC
Last updated: 08/28/2026, 10:52:08 UTC
Views: 58
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.