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 => [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.
Published: 2026-07-14
Score: 5.1 Medium
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

Twig is a template language for PHP. Prior to version 3.26.0, several filters in the twig/markdown-extra and twig/cssinliner-extra extensions were registered with the attribute 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. Consequently, user‑supplied content that is rendered by these filters could be injected into web pages or other outputs without escaping, potentially leading to cross‑site scripting or other injection attacks. The weakness corresponds to CWE‑116 (Improper Encoding or Escaping). The issue is resolved by upgrading to version 3.26.0 or later.

Affected Systems

All installations of the Twig PHP template engine prior to version 3.26.0 that depend on the cssinliner‑extra or markdown‑extra extensions are affected. Systems that use earlier releases of Twig must update to 3.26.0 or a later version that includes the fix.

Risk and Exploitability

The CVSS score of 5.1 indicates a moderate severity. The EPSS score of less than 1% suggests a very low likelihood that this vulnerability is being actively exploited in the wild, and the vulnerability is not listed in the CISA KEV catalog. Based on the description, the most likely attack vector is the delivery of crafted template content that is rendered by Twig, leading to unsafe output in a web page or other context. However, no remote code execution or privilege escalation is described, and exploitation requires access to template rendering in an untrusted context.

Generated by OpenCVE AI on July 31, 2026 at 04:34 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade Twig and its cssinliner‑extra and markdown‑extra extensions to version 3.26.0 or later, where the is_safe attribute is restricted to appropriate contexts.
  • If an upgrade is not immediately possible, re‑configure the affected filters to remove or narrow the is_safe=>[all] declaration, ensuring output is properly escaped for each rendering context.
  • Validate any user‑supplied content before passing it to Twig or apply an additional sanitization step to neutralize potential script or style injections.

Generated by OpenCVE AI on July 31, 2026 at 04:34 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Debian DSA Debian DSA DSA-6311-1 php-twig security update
Debian DSA Debian DSA DSA-6320-1 php-twig security update
Github GHSA Github GHSA GHSA-jv8m-2544-3pg3 Twig: HTML-output filters in twig/* extras incorrectly declared `is_safe => ['all']`
History

Mon, 27 Jul 2026 13:15:00 +0000

Type Values Removed Values Added
First Time appeared Twig
Twig cssinliner-extra
Twig markdown-extra
Twigphp
Twigphp twig
Vendors & Products Twig
Twig cssinliner-extra
Twig markdown-extra
Twigphp
Twigphp twig

Thu, 16 Jul 2026 15:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Tue, 14 Jul 2026 21:45:00 +0000

Type Values Removed Values Added
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 => [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.
Title Twig: HTML-output filters in twig/* extras incorrectly declared `is_safe => ['all']`
Weaknesses CWE-116
References
Metrics cvssV4_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'}


Subscriptions

Twig Cssinliner-extra Markdown-extra
Twigphp Twig
cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-07-16T15:05:57.087Z

Reserved: 2026-05-15T20:11:54.584Z

Link: CVE-2026-46637

cve-icon Vulnrichment

Updated: 2026-07-16T15:05:52.849Z

cve-icon NVD

No data.

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-07-31T04:45:17Z

Weaknesses
  • CWE-116

    Improper Encoding or Escaping of Output