
Cloud Vulnerability DB
A community-led vulnerabilities database
Email, Url, Uuid and Ip report "<valid value>\n" as valid, because their patterns end in $ without the D modifier (PCRE: $ also matches before a final newline). The validator does not return a cleaned value, so the application keeps the string with the newline. Symfony treated the same class in its validator as a low-severity advisory (CVE-2024-50343), which is why this is reported privately rather than as a public issue. A fix with tests will follow as a PR in this advisory's temporary private fork.
Affected locations (2.6.1 = master @ 12ae801):
src/Rule/EmailHandler.php:120 (pattern from Email.php:91-93)src/Rule/UrlHandler.php:46 (pattern from Url.php:81)src/Rule/UuidHandler.php:22src/Rule/IpHandler.php:79
The same patterns are in every tag from 1.0.0 (Email, Url, Ip) and from 2.3.0 (Uuid, added then) - checked by reading the tags; reproduced on 2.6.1 only (PHP 8.3.36).
Expected: "user@example.com\n" is rejected like "user@example.com " or "user@example.com\r\n" are.
Suggested fixUuid / Ip: add D to their private patterns.Email / Url: their patterns are public options meant for client-side reuse (the Url docblock asks for no modifiers), so keep them and reject a value ending in "\n" in the handler before matching (this also covers custom patterns).
The fix adds "trailing newline" data sets to EmailTest, UrlTest, UuidTest and IpTest that fail before and pass after; php-cs-fixer, rector and psalm are clean.$validator = new \Yiisoft\Validator\Validator();
var_dump($validator->validate("user@example.com\n", [new \Yiisoft\Validator\Rule\Email()])->isValid()); // true
var_dump($validator->validate("0f8fad5b-d9cb-469f-a165-70867728950e\n", [new \Yiisoft\Validator\Rule\Uuid()])->isValid()); // trueReproducer output (isolated offline container, 2.6.1):
== Email()
valid value "user@example.com" -> ACCEPTED (strlen 16)
value + "\n" (CLAIM) "user@example.com\n" -> ACCEPTED (strlen 17)
value + "\r\n" "user@example.com\r\n" -> rejected (strlen 18)
value + " " "user@example.com " -> rejected (strlen 17)
"\n" + value "\nuser@example.com" -> rejected (strlen 17)
value + "\n\n" "user@example.com\n\n" -> rejected (strlen 18)
== Uuid() "0f8fad5b-d9cb-469f-a165-70867728950e\n" -> ACCEPTED (strlen 37)
== Ip() "192.168.0.1\n" -> ACCEPTED (strlen 12)
== Url() "https://example.com\n" -> ACCEPTED (strlen 20)
== Email(allowName: true) "John <user@example.com>\n" -> ACCEPTED (strlen 24)Every control (\r\n, a space, !, a leading \n, \n\n) is rejected for all four rules.
An app that trusts "valid" and stores or compares the raw value gets a 1-byte-longer string: a unique e-mail column accepts "a@b.co\n" next to "a@b.co", UUID/IP lookups miss. It cannot inject a header or a log line (only one trailing \n, nothing after it).
Severity: the CVSS 3.1 formula gives AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N (5.3), but the realistic impact is lower, so we suggest Low, in line with the Symfony advisory for the same class (CVE-2024-50343). Your call.
Issue found and fixed by Claude, then reviewed and confirmed by Ief (GitHub: iefken).
Full disclosure from my end: I am in my 'starter'-steps in learning how to find and report these kinds of bugs/issue's with the help from my (spare-) AI (-usage tokens), so any feedback is greatly appreciated aswell :)
Source: NVD
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."