Skip to main content
Menu
Advisories

Numeric validation can exhaust resources via extreme exponent input

GHSA-C25C-X5R7-2V5MPublished Updated GitHub

Description

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: github.com/laravel/framework/pull/62589 and 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.

Affected versions

References

GitHub · laravel/framework