Denial of Service using the `distinct` validation rule
Summary
Impact
The distinct validation rule could take quadratic time when validating large wildcard arrays. An unauthenticated attacker who can submit a large array to an endpoint that validates it with distinct (for example items.*) could consume excessive CPU time and exhaust application wor...
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| composerlaravel/framework |
<12.75.0→ >=12.75.0 |
>=12.75.0 |
| composerlaravel/framework |
<13.45.0→ >=13.45.0 |
>=13.45.0 |
Original description The description as published by the source.
Impact
The distinct validation rule could take quadratic time when validating large wildcard arrays. An unauthenticated attacker who can submit a large array to an endpoint that validates it with distinct (for example items.*) could consume excessive CPU time and exhaust application workers. Affected values include booleans, null, empty arrays and, with ignore_case, non-string values. A request of roughly 220 KB could exceed the default PHP execution time limit.
Patches
The distinct rule now groups values by how PHP compares them, so each item is compared with only a small number of values. The fix was merged to the 12.x and 13.x branches in laravel/framework
- https://github.com/laravel/framework/pull/62668 (12.x): merged; stable releases: v13.45.0
- https://github.com/laravel/framework/pull/62667 (12.x): merged; stable releases: v13.45.0
- https://github.com/laravel/framework/pull/62666 (13.x): merged; stable releases: v13.45.0
Source: GitHub Repository Security Advisories (Game のスタック) GitHub Advisory OSV
References
- GITHUB_REPO_ADVISORY laravel/framework