Automated Threat Modeling

Overview of CVE-2026-142612: Laravel Framework Denial of Service via Amplified JSON Key Processing

A brief summary of CVE-2026-142612, an unauthenticated denial of service in Laravel's TransformsRequest middleware where a small JSON body triggers gigabytes of key string building. Covers root cause, the 13.38.0 and 12.74.0 patches, and affected versions.

CVE Analysis

9 min read

Gaurav Sarraf
Gaurav Sarraf

2026-12-02

Overview of CVE-2026-142612: Laravel Framework Denial of Service via Amplified JSON Key Processing

Introduction

A JSON request body of under 1 MB was enough to keep a default Laravel application's PHP worker busy until its execution timeout, and a handful of such requests sent concurrently was enough to make a fresh Laravel Cloud instance stop responding. Where the work happens matters more than the size of the request. It runs inside global middleware that executes before routing and authentication, so the attacker needs no account and no knowledge of a valid route.

The issue is tracked as CVE-2026-142612 (GitHub advisory GHSA-8h64-cpq2-9h2g), scored CVSS 3.1 7.5 (High) with the vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H and classified as CWE 770, Allocation of Resources Without Limits or Throttling. The impact is availability only. There is no documented code execution or data exposure. As of December 2, 2026, the threat intelligence we reviewed reports no evidence of exploitation in the wild, and the CVE is not listed in CISA's Known Exploited Vulnerabilities catalog. That said, the researcher's writeup describing the payload structure has been public since November 22, 2026, ahead of the CVE record itself.

Technical information

Root cause: dotted key paths rebuilt for every element

The vulnerable code is in Illuminate\Foundation\Http\Middleware\TransformsRequest. This class is the base for TrimStrings and ConvertEmptyStringsToNull, both of which Laravel registers as global middleware by default. Global middleware executes before Laravel checks whether the requested route even exists.

TransformsRequest::cleanArray() walks the request input recursively. For every element, it builds a full dotted key path by concatenating the parent prefix and the current key. Before the fix, the line at the heart of the loop was:

$data[$key] = $this->cleanValue($keyPrefix.$key, $value);

If a single parent key is very long and holds a very large array, that long prefix is copied once for every child. Server-side string building grows with key length multiplied by element count, while the request body on the wire stays small.

A few details make this worse:

  • The work happens even when the values are integers that never need trimming. Before the fix, TrimStrings::transform() checked is_string($value) only after computing array_merge($this->except, static::$neverTrim) and running shouldSkip() key matching.
  • The reporter identifies exclusion matching through Str::is() as part of the repeated per-element cost.
  • Writing every value back into $data triggers PHP copy-on-write duplication of arrays even when nothing changed.

Measured amplification

Two separate demonstrations were published. They are different tests with different payloads, so their numbers do not conflict:

  • Original researcher report: a JSON body of roughly 790 KB, containing a roughly 395 KB key holding 200,000 integer values, produced roughly 78 GB of temporary string data. A single request occupied a worker until its execution timeout.
  • Laravel backport PR #62582: a body of about 590 KB, with a key of about 295 KB holding about 147,000 items, led to roughly 43 GB of string building and about 30 seconds of CPU time.

The gigabyte figures describe accumulated string building and allocation churn rather than peak resident memory. They also show why a conventional request body limit is not evidence of protection: the original payload was below 1 MB and passed the default limits in the reported setup.

Attack flow

Based on the published research, the attack proceeds as follows:

  1. The attacker constructs a JSON body containing one very long key whose value is a large array of small values, such as integers.
  2. The request is sent to the application. Because TrimStrings and ConvertEmptyStringsToNull run globally before routing, the path does not need to match a real route and no session or credentials are required.
  3. cleanArray() recurses into the array and, for each child, concatenates the long prefix with the child key, producing tens of gigabytes of temporary string work from a sub-megabyte body.
  4. The PHP worker handling the request stays busy until its execution timeout.
  5. A small number of these requests sent concurrently occupies every available PHP worker, and the application stops serving legitimate traffic. In the researcher's test, a fresh Laravel Cloud instance stopped responding.

The actual failure threshold for a given deployment depends on worker count, timeouts, and other configuration. The published results demonstrate the mechanism rather than a universal threshold.

Patch information

Laravel fixed this in laravel/framework 13.38.0 and 12.74.0. The GitHub advisory GHSA-8h64-cpq2-9h2g lists >=13.38.0 and >=12.74.0 as patched ranges. On 13.x the fix consists of two commits by Taylor Otwell dated October 20, 2026: 1b8b12d ("limit bytes") and 31dbc2b ("adjust parsing"). Both were cherry-picked to 12.x as b7f41a9 through PR #62582, merged on November 23, 2026.

Fix 1: a per-request budget for key bytes (1b8b12d)

Rather than redesign the traversal, Laravel added a meter on exactly the work that gets amplified:

