CVE-2026-45072: Symfony/symfony :fileExcerpt() — Unescaped Non-PHP File Vulnerability

LOW
Advisory Identifier: GHSA-hmr5-2xcr-v8pp
CWE-79
Published
Advisory Summary

CVE-2026-45072 is a LOW :fileexcerpt() — unescaped non-php file vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Symfony/symfony libraries in the Packagist ecosystem. The issue involves :fileexcerpt() — unescaped non-php file rendering. Remediation is available by upgrading affected packages to version 6.4.40, 7.4.12, 8.0.12.

CVE-2026-45072 at a Glance

CVE Identifier CVE-2026-45072
GHSA Identifier GHSA-hmr5-2xcr-v8pp
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Symfony/symfony
Package Ecosystem Packagist
Published Date
Last Updated

How to Fix CVE-2026-45072

To remediate this vulnerability, upgrade all affected Symfony/symfony dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

symfony/symfony fixed: 6.4.40
Upgrade symfony/symfony to 6.4.40
symfony/symfony fixed: 7.4.12
Upgrade symfony/symfony to 7.4.12
symfony/symfony fixed: 8.0.12
Upgrade symfony/symfony to 8.0.12
symfony/twig-bridge fixed: 6.4.40
Upgrade symfony/twig-bridge to 6.4.40
symfony/web-profiler-bundle fixed: 7.4.12
Upgrade symfony/web-profiler-bundle to 7.4.12
symfony/web-profiler-bundle fixed: 8.0.12
Upgrade symfony/web-profiler-bundle to 8.0.12
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for symfony/symfony

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-45072, inspect your project dependencies for Symfony/symfony:

inspect dependencies for symfony/symfony

Analyze the terminal output to locate any version of Symfony/symfony in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.4.40), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Symfony/symfony, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Description Symfony's profiler, a development only debug UI, renders source-code excerpts on several pages using Twig's custom `file_excerpt` filter. This filter renders PHP files via `highlight_string()` (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 `file_excerpt` filter now properly escapes each line of non-PHP files using `htmlspecialchars()` before concatenating them. The patch for this issue is available [here](https://github.com/symfony/symfony/commit/863aa81c61166f1aa74b7732df316f76113acbdb) for branch 6.4. ### Credits Symfony would like to thank Claude Mythos Preview (via Project Glasswing) for reporting the issue and providing the fix.

CVE-2026-45072 Affected Symfony/symfony Versions

6 component(s)
Fixed Versions:
6.4.407.4.128.0.12
Product / Package Ecosystem Affected Versions Fixed Version
symfony/symfony
Packagist
≥ 6.4.24
< 6.4.40
6.4.40
symfony/symfony
Packagist
≥ 7.2.9
< 7.4.12
7.4.12
symfony/symfony
Packagist
≥ 8.0.0
< 8.0.12
8.0.12
symfony/twig-bridge
Packagist
≥ 6.4.24
< 6.4.40
6.4.40
symfony/web-profiler-bundle
Packagist
≥ 7.2.9
< 7.4.12
7.4.12
symfony/web-profiler-bundle
Packagist
≥ 8.0.0
< 8.0.12
8.0.12

References

Frequently Asked Questions

What is CVE-2026-45072?
CVE-2026-45072 is a security vulnerability in Symfony/symfony involving :fileExcerpt() — Unescaped Non-PHP File Rendering under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Symfony/symfony versions are affected?
Affected versions include releases prior to 6.4.40, 7.4.12, 8.0.12 across affected packages: symfony/symfony, symfony/twig-bridge, symfony/web-profiler-bundle.
What version fixes CVE-2026-45072?
Upgrading to 6.4.40, 7.4.12, 8.0.12 (or the latest patched release for your respective branch) resolves the vulnerability.
Is symfony/symfony affected?
Yes, symfony/symfony is affected in releases prior to 6.4.40, 7.4.12, 8.0.12. Upgrade your dependency to 6.4.40, 7.4.12, 8.0.12 or later.
Is symfony/twig-bridge affected?
Yes, symfony/twig-bridge is affected in releases prior to 6.4.40. Upgrade your dependency to 6.4.40 or later.
What CWE is associated with CVE-2026-45072?
CVE-2026-45072 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check Packagist dependencies for CVE-2026-45072?
Run the dependency tree command: 'inspect dependencies for symfony/symfony'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-hmr5-2xcr-v8pp",
  "modified" : "2026-05-27T21:10:44Z",
  "published" : "2026-05-27T21:10:44Z",
  "aliases" : [ "CVE-2026-45072" ],
  "summary" : "Symfony Vulnerable to stored XSS in WebProfiler CodeExtension::fileExcerpt() — Unescaped Non-PHP File Rendering",
  "details" : "### Description\n\nSymfony's profiler, a development only debug UI, renders source-code excerpts on several pages using Twig's custom `file_excerpt` filter. This filter renders PHP files via `highlight_string()` (which escapes HTML), but renders **non-PHP files** by splitting on `\\n` and interpolating each line directly into `<code>{$line}</code>` with no escaping. \n\nAn 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.\n\n### Resolution\n\nThe `file_excerpt` filter now properly escapes each line of non-PHP files using `htmlspecialchars()` before concatenating them.\n\nThe patch for this issue is available [here](https://github.com/symfony/symfony/commit/863aa81c61166f1aa74b7732df316f76113acbdb) for branch 6.4.\n\n### Credits\n\nSymfony would like to thank Claude Mythos Preview (via Project Glasswing) for reporting the issue and providing the fix.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "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:U"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "symfony/symfony"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.4.24"
      }, {
        "fixed" : "6.4.40"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "symfony/symfony"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.2.9"
      }, {
        "fixed" : "7.4.12"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "symfony/symfony"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "8.0.0"
      }, {
        "fixed" : "8.0.12"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "symfony/twig-bridge"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.4.24"
      }, {
        "fixed" : "6.4.40"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "symfony/web-profiler-bundle"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.2.9"
      }, {
        "fixed" : "7.4.12"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "symfony/web-profiler-bundle"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "8.0.0"
      }, {
        "fixed" : "8.0.12"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/symfony/symfony/security/advisories/GHSA-hmr5-2xcr-v8pp"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/symfony/symfony/commit/863aa81c61166f1aa74b7732df316f76113acbdb"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/symfony/symfony/CVE-2026-45072.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/symfony/twig-bridge/CVE-2026-45072.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/symfony/web-profiler-bundle/CVE-2026-45072.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/symfony/symfony"
  }, {
    "type" : "WEB",
    "url" : "https://symfony.com/cve-2026-45072"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-27T21:10:44Z",
    "nvd_published_at" : null
  }
}