Description
Twig is a template language for PHP. From 3.0.0 until 3.26.0, Twig\Profiler\Dumper\HtmlDumper writes Profile::getTemplate() and Profile::getName() into HTML output without escaping, allowing attacker-controlled template or profile names to inject arbitrary HTML when a browser renders the profiler dump. 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, used for PHP templating, includes a profiler that outputs profiling information to HTML. Between versions 3.0.0 and 3.26.0, the HtmlDumper component wrote the template name and profiler name directly into the HTML without escaping. An attacker who can influence these names can inject arbitrary HTML or JavaScript, causing the browser that displays the profiler dump to execute malicious code. The flaw is mitigated by upgrading to 3.26.0 or newer, which properly escapes these values. The issue was fixed in Twig version 3.26.0.

Affected Systems

All Twig installations from version 3.0.0 up to and excluding 3.26.0 are affected. The flaw resides in the Twig:Twig product maintained by twigphp.

Risk and Exploitability

The CVSS score of 5.1 indicates a medium severity, and the EPSS score of less than 1% suggests a very low probability of widespread exploitation. The vulnerability is not listed in the CISA KEV catalog. Exploitation requires that an attacker can trigger the rendering of a profiler dump containing a manipulated template or profile name, which is typically confined to environments where the Twig profiler is enabled and accessible by privileged users. Consequently, the attack vector is constrained, but the threat remains relevant for any exposed debug interfaces.

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

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Apply the Twig update to version 3.26.0 or later, which removes the unescaped output bug
  • In production environments, disable the Twig profiler or restrict its access to trusted administrative users to prevent accidental exposure
  • If an immediate upgrade is not possible, configure Twig to escape profiler output or replace HtmlDumper with a safer dumper implementation, ensuring that any user‑supplied names are properly escaped

Generated by OpenCVE AI on July 31, 2026 at 04:35 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-2g2g-8p8h-fgwm Twig: XSS in profiler HtmlDumper via unescaped template and profile names
History

Tue, 21 Jul 2026 16:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

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


Wed, 15 Jul 2026 15:15:00 +0000

Type Values Removed Values Added
First Time appeared Twigphp
Twigphp twig
Vendors & Products Twigphp
Twigphp twig

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

Type Values Removed Values Added
Description Twig is a template language for PHP. From 3.0.0 until 3.26.0, Twig\Profiler\Dumper\HtmlDumper writes Profile::getTemplate() and Profile::getName() into HTML output without escaping, allowing attacker-controlled template or profile names to inject arbitrary HTML when a browser renders the profiler dump. This issue is fixed in version 3.26.0.
Title Twig: XSS in profiler HtmlDumper via unescaped template and profile names
Weaknesses CWE-79
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'}


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-07-21T14:45:11.407Z

Reserved: 2026-05-19T21:29:25.483Z

Link: CVE-2026-47730

cve-icon Vulnrichment

Updated: 2026-07-21T14:45:01.504Z

cve-icon NVD

No data.

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

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

Weaknesses
  • CWE-79

    Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')