use Illuminate\Http\Exceptions\PostTooLargeException; protected $maxKeyBytes = 20 * 1024 * 1024; protected $keyBytes = 0; public function handle($request, Closure $next) { $this->keyBytes = 0; $this->clean($request);
protected function cleanArray(array $data, $keyPrefix = '') { $prefixLength = strlen($keyPrefix); foreach ($data as $key => $value) { $this->keyBytes += $prefixLength + strlen((string) $key); if ($this->keyBytes > $this->maxKeyBytes) { throw new PostTooLargeException('The cumulative size of the input keys is too large.'); } $data[$key] = $this->cleanValue($keyPrefix.$key, $value); }

What this does:

  • It counts the real cost. Each iteration adds strlen($keyPrefix) + strlen($key), which is the size of the string the concatenation is about to build. Summed across the recursion, that is the total string building cost including amplification. Counting raw body bytes would miss the attack, since the body is small.
  • It checks before doing the work. The check precedes cleanValue(), so once the total exceeds the limit no further concatenation happens. Worst-case string building per request drops to about 20 MiB.
  • The client receives a 413. PostTooLargeException is thrown and the tests assert status 413, so the request never reaches later middleware or the controller.
  • One budget covers all input sources. The counter is shared by every parameter bag that gets cleaned. Tests confirm that query string keys plus JSON or form keys together consume the same 20 MiB, so splitting the payload across sources does not help.
  • The counter resets per request. handle() sets $keyBytes back to 0, so a reused middleware instance does not carry counts between requests (testKeyBudgetResetsWhenMiddlewareIsReused).
  • The limit is overridable. $maxKeyBytes is a protected property, so a subclass can change it. The fix works by refusing excessive key processing, so raising or removing the limit works against it.

The regression test testRejectsAmplifiedJsonKeys rebuilds the attack shape: a key of str_repeat('è', 197499) (about 395 KB, since è is a two-byte character in UTF-8) holding array_fill(0, 100, $value). Each child path repeats the 395 KB prefix, for a total of about 40 MB, well above the budget. It runs against TransformsRequest, TrimStrings, and ConvertEmptyStringsToNull, with integer, padded string, empty string, and array values.

Fix 2: less work per element (31dbc2b)

The second commit reduces the constant per-element cost that is still paid below the budget. In cleanArray(), the array is only written back when a value actually changed, which avoids triggering copy-on-write duplication:

$cleaned = $this->cleanValue($keyPrefix.$key, $value); // Avoid copying arrays when none of their values have changed... if ($cleaned !== $value) { $data[$key] = $cleaned; }

In TrimStrings::transform(), values that are not strings now return immediately, before the exclusion list merge and shouldSkip() matching:

if (! is_string($value)) { return $value; } $except = array_merge($this->except, static::$neverTrim); if ($this->shouldSkip($key, $except)) {

The test testUnchangedNestedArraysAreNotCopied sends 20,000 nested [0] arrays and asserts memory growth below 1 MiB, and testNonStringValuesDoNotCheckExclusions confirms shouldSkip() is never called for values that are not strings.

The 12.x backport

PR #62582 cherry-picks both commits onto 12.x without conflicts while preserving authorship. The PR notes that 12.x remains within its security fix window, that v12.73.0 still contained the old loop, and that 19 of the new tests fail when the source change is removed.

Things to check after upgrading

  • Custom middleware. The counter lives inside the framework's own cleanArray(). An application subclass of TransformsRequest that fully overrides cleanArray() bypasses the budget. Teams with custom input transform middleware should confirm they still go through the parent logic.
  • Compatibility. Test request handling after the upgrade, since the cumulative key limit can reject unusually large key structures that older versions accepted.
  • Verify the deployed version. Inspect composer.lock for the installed laravel/framework version rather than assuming a recent upgrade is sufficient.
  • Containment is not a substitute. Published guidance discusses web server or reverse proxy body limits, PHP post_max_size, memory_limit, and max_execution_time, worker termination timeouts, and CDN or reverse proxy rate limiting. These bound the blast radius but do not fix the amplification. The original payload passed default body limits, a worker stayed occupied until timeout, and the vendor notes only a few concurrent requests are needed. No workaround beyond upgrading was published.

Affected systems and versions

  • Package: laravel/framework (Composer)
  • 13.x branch: versions 13.0.0 and later, before 13.38.0. Fixed in 13.38.0.
  • 12.x and earlier: versions below 12.74.0. Fixed in 12.74.0 on the 12.x branch. The CVE record lists no separate fixed release for older major branches.
  • Vulnerable configuration: applications using the default global TrimStrings and/or ConvertEmptyStringsToNull middleware (or any subclass of TransformsRequest) that accept JSON request bodies from untrusted clients. Authentication and route existence do not matter, since the middleware runs first.

Per Laravel's support schedule, version 12 receives security fixes until February 24, 2027, and version 13 until March 17, 2028.

Vendor security history

This CVE is one of a small cluster of resource exhaustion findings in Laravel's request handling.

  • Follow-up variant. After the key budget shipped, the same researcher published a bypass using roughly 450,000 tiny nested arrays that stay under the 20 MiB key budget while still causing memory exhaustion through copy-on-write costs. The researcher reports additional mitigation shipped in 13.39.0, describing preserved copy-on-write behavior for unchanged arrays and early returns for values that are not strings. This does not change the minimum fixed versions for CVE-2026-142612, but it shows that bounding one resource proxy (key bytes) does not necessarily bound another (memory).
  • distinct validation rule. A separate advisory, GHSA-jrc9-gpx2-4p3r, describes wildcard array validation with the distinct rule taking quadratic time, consuming excessive CPU, and exhausting workers. Laravel lists fixes in 12.75.0 and 13.45.0.

On the process side, Laravel shipped the original fix in 13.38.0, backported it to the maintained 12.x branch through PR #62582, and published 12.74.0 with the backport in its release notes the day after the advisory. The project's security policy directs reports to [email protected]. We treat 13.38.0 and 12.74.0 as the floor for this specific CVE, and we recommend planning upgrades around the full set of applicable advisories rather than a single minimum version.

References

Detect & fix
what others miss

Works with
  • GitHub
  • GitLab
  • Bitbucket
  • Azure DevOps Services
  • Gerrit
  • CVS
  • Jira
  • Linear
  • Slack
  • Security Compass
Explore integrations
Security magnifying glass visualization