Skip to content
PHP News
Search

Symfony security advisory

Symfony Twig Bridge: CodeExtension Filters Can Output Unescaped HTML

Published as "CVE-2023-46734: Potential XSS vulnerabilities in CodeExtension filters"

medium Symfony Symfony components · Last reviewed
CVE
CVE-2023-46734
GHSA
GHSA-q847-2q57-wmr3
Packagist
PKSA-y38q-cfj7-gm5p
Reported
Nov 10, 2023

Allows cross-site scripting when untrusted input reaches some CodeExtension Twig filters, which marked their output safe without escaping it.

Affected and fixed versions

In 2 packages: symfony/symfony and symfony/twig-bridge. Find the row for the version you run, and update to the release next to it.

If you run Update to Support
5.4.0 – 5.4.30 5.4.31 Supported
Show 27 older branches, no longer supported
6.0.0 – 6.0.x 6.3.8
6.1.0 – 6.1.x 6.3.8
6.2.0 – 6.2.x 6.3.8
6.3.0 – 6.3.7 6.3.8
5.0.0 – 5.0.x 5.4.31
5.1.0 – 5.1.x 5.4.31
5.2.0 – 5.2.x 5.4.31
5.3.0 – 5.3.x 5.4.31
2.0.0 – 2.0.x 4.4.51
2.1.0 – 2.1.x 4.4.51
2.2.0 – 2.2.x 4.4.51
2.3.0 – 2.3.x 4.4.51
2.4.0 – 2.4.x 4.4.51
2.5.0 – 2.5.x 4.4.51
2.6.0 – 2.6.x 4.4.51
2.7.0 – 2.7.x 4.4.51
2.8.0 – 2.x 4.4.51
3.0.0 – 3.0.x 4.4.51
3.1.0 – 3.1.x 4.4.51
3.2.0 – 3.2.x 4.4.51
3.3.0 – 3.3.x 4.4.51
3.4.0 – 3.x 4.4.51
4.0.0 – 4.0.x 4.4.51
4.1.0 – 4.1.x 4.4.51
4.2.0 – 4.2.x 4.4.51
4.3.0 – 4.3.x 4.4.51
4.4.0 – 4.4.50 4.4.51

Upgrade

Run the line for the branch you are on. 1 other package listed above is affected too; update it the same way.

composer require symfony/symfony:^5.4.31

Check your app with an agent

Paste this into a coding agent that can read your project, such as Claude Code, Codex or Amp. It checks your composer.lock against the versions above and tells you what to update, without changing anything.

Check whether the PHP project you have access to is affected by this security advisory, and tell me what to update. Do a read-only check: don't edit files, don't run composer update or composer require, and don't try to reproduce the flaw.

Advisory: Symfony Twig Bridge: CodeExtension Filters Can Output Unescaped HTML (CVE-2023-46734, GHSA-q847-2q57-wmr3)
Details: https://phpnews.net/security/symfony/ghsa-q847-2q57-wmr3

Affected versions, as Composer constraints:
- symfony/symfony, symfony/twig-bridge: >=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.4.0|>=2.4.0,<2.5.0|>=2.5.0,<2.6.0|>=2.6.0,<2.7.0|>=2.7.0,<2.8.0|>=2.8.0,<3.0.0|>=3.0.0,<3.1.0|>=3.1.0,<3.2.0|>=3.2.0,<3.3.0|>=3.3.0,<3.4.0|>=3.4.0,<4.0.0|>=4.0.0,<4.1.0|>=4.1.0,<4.2.0|>=4.2.0,<4.3.0|>=4.3.0,<4.4.0|>=4.4.0,<4.4.51|>=5.0.0,<5.1.0|>=5.1.0,<5.2.0|>=5.2.0,<5.3.0|>=5.3.0,<5.4.0|>=5.4.0,<5.4.31|>=6.0.0,<6.1.0|>=6.1.0,<6.2.0|>=6.2.0,<6.3.0|>=6.3.0,<6.3.8

Fixed releases on branches that still get security fixes:
- 5.4.0 – 5.4.30: update to 5.4.31

1. Find every composer.lock in the project outside vendor/ (a monorepo can have one per app) and read the installed version of each package above. Packages installed as dependencies of other packages count too.
2. Compare each installed version with its constraint: "|" separates alternative ranges, and "," means both bounds apply.
3. For each affected install, read the project's advisory at https://symfony.com/cve-2023-46734 and check whether the project meets the conditions it describes (if that page won't load, use https://github.com/advisories/GHSA-q847-2q57-wmr3). Say which conditions you could check and which you couldn't.
4. Report a table: lock file | package | installed version | affected (yes, no or unknown) | conditions met (yes, no or unknown) | update to | evidence. For each affected package, give the command that would fix it, without running it: composer update <package> --with-dependencies when it is only installed as a dependency of another package, or composer require with the fixed version when composer.json requires it directly. If the installed version is on a branch with no fixed release listed, say it needs a move to a newer branch.

Sources

← All Symfony advisories