CVE-2023-46734: Symfony/twig bridge Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-q847-2q57-wmr3
CVSS 6.1
CWE-79
Published
Advisory Summary

CVE-2023-46734 is a MODERATE (CVSS 6.1) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Symfony/twig bridge libraries in the Packagist ecosystem. The issue involves symfony potential cross-site scripting vulnerabilities in codeextension filters. Remediation is available by upgrading affected packages to version 4.4.51, 5.4.31, 6.3.8.

CVE-2023-46734 at a Glance

CVE Identifier CVE-2023-46734
GHSA Identifier GHSA-q847-2q57-wmr3
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Symfony/twig bridge
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 6.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2023-46734

To remediate this vulnerability, upgrade all affected Symfony/twig bridge 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/twig-bridge fixed: 4.4.51
Upgrade symfony/twig-bridge to 4.4.51
symfony/twig-bridge fixed: 5.4.31
Upgrade symfony/twig-bridge to 5.4.31
symfony/twig-bridge fixed: 6.3.8
Upgrade symfony/twig-bridge to 6.3.8
symfony/symfony fixed: 4.4.51
Upgrade symfony/symfony to 4.4.51
symfony/symfony fixed: 5.4.31
Upgrade symfony/symfony to 5.4.31
symfony/symfony fixed: 6.3.8
Upgrade symfony/symfony to 6.3.8
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/twig-bridge

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-46734, inspect your project dependencies for Symfony/twig bridge:

inspect dependencies for symfony/twig-bridge

Analyze the terminal output to locate any version of Symfony/twig bridge in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.4.51), 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/twig bridge, 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 Some Twig filters in CodeExtension use "is_safe=html" but don't actually ensure their input is safe. ### Resolution Symfony now escapes the output of the affected filters. The patch for this issue is available [here](https://github.com/symfony/symfony/commit/9da9a145ce57e4585031ad4bee37c497353eec7c) for branch 4.4. ### Credits We would like to thank Pierre Rudloff for reporting the issue and to Nicolas Grekas for providing the fix.

CVE-2023-46734 Affected Symfony/twig bridge Versions

6 component(s)
Fixed Versions:
4.4.515.4.316.3.8
Product / Package Ecosystem Affected Versions Fixed Version
symfony/twig-bridge
Packagist
≥ 2.0.0
< 4.4.51
4.4.51
symfony/twig-bridge
Packagist
≥ 5.0.0
< 5.4.31
5.4.31
symfony/twig-bridge
Packagist
≥ 6.0.0
< 6.3.8
6.3.8
symfony/symfony
Packagist
≥ 2.0.0
< 4.4.51
4.4.51
symfony/symfony
Packagist
≥ 5.0.0
< 5.4.31
5.4.31
symfony/symfony
Packagist
≥ 6.0.0
< 6.3.8
6.3.8

References

Frequently Asked Questions

What is CVE-2023-46734?
CVE-2023-46734 is a security vulnerability in Symfony/twig bridge involving Symfony potential Cross-site Scripting vulnerabilities in CodeExtension filters under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Symfony/twig bridge versions are affected?
Affected versions include releases prior to 4.4.51, 5.4.31, 6.3.8 across affected packages: symfony/twig-bridge, symfony/symfony.
What version fixes CVE-2023-46734?
Upgrading to 4.4.51, 5.4.31, 6.3.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is symfony/twig-bridge affected?
Yes, symfony/twig-bridge is affected in releases prior to 4.4.51, 5.4.31, 6.3.8. Upgrade your dependency to 4.4.51, 5.4.31, 6.3.8 or later.
Is symfony/symfony affected?
Yes, symfony/symfony is affected in releases prior to 4.4.51, 5.4.31, 6.3.8. Upgrade your dependency to 4.4.51, 5.4.31, 6.3.8 or later.
What is the CVSS score of CVE-2023-46734?
CVE-2023-46734 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2023-46734?
CVE-2023-46734 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-2023-46734?
Run the dependency tree command: 'inspect dependencies for symfony/twig-bridge'. 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-q847-2q57-wmr3",
  "modified" : "2023-11-12T15:52:51Z",
  "published" : "2023-11-12T15:52:51Z",
  "aliases" : [ "CVE-2023-46734" ],
  "summary" : "Symfony potential Cross-site Scripting vulnerabilities in CodeExtension filters",
  "details" : "### Description\n\nSome Twig filters in CodeExtension use \"is_safe=html\" but don't actually ensure their input is safe.\n\n### Resolution\n\nSymfony now escapes the output of the affected filters.\n\nThe patch for this issue is available [here](https://github.com/symfony/symfony/commit/9da9a145ce57e4585031ad4bee37c497353eec7c) for branch 4.4.\n\n### Credits\n\nWe would like to thank Pierre Rudloff for reporting the issue and to Nicolas Grekas for providing the fix.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "symfony/twig-bridge"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "4.4.51"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "symfony/twig-bridge"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0"
      }, {
        "fixed" : "5.4.31"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "symfony/twig-bridge"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0"
      }, {
        "fixed" : "6.3.8"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "symfony/symfony"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "4.4.51"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "symfony/symfony"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0"
      }, {
        "fixed" : "5.4.31"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "symfony/symfony"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0"
      }, {
        "fixed" : "6.3.8"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/symfony/symfony/security/advisories/GHSA-q847-2q57-wmr3"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-46734"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/symfony/symfony/commit/5d095d5feb1322b16450284a04d6bb48d1198f54"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/symfony/symfony/commit/9da9a145ce57e4585031ad4bee37c497353eec7c"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/symfony/symfony/CVE-2023-46734.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/symfony/symfony"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2023/11/msg00019.html"
  }, {
    "type" : "WEB",
    "url" : "https://symfony.com/cve-2023-46734"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-11-12T15:52:51Z",
    "nvd_published_at" : "2023-11-10T18:15:09Z"
  }
}