CVE-2026-47730
Twig: XSS in profiler HtmlDumper via unescaped template and profile names
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.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- Low
- User interaction
- Passive
What an attacker can affect
- Confidentiality
- None
- Integrity
- None
- Availability
- None
Exploit likelihood
What each source reports
CVE List Score used
5.1
Twig: XSS in profiler HtmlDumper via unescaped template and profile names
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.
- Record
CVE-2026-47730- CVSS 4.0
- 5.1 Medium
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 - Weakness
- CWE-79
- Updated
- 2026-11-02
EUVDEUVD-2026-44567
5.1
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.
- Record
EUVD-2026-44567- CVSS 4.0
- 5.1 Medium
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 - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-2g2g-8p8h-fgwm No score
Twig: XSS in profiler HtmlDumper via unescaped template and profile names
Description
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.
Resolution
HtmlDumper now runs both Profile::getTemplate() and Profile::getName() through htmlspecialchars() before inserting them into the HTML output.
Credits
Twig would like to thank El Kharoubi Iosif for reporting the issue and Nicolas Grekas for fixing it.
- Record
GHSA-2g2g-8p8h-fgwm- Weakness
- CWE-79
- Updated
- 2026-11-02
NVD
5.1
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.
- Record
CVE-2026-47730- CVSS 4.0
- 5.1 Medium
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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X - CVSS 3.1
- 5.4 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
OSV
5.1
Twig: XSS in profiler HtmlDumper via unescaped template and profile names
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.
- Record
CVE-2026-47730- CVSS 4.0
- 5.1 Medium
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 - Weakness
- CWE-79
- Updated
- 2026-11-02
OSVDEBIAN-CVE-2026-47730
5.4
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.
- Record
DEBIAN-CVE-2026-47730- CVSS 3.1
- 5.4 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N - Updated
- 2026-11-02
Show 5 moreShow less
OSVUBUNTU-CVE-2026-47730
5.1
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.
- Record
UBUNTU-CVE-2026-47730- CVSS 4.0
- 5.1 Medium
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 - CVSS 3.1
- 5.4 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N - Updated
- 2026-11-02
OSVCLSA-2026-1793788688 No score
TuxCare security update for twig/twig (1 CVE)
TuxCare rebuilt twig/twig to address 1 CVE. Fixed in v1.44.8-p3+tuxcare.
- Record
CLSA-2026-1793788688- Updated
- 2026-11-04
OSVCLSA-2026-1793789212 No score
TuxCare security update for twig/twig (1 CVE)
TuxCare rebuilt twig/twig to address 1 CVE. Fixed in v2.15.6-p3+tuxcare.
- Record
CLSA-2026-1793789212- Updated
- 2026-11-04
OSVCLSA-2026-1793789309 No score
TuxCare security update for twig/twig (2 CVEs)
TuxCare rebuilt twig/twig to address 2 CVEs. Fixed in v2.16.1-p3+tuxcare.
- Record
CLSA-2026-1793789309- Updated
- 2026-11-04
OSVGHSA-2g2g-8p8h-fgwm No score
Twig: XSS in profiler HtmlDumper via unescaped template and profile names
Description
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.
Resolution
HtmlDumper now runs both Profile::getTemplate() and Profile::getName() through htmlspecialchars() before inserting them into the HTML output.
Credits
Twig would like to thank El Kharoubi Iosif for reporting the issue and Nicolas Grekas for fixing it.
- Record
GHSA-2g2g-8p8h-fgwm- Weakness
- CWE-79
- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
twig/twigPackagist |
3.0.0 up to 3.26.0 | 3.26.0 |
twig/twigTuxCare:Packagist |
v1.44.8 up to v1.44.8-p3+tuxcare, plus listed versions v1.44.8-p1+tuxcarev1.44.8-p2+tuxcare |
v1.44.8-p3+tuxcare |
twig/twigTuxCare:Packagist |
v2.15.6 up to v2.15.6-p3+tuxcare, plus listed versions v2.15.6-p1+tuxcarev2.15.6-p2+tuxcare |
v2.15.6-p3+tuxcare |
twig/twigTuxCare:Packagist From an advisory covering 2 CVEs |
v2.16.1 up to v2.16.1-p3+tuxcare, plus listed versions v2.16.1-p1+tuxcarev2.16.1-p2+tuxcare |
v2.16.1-p3+tuxcare |
php-twigDebian:12 |
before 3.5.1-1+deb12u3, plus listed versions 3.5.1-13.5.1-1+deb12u13.5.1-1+deb12u2 |
3.5.1-1+deb12u3 |
php-twigDebian:13 |
before 3.27.0-0+deb13u1, plus listed versions 3.20.0-23.21.1-13.21.1-23.21.1-33.22.0-1 Show 11 moreShow less3.22.0-23.22.1-13.22.1-23.22.1-33.22.2-13.22.2-23.23.0-13.23.0-23.24.0-13.26.0-0+deb13u13.26.0-1 |
3.27.0-0+deb13u1 |
php-twigDebian:14 |
before 3.26.0-1, plus listed versions 3.20.0-23.21.1-13.21.1-23.21.1-33.22.0-1 Show 9 moreShow less3.22.0-23.22.1-13.22.1-23.22.1-33.22.2-13.22.2-23.23.0-13.23.0-23.24.0-1 |
3.26.0-1 |
twig/twigPackagist |
3.0.0 up to 3.26.0, plus listed versions v3.0.0v3.0.1v3.0.2v3.0.3v3.0.4 Show 45 moreShow lessv3.0.5v3.1.0v3.1.1v3.10.0v3.10.1v3.10.2v3.10.3v3.11.0v3.11.1v3.11.2v3.11.3v3.12.0v3.13.0v3.14.0v3.14.1v3.14.2v3.15.0v3.16.0v3.17.0v3.17.1v3.18.0v3.19.0v3.2.1v3.20.0v3.21.0v3.21.1v3.22.0v3.22.1v3.22.2v3.23.0v3.24.0v3.25.0v3.3.0v3.3.1v3.3.10v3.3.2v3.3.3v3.3.4v3.3.5v3.3.6v3.3.7v3.3.8v3.3.9v3.4.0v3.4.1 |
3.26.0 |
php-twigUbuntu:Pro:20.04:LTS |
All versions, plus listed versions 2.11.3-22.12.1-12.12.2-12.12.3-12.12.5-12.12.5-1ubuntu0.1~esm12.12.5-1ubuntu0.1~esm2 |
None known |
php-twigUbuntu:Pro:22.04:LTS |
All versions, plus listed versions 3.3.2-1ubuntu33.3.4-13.3.6-13.3.7-13.3.8-2ubuntu43.3.8-2ubuntu4+esm13.3.8-2ubuntu4+esm2 |
None known |
Show 4 moreShow less
| Package | Affected | Fixed |
|---|---|---|
php-twigUbuntu:Pro:24.04:LTS |
All versions, plus listed versions 3.7.0-13.7.1-13.8.0-23.8.0-2ubuntu0.1~esm13.8.0-2ubuntu13.8.0-2ubuntu1+esm1 |
None known |
php-twigUbuntu:25.10 |
All versions, plus listed versions 3.20.0-2ubuntu1 |
None known |
php-twigUbuntu:26.10 |
All versions, plus listed versions 3.23.0-2build73.27.1-13.28.0-1 |
None known |
php-twigUbuntu:Pro:26.04:LTS |
All versions, plus listed versions 3.20.0-2ubuntu13.23.0-2build53.23.0-2build73.23.0-2ubuntu0.1~esm1 |
None known |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected | ||
| affected, aliases, facts | OSV | |
| aliases | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2026-47730 is a medium vulnerability (CVSS 5.1) in Symfony Twig, published June 5, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.29%, the 22nd percentile. Fixed in twig/twig 3.26.0.
References
github.com/twigphp/Twig/security/advisories/GHSA-2g2g-8p8h-fgwm
github.com/twigphp/Twig/commit/a5f6e8793e603ef34fa86aed2a72f9fbe0b43745
github.com/twigphp/Twig/releases/tag/v3.26.0
github.com/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2026-47730.yaml
symfony.com/cve-2026-47730
github.com/advisories/GHSA-2g2g-8p8h-fgwm
Show 7 moreShow less
github.com/CVEProject/cvelistV5/tree/main/cves/2026/47xxx/CVE-2026-47730.json
nvd.nist.gov/vuln/detail/CVE-2026-47730
security-tracker.debian.org/tracker/CVE-2026-47730
github.com/twigphp/Twig
ubuntu.com/security/CVE-2026-47730
cve.org/CVERecord?id=CVE-2026-47730
symfony.com/blog/cve-2026-47730-xss-in-profiler-htmldumper-via-unescaped-template-and-profile-names
Left out here: 13 versions. The JSON record has them.