CVE-2026-45072: Stored XSS in WebProfiler CodeExtension::fileExcerpt(): Unescaped Non-PHP File Rendering

Published May 20, 2026
·
Updated

Description

Symfony's profiler, a development only debug UI, renders source-code excerpts on several pages using Twig's custom fileexcerpt filter. This filter renders PHP files via highlightstring() (which escapes HTML), but renders non-PHP files by splitting on \n and interpolating each line directly into <code>{$line}</code> with no escaping.

An attacker who can write arbitrary bytes into any file under the project root (including e.g. var/log/dev.log), achieves stored XSS against any developer who later opens that file in the profiler.

Resolution

The fileexcerpt filter now properly escapes each line of non-PHP files using htmlspecialchars() before concatenating them.

The patch for this issue is available here for branch 6.4.

Credits

Symfony would like to thank Claude Mythos Preview (via Project Glasswing) for reporting the issue and providing the fix.

Other sources

CVE-2026-45072: Stored XSS in WebProfiler CodeExtension::fileExcerpt(): Unescaped Non-PHP File Rendering

— Packagist

Symfony is a PHP framework for web and console applications and a set of reusable PHP components. From 6.4.24 until 6.4.40, 7.4.12, and 8.0.12, the development profiler fileexcerpt Twig filter escapes PHP files through highlightstring() but interpolates lines from non-PHP files directly into <code> elements, allowing stored XSS against a developer who opens an attacker-written file such as var/log/dev.log in the profiler. This issue is fixed in versions 6.4.40, 7.4.12, and 8.0.12.

— MITRE

Affected Software

20 affected componentsFixes available
composer/symfony/web-profiler-bundle>=8.0.0<8.0.12
8.0.12
composer/symfony/web-profiler-bundle>=7.2.9<7.4.12
7.4.12
composer/symfony/twig-bridge>=6.4.24<6.4.40
6.4.40
composer/symfony/symfony>=8.0.0<8.0.12
8.0.12
composer/symfony/symfony>=7.2.9<7.4.12
7.4.12
composer/symfony/symfony>=6.4.24<6.4.40
6.4.40
SensioLabs Symfony>=6.4.24<6.4.40
SensioLabs Symfony>=7.2.9<7.4.12
SensioLabs Symfony>=8.0.0<8.0.12
composer/symfony/symfony>=6.4.24, <6.4.40
6.4.40
composer/symfony/symfony>=7.2.9, <7.3.0
composer/symfony/symfony>=7.3.0, <7.4.0
composer/symfony/symfony>=7.4.0, <7.4.12
7.4.12
composer/symfony/symfony>=8.0.0, <8.0.12
8.0.12
composer/symfony/twig-bridge>=6.4.24, <6.4.40
6.4.40
composer/symfony/web-profiler-bundle>=7.2.9, <7.3.0
composer/symfony/web-profiler-bundle>=7.3.0, <7.4.0
composer/symfony/web-profiler-bundle>=7.4.0, <7.4.12
7.4.12
composer/symfony/web-profiler-bundle>=8.0.0, <8.0.12
8.0.12
debian/symfony
5.4.53+dfsg-0+deb12u16.4.41+dfsg-0+deb13u16.4.49+dfsg-0+deb13u17.4.22+dfsg-17.4.23+dfsg-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/symfony/web-profiler-bundle to a version that resolves this vulnerability.

    Fixed in 8.0.12
  2. Upgrade

    Upgrade composer/symfony/web-profiler-bundle to a version that resolves this vulnerability.

    Fixed in 7.4.12
  3. Upgrade

    Upgrade composer/symfony/twig-bridge to a version that resolves this vulnerability.

    Fixed in 6.4.40
  4. Upgrade

    Upgrade composer/symfony/symfony to a version that resolves this vulnerability.

    Fixed in 8.0.12
  5. Upgrade

    Upgrade composer/symfony/symfony to a version that resolves this vulnerability.

    Fixed in 7.4.12
  6. Upgrade

    Upgrade composer/symfony/symfony to a version that resolves this vulnerability.

    Fixed in 6.4.40
  7. Upgrade

    Upgrade debian/symfony to a version that resolves this vulnerability.

    Fixed in 5.4.53+dfsg-0+deb12u1Fixed in 6.4.41+dfsg-0+deb13u1Fixed in 6.4.49+dfsg-0+deb13u1Fixed in 7.4.22+dfsg-1Fixed in 7.4.23+dfsg-1
  8. Upgrade

    Upgrade Symfony to a version that resolves this vulnerability.

    Fixed in 6.4.40Patch 863aa81c61166f1aa74b7732df316f76113acbdb

Event History

May 20, 2026
Advisory Published
via Packagist·08:00 AM
Data Sourced
via Packagist·08:00 AM
DescriptionSeverityAffected Software
May 27, 2026
Advisory Published
via GitHub·09:10 PM
Data Sourced
via GitHub·09:10 PM
DescriptionWeaknessAffected Software
Jul 14, 2026
CVE Published
via MITRE·06:11 PM
Data Sourced
via MITRE·06:11 PM
DescriptionWeakness
Data Sourced
via NVD·07:17 PM
RemedyDescriptionSeverityWeaknessAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Frequently Asked Questions

1

What is the severity of CVE-2026-45072?

CVE-2026-45072 has a risk rating of 30.

2

How do I fix CVE-2026-45072?

To fix CVE-2026-45072, update to the latest patched version of the Symfony components affected.

3

What types of files are vulnerable in CVE-2026-45072?

CVE-2026-45072 affects the rendering of non-PHP files using Twig's `file_excerpt` filter.

4

What vulnerability type is CVE-2026-45072 classified under?

CVE-2026-45072 is classified under Cross-Site Scripting (XSS) vulnerabilities.

5

Which Symfony packages are impacted by CVE-2026-45072?

The impacted Symfony packages include composer/symfony/symfony, composer/symfony/web-profiler-bundle, and composer/symfony/twig-bridge.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203