Symfony has an incorrect response from Validator when input ends with `\n`
Description
It is possible to trick a Validator configured with a regular expression using the $ metacharacters, with an input ending with \n.
Resolution
Symfony now uses the D regex modifier to match the entire input.
The patch for this issue is available here for branch 5.4.
Credits
We would like to thank Offscript for reporting the issue and Alexandre Daubois for providing the fix.
Affected software
Click a technology to see all vulnerabilities affecting it.
| Platform | Package | Vulnerable versions | Fixed in |
|---|---|---|---|
| Composer package | symfony/symfony | < 5.4.43, >= 6.0.0, < 6.4.11, >= 7.0.0, < 7.1.4 | 5.4.43, 6.4.11, 7.1.4 |
| Composer package | symfony/validator | < 5.4.43, >= 6.0.0, < 6.4.11, >= 7.0.0, < 7.1.4 | 5.4.43, 6.4.11, 7.1.4 |
References
- https://github.com/symfony/symfony/security/advisories/GHSA-g3rh-rrhp-jhh9
- https://nvd.nist.gov/vuln/detail/CVE-2024-50343
- https://github.com/symfony/symfony/commit/7d1032bbead9a4229b32fa6ebca32681c80cb76f
- https://github.com/FriendsOfPHP/security-advisories/blob/master/symfony/symfony/CVE-2024-50343.yaml
- https://github.com/FriendsOfPHP/security-advisories/blob/master/symfony/validator/CVE-2024-50343.yaml
- https://github.com/symfony/symfony
- https://lists.debian.org/debian-lts-announce/2025/05/msg00051.html
- https://symfony.com/cve-2024-50343
- CVSS vector
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N- Weakness (CWE)
CWE-20- Platform
- Composer
- Package
symfony/symfony, symfony/validator- Disclosed
- 06.11.2024
- Updated
- 11.10.2026 10:22
Sources and licenses
OSV / GitHub Advisory Database - GHSA-g3rh-rrhp-jhh9 - CC BY 4.0
Vulnerability history: symfony/validator
All published vulnerabilities of this package (Composer package), newest first. Shows whether this is a one-off slip or a package that needs watching.
- Total entries
- 3
- First → latest
- 05.2022 11.2024
- Without a fix
- 0
- Exploited in attacks
- 0
Severity breakdown
- High 2
- Low 1
Disclosures per year
- 2022: 1
- 2023: 0
- 2024: 2
- 2025: 0
- 2026: 0
-
Symfony has an incorrect response from Validator when input ends with `\n` this entry
Know which vulnerabilities affect your application
With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.