CVE-2024-50343: Incorrect response from Validator when input ends with `\n`
November 6, 2024 • Published by Fabien Potencier
Affected versions
Symfony versions <5.4.43; >=6, <6.4.11; >=7, <7.1.4 of the Symfony Validator component are affected by this security issue.
The issue has been fixed in Symfony 5.4.43, 6.4.11, and 7.1.4.
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.
Manage your notification preferences to receive an email as soon as a Symfony security release is published.
Help the Symfony project!
As with any Open-Source project, contributing code or documentation is the most common way to help, but we also have a wide range of sponsoring opportunities.
Here is the list of affected constraints: CardSchemeValidator, CssColorValidator, DateValidator, EmailValidator, TimeValidator and UrlValidator
Note also that if you're using the form component, it trims values by default so that you're not affected for the user input that goes through it.