CVE-2026-47730: Twig XSS in Profiler HtmlDumper

CVE-2026-47730 · Severity: low · CVSS 0 · Published 2026-07-14

Twig, a popular template engine for PHP applications, contains a security flaw in its profiling tool used by developers. If an application allows users to influence template or profile names, an attacker could inject malicious scripts that execute in the browser of a developer or administrator viewing the profiler output. This could lead to unauthorized actions being performed in the context of the user's session.

Technologies: twig/twig (Packagist). Vendors: Packagist.

Quick answers

Is CVE-2026-47730 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-47730 being exploited in the wild.
How severe is CVE-2026-47730?
Low severity, with a CVSS score of 0, published 14 July 2026.
Which products and versions are affected?
twig/twig (Packagist) >= 3.0.0, < 3.26.0, ECOSYSTEM:introduced=3.0.0,fixed=3.26.0.
Is there a fix for CVE-2026-47730?
Yes. twig/twig (Packagist): upgrade to 3.26.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-47730 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-47730?
Check whether you run twig/twig (Packagist) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • twig/twig (Packagist): upgrade to 3.26.0 or later
    composer require twig/twig:^3.26.0

Technical details

A Cross-Site Scripting (XSS) vulnerability exists in the Twig Profiler's HtmlDumper component. The root cause is the failure to neutralize output from Profile::getTemplate() and Profile::getName() before interpolating them into HTML spans within the formatTemplate method. If an application uses a loader (such as ArrayLoader or a database-backed loader) where template identifiers are user-controllable, an attacker can inject arbitrary HTML/JavaScript. The exploit occurs when a user views the generated profiler dump in a browser. This is fixed in version 3.26.0 by applying htmlspecialchars() to the affected profile data.

Affected products

  • twigphp Twig >= 3.0.0, < 3.26.0

Identifiers

  • CVE-2026-47730
  • GHSA-2g2g-8p8h-fgwm

Timeline

  • 2026-05-20: patched: Fixed in version 3.26.0
  • 2026-05-20: advisory: GitHub Security Advisory GHSA-2g2g-8p8h-fgwm published
  • 2026-07-14: disclosed: CVE-2026-47730 published to NVD

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.