In Laravel's JSON:API resources (introduced in 12.45.0), a user with access to a read-only GET endpoint could wipe an entire related database table just by tweaking the include query parameter.
No write endpoint, no auth escalation, and no custom query code in your controller. A single GET request returned HTTP 500, and by the time the error page rendered, every row in the related table was already gone.
Triggering it with one query parameter
Say you have a standard AuthorResource that exposes a comments relationship. Normally, clients load related comments like this:
GET /api/authors/1?include=comments
Appending .truncate to that parameter triggered the bug (CVE-2026-114508):
GET /api/authors/1?include=comments.truncate
Laravel responded with a 500 error complaining about addEagerConstraints(), because truncate() didn't return an Eloquent Relation object. By then it was too late: Laravel had already executed TRUNCATE TABLE comments, deleting comments belonging to every author in the database.
Why Eloquent ran truncate()
The bug lived in src/Illuminate/Http/Resources/JsonApi/Concerns/ResolvesJsonApiElements.php inside compileResourceRelationships().
Laravel checked the top-level include (comments) against the relationships declared on AuthorResource. Right after resolving $relatedModels, it passed any nested include segments straight into Eloquent's loadMissing() without checking them against CommentResource:
// src/Illuminate/Http/Resources/JsonApi/Concerns/ResolvesJsonApiElements.php (before PR #61322)
foreach ($resourceRelationships as $relationName => $relationResolver) {
$relatedModels = $relationResolver->handle($this->resource);
if (! is_null($relatedModels) && $this->includesPreviouslyLoadedRelationships === false) {
if (! empty($relations = $request->sparseIncluded($relationName))) {
$relatedModels->loadMissing($relations);
}
}
yield from $this->compileResourceRelationshipUsingResolver(...);
}
When Eloquent tried to eager-load truncate on Comment, it called $comment->truncate(). Since Comment doesn't define a truncate() relationship method, Model::__call() forwarded the call straight to the Eloquent query builder, where truncate() is a real method that empties the table immediately.
It also worked deeper in the graph (for example, ?include=posts.comments.truncate) and wasn't limited to truncate: any zero-argument query builder method reachable through Model::__call() could be invoked the same way.
The fix
Taylor fixed this the same night in PR #61322 by removing the unvalidated $relatedModels->loadMissing($relations) call completely.
Instead, compileResourceRelationshipUsingResolver() now hands the remaining requested relationship paths down to each nested JsonApiResource instance ($relatedResource->requestedRelationships) and lets that resource resolve only the relationships it explicitly declares in toRelationships():
// src/Illuminate/Http/Resources/JsonApi/Concerns/ResolvesJsonApiElements.php (after PR #61322)
$relatedResource->requestedRelationships = $requestedRelationships;
if (! empty($requestedRelationships)) {
$relatedResource->includePreviouslyLoadedRelationships()->compileResourceRelationships($request);
}
Unrecognized nested segments like truncate are now ignored instead of being handed to Eloquent.
Affected versions
This was published as GHSA-5wcm-3v2w-8362 (CVE-2026-114508). It affects Laravel 12.45.0 through 12.67.x and Laravel 13.x below 13.27.0, and is patched in Laravel 12.68.0 and Laravel 13.27.0.