Advisory Database
  • Advisories
  • Dependency Scanning
  1. composer
  2. ›
  3. twig/twig
  4. ›
  5. CVE-2026-47730

CVE-2026-47730: Twig: XSS in profiler HtmlDumper via unescaped template and profile names

June 5, 2026

Twig\Profiler\Dumper\HtmlDumper writes Profile::getTemplate() and Profile::getName() straight into its HTML output without escaping:

protected function formatTemplate(Profile $profile, $prefix): string
{
return \sprintf('%s└ <span style="background-color: %s">%s</span>', $prefix, self::$colors['template'], $profile->getTemplate());
}

The template name comes from the loader (the array key for ArrayLoader, a row id for a database-backed loader, etc.). When that name is attacker-controlled, the profiler dump emits arbitrary HTML, and any browser that renders it executes the injected markup. This is an output-encoding bug in profiler/debug tooling, not a sandbox escape.

References

  • github.com/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2026-47730.yaml
  • github.com/advisories/GHSA-2g2g-8p8h-fgwm
  • github.com/twigphp/Twig/releases/tag/v3.26.0
  • github.com/twigphp/Twig/security/advisories/GHSA-2g2g-8p8h-fgwm
  • nvd.nist.gov/vuln/detail/CVE-2026-47730
  • symfony.com/cve-2026-47730

Code Behaviors & Features

Detect and mitigate CVE-2026-47730 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 3.0.0 before 3.26.0

Fixed versions

  • 3.26.0

Solution

Upgrade to version 3.26.0 or above.

Weakness

  • CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Source file

packagist/twig/twig/CVE-2026-47730.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 12 Jul 2026 12:17:12 +0000.