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

Published May 27, 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

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

9 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

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 Symfony profiler (Twig file_excerpt filter) to a version that resolves this vulnerability.

    Fixed in 6.4.40
  8. Upgrade

    Upgrade Symfony profiler (Twig file_excerpt filter) to a version that resolves this vulnerability.

    Fixed in 7.4.12
  9. Upgrade

    Upgrade Symfony profiler (Twig file_excerpt filter) to a version that resolves this vulnerability.

    Fixed in 8.0.12
  10. Compensating control

    Assume the Symfony WebProfiler code excerpt area is a development-only UI and prevent untrusted users from writing arbitrary bytes into any file under the project root (since this profiler renders excerpts of files like var/log/dev.log, which can enable stored XSS when opened).

Event History

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
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

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