CVE-2026-47730

Twig: XSS in profiler HtmlDumper via unescaped template and profile names

Published Jul 14, 2026 CVSS 4.0 · 5.1 Medium EPSS < 1% KEV · Not listed
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.

Analysis

AI-generated

Technical 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.

Remediation

No solution or workaround provided in the CVE record.

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
Type Values Removed Values Added
Metrics ssvc

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

Type Values Removed Values Added
First Time appeared Twigphp
Twigphp twig
Vendors & Products Twigphp
Twigphp twig
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'}

Weaknesses
  • CWE-79

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

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Jul 21, 2026, 2:45 PM
Reserved
May 19, 2026, 9:29 PM
Status
Analyzed
Published
Jul 14, 2026, 10:16 PM
Modified
Oct 24, 2026, 10:10 PM