# A 21-byte form post can stall Laravel. Bound your numbers.

- Canonical: https://ansezz.com/blog/laravel-numeric-rules-exponent-dos/
- Markdown: https://ansezz.com/blog/laravel-numeric-rules-exponent-dos/index.md
- Published: 2026-12-01
- Description: Before Laravel 12.74.0 and 13.44.1, a tiny scientific-notation value could keep a worker busy for about 10 seconds. Patch, then bound every numeric field.
- Category: [laravel](https://ansezz.com/blog/category/laravel/)
- Tags: [laravel](https://ansezz.com/blog/tag/laravel/), [security](https://ansezz.com/blog/tag/security/), [performance](https://ansezz.com/blog/tag/performance/)

Send `quantity=1e-100000000` to a Laravel route with `multiple_of:2`. On 13.43.0 that took my local server about 10 seconds. The request body is 21 bytes.

**TL;DR**

- Laravel [12.74.0 and 13.44.1](https://github.com/laravel/framework/security/advisories/GHSA-c25c-x5r7-2v5m) fix a high severity problem. `multiple_of`, and `gt`, `gte`, `lt`, `lte` against another field, did arbitrary-precision math on a number with no limit on its exponent.
- On the version before the fix, one such request kept a worker busy for 9 to 11 seconds in my test. Four at once left a trivial route waiting about 21 seconds on two workers.
- The patch is the first fix. The second is to put `bail`, `numeric`, `min` and `max` ahead of any math rule. In the same test, that alone made the old version safe.

This is a different kind of validation bug from the [exists rule](/blog/laravel-exists-rule-json-bypass/) one. That was a wrong answer. This one is a right answer that costs too much to compute.

## What Laravel fixed on 24 November

The advisory is [GHSA-c25c-x5r7-2v5m](https://github.com/laravel/framework/security/advisories/GHSA-c25c-x5r7-2v5m), published on 25 November. It says the `multiple_of` rule, and `gt`, `gte`, `lt` and `lte` when they compare against another numeric field, expand input with arbitrary-precision arithmetic and never bound the exponent. A value in scientific notation, very small or very large, can burn memory and CPU until PHP hits its memory limit.

It affects apps that use those rules on an unbounded numeric field. Comparisons against literal numbers, and `min`, `max`, `between` and `size`, are not affected.

The fix is in two pull requests, [#62589](https://github.com/laravel/framework/pull/62589) for 12.x and [#62590](https://github.com/laravel/framework/pull/62590) for 13.x. Both were merged on 23 November. They shipped in [12.74.0](https://github.com/laravel/framework/releases/tag/v12.74.0) and [13.44.1](https://github.com/laravel/framework/releases/tag/v13.44.1) on 24 November.

**Try this**

Run `composer show laravel/framework`. You want 12.74.0 or later on 12.x, and 13.44.1 or later on 13.x.

## One short field, ten seconds

I built a stock Laravel app with two public routes and ran the same form posts against 13.43.0 and 13.44.1. The run was on 1 December 2026, at 14:11 Africa/Casablanca (UTC+0), on a local server with two PHP workers and a 256M memory limit.

```bash
curl -X POST http://127.0.0.1:8098/quote -d 'quantity=1e-100000000'
```

The route validates `quantity` as `required|numeric|multiple_of:2`. I sent the value as a form field. A bare JSON number would not work as a test, because PHP decodes `1e-100000000` as `0.0`. It has to arrive as a string, in a form or in quotes.

| Request | 13.43.0 | 13.44.1 |
| -- | -- | -- |
| `quantity=4` | 200, 0.15 s | 200, 0.12 s |
| `quantity=1e-100000000` | 422, 9.7 s | 422, 0.12 s |
| `quantity=1e100000000` | 200, 9.7 s | 422, 0.10 s |

The large exponent case is the odd one. On 13.43.0 the server worked for about ten seconds and then answered 200. It decided `1e100000000` was a multiple of 2. After the patch, it is a quick 422.

## Where a small request becomes an outage

Ten seconds is bad. The worker count makes it worse.

I sent four of those requests at once, then asked a trivial `GET /ping` for an answer while both workers were busy. On 13.43.0 the ping took about 21 seconds. On 13.44.1 it took 0.09 seconds.

![Comic pop-art scene of two sweating yellow robots at service windows buried under paper tape while a line of small blue robots waits outside a closed door, under the words BOTH WORKERS BUSY](/blog/laravel-numeric-rules-exponent-dos/inline-2.webp)

*Two workers, four slow requests. The ping waits behind them.*

The advisory describes the same shape: a small number of these requests at once can use up every PHP worker. My server is not FPM and this is not a load test. But a pool has a size too, and you only need a few slow requests to fill it.

> The request is 21 bytes. The cost is whatever the exponent says.

The memory limit changes what you see. With a 128M limit, the same request on 13.43.0 failed fast. It returned a 500 in about 0.18 seconds, because PHP could not allocate the 100 MB the math wanted. At 256M, PHP had room to try, so the worker spent the time first.

That means a low memory limit is a way to make the damage shorter, not a fix. The advisory lists it as a workaround, along with bounding the value.

## The rules that were already safe

The same run shows which rules held up on 13.43.0.

In a separate process per case, with the value `1e-100000000`:

- `multiple_of` took about 9 to 11 seconds and peaked near 199 MB.
- `gt:bar` and `lte:bar`, against another field, answered in about 140 ms but also peaked near 199 MB.
- `gt:0` and `max:100` were rejected in about 9 ms at 8 MB.
- `bail|numeric|min:0|max:100|multiple_of:2` was rejected in about 11 ms at 8 MB.

The last one is the point. When `min` and `max` came first, with `bail`, the huge exponent never reached `multiple_of`. The over-HTTP version of the same rule list, `/quote-bounded`, returned a 422 in about 0.1 seconds on the old Laravel.

**Math rule on its own:** `['required', 'numeric', 'multiple_of:2']`

A value with a huge exponent reaches the math.

**Bounded first:** `['bail', 'required', 'numeric', 'min:0', 'max:1000', 'multiple_of:2']`

`max` rejects it first, and `bail` stops there.

![Comic pop-art scene of a blue robot lowering a striped barrier and holding a ruler across a conveyor to stop an endless paper ribbon from entering a machine, under the words BOUND IT FIRST](/blog/laravel-numeric-rules-exponent-dos/inline-1.webp)

*Put the barrier before the machine.*

## The patch changes two behaviours

The fix is small, and it is not silent. Two things are different after it.

First, these rules now share the limit that `min`, `max` and `size` already used: an exponent outside plus or minus 1000 fails. On 13.44.1, `max:100` accepted `1e-1000` and rejected `1e-1001`. Real prices and quantities do not look like that. The limit is a default, and `Validator` has an `ensureExponentWithinAllowedRangeUsing` method if you ever need your own.

Second, the Eloquent `decimal:N` cast uses the same guard. The PR text says values the numeric rules reject now throw the cast's existing `MathException`. On 13.43.0, reading `'1e-100000000'` through a `decimal:2` cast ran out of memory at 256M and died with a fatal error. On 13.44.1 it throws `MathException: Unable to cast value to a decimal.`, which you can catch.

**Note**

The same release also fixes a separate denial of service through a crafted JSON body ([GHSA-8h64-cpq2-9h2g](https://github.com/laravel/framework/security/advisories/GHSA-8h64-cpq2-9h2g)). The advisory gives no detail, so I did not test it. It lists 12.74.0, and 13.38.0 or later, as patched.

## What I would check this week

Update first. On 12.x, that is 12.74.0. On 13.x, it is 13.44.1. If you self-host [Coolify](https://github.com/coollabsio/coolify/releases/tag/v4.7.10), its 4.7.10 notes list both advisories and move Laravel to 12.74.0.

Then search your own rules for `multiple_of` and for `gt`, `gte`, `lt` and `lte` with a field name after the colon. For each one, look at what comes before it. If there is no `bail`, no `min` and no `max`, add them. Pick bounds that match the real data, such as `max:1000` for a quantity.

Do not test this against production. Use a local copy on the old version, or a staging box you can afford to stall.

**Key takeaways**

- Laravel 12.74.0 and 13.44.1 fix an unbounded exponent in `multiple_of` and in `gt`, `gte`, `lt`, `lte` against another field. A 21-byte form post kept one worker busy for about 10 seconds on the old version.
- Bound first: `bail`, `numeric`, `min`, `max`, then the math rule. That alone protected the old version in my test.
- After the patch, an exponent past plus or minus 1000 is rejected, and a `decimal:N` cast throws `MathException` instead of dying.

Which of your numeric fields has no `max` yet?
