Laravelの数値検証に指数の過大入力で大量のリソースを消費される脆弱性
Summary
Laravelのフレームワークで、multiple_ofルールと、別の数値フィールドと比べるgt・gte・lt・lteルールに脆弱性があります。極端な指数を含むリクエストで、メモリとCPUを大量に消費され、PHPのメモリ上限に達するおそれがあります。修正版はlaravel/frameworkの12.xと13.xブランチに取り込まれています。対応が難しい場合は、ルールの前にminやmaxで値を制限し、bailを付けてください。
AI summary
Produced by SecPulse using an external AI model; it may contain mistakes. Check the original description and references below before acting on it.
Laravelのフレームワークで、multiple_ofルールと、別の数値フィールドと比べるgt・gte・lt・lteルールに脆弱性があります。極端な指数を含むリクエストで、メモリとCPUを大量に消費され、PHPのメモリ上限に達するおそれがあります。修正版はlaravel/frameworkの12.xと13.xブランチに取り込まれています。対応が難しい場合は、ルールの前にminやmaxで値を制限し、bailを付けてください。
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| composerlaravel/framework |
>= 9.49.0→ Not listed |
Not listed |
This record does not list fixed versions. Check the article or the vendor advisory in the references for whether and where it is fixed.
Original description The description as published by the source.
Impact
The multiple_of validation rule, and the gt, gte, lt and lte rules when they compare against another numeric field, expand numeric input using arbitrary-precision arithmetic without bounding its exponent. A request containing a very small or very large exponent value, such as one in scientific notation, can cause excessive memory and CPU use and may exhaust PHP's memory limit. Applications are affected when these rules are applied to an unbounded numeric field, with no preceding bounding rule such as min, max or between combined with bail. Comparisons against literal numbers, and the min, max, between and size rules, are not affected.
Patches
The fix applies the framework's existing exponent range guard to these rules. It has been merged to the 12.x and 13.x branches: https://github.com/laravel/framework/pull/62589 and https://github.com/laravel/framework/pull/62590.
Workarounds
Bound the value before the affected rule and stop on failure, for example bail|numeric|min:0|max:100|multiple_of:2. Setting a low PHP memory limit can also make PHP stop early with a fatal error.
Source: GitHub Repository Security Advisories (Game のスタック) GitHub Advisory OSV
References
- GITHUB_REPO_ADVISORY laravel/framework