CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-142637

CVE-2026-142637: Query Logic Injection in Laravel Database Validation Rules

Alon Barad
Alon Barad
Software Engineer

Dec 4, 2026·11 min read·1 visit

Executive Summary (TL;DR)

Laravel versions prior to 12.73.0 and 13.43.0 serialize fluent Rule::exists() and Rule::unique() scalar where() conditions into string rules before parsing them. Attackers who control a scope parameter can inject reserved tokens ('NULL', 'NOT_NULL', or '!') to convert strict equality checks into IS NULL, IS NOT NULL, or inequality predicates, bypassing database validation scopes.

CVE-2026-142637 (GHSA-ch34-gjmh-c4hp) is a query logic injection vulnerability (CWE-943) in the Laravel framework prior to versions 12.73.0 and 13.43.0. When fluent database validation rules such as Rule::exists() or Rule::unique() are scoped using the scalar where() method, the framework serializes the rule object into its legacy comma-delimited string format and subsequently reparses it. During reparsing, the database presence verifier evaluates specific reserved tokens—'NULL', 'NOT_NULL', and values prefixed with '!'—as SQL predicates rather than literal values. If an application passes untrusted user input into a fluent where() scope, an attacker can supply these sentinel tokens to alter the SQL evaluation logic and bypass multi-tenant isolation or ownership validation.

Vulnerability Overview

Laravel provides a validation component (Illuminate\Validation) capable of verifying database state through the exists and unique rules. Developers can define these rules using either legacy colon-and-comma delimited strings (e.g., 'exists:projects,id,tenant_id,101') or the object-oriented fluent interface (Rule::exists('projects', 'id')->where('tenant_id', $tenantId)). These rules are commonly deployed at HTTP controller boundaries to enforce relational integrity and verify that referenced database records belong to the requesting user or tenant context.

In Laravel versions prior to 12.73.0 and 13.43.0, a flaw classified under CWE-943 (Improper Neutralization of Special Elements in Data Query Logic) exists in how the validation engine processes fluent Illuminate\Validation\Rules\DatabaseRule instances. Although the fluent where() API accepts separate column and scalar value arguments—resembling a parameterized query builder—the validation parser internally casts the fluent object back into a raw validation string before execution if no closure callbacks are attached.

When the string representation is subsequently parsed and passed to DatabasePresenceVerifier, the verifier checks the condition values against reserved syntactic tokens used by the legacy string rule format. Specifically, the string 'NULL' is translated into an IS NULL clause, 'NOT_NULL' is translated into an IS NOT NULL clause, and any string beginning with '!' is translated into a non-equality (!=) predicate.

If an application passes user-controlled input into the scalar where() method of Rule::exists() or Rule::unique(), an attacker can inject these reserved tokens or delimiter escape sequences. Rather than comparing the database column against the literal input string, the database presence verifier modifies the structure of the underlying SQL WHERE clause. In applications that rely on validation scoping to enforce multi-tenant boundaries or object ownership, this permits unauthorized cross-tenant record references or widens uniqueness constraints.

Root Cause Analysis

The root cause of CVE-2026-142637 is the loss of semantic type separation when fluent DatabaseRule objects are serialized into flat string representations and re-interpreted by the legacy rule parser. Both Illuminate\Validation\Rules\Exists and Illuminate\Validation\Rules\Unique inherit from Illuminate\Validation\Rules\DatabaseRule, which stores scalar conditions in the $this->wheres array and closure conditions in $this->using.

During the validation lifecycle, Illuminate\Validation\ValidationRuleParser::prepareRule() prepares each rule attached to an attribute. In vulnerable versions, prepareRule() checked whether an Exists or Unique rule contained closure callbacks via $rule->queryCallbacks(). If the developer only used scalar .where('column', $value) calls, $rule->queryCallbacks() returned an empty array. Consequently, prepareRule() converted the rule object into a string by invoking DatabaseRule::__toString(), which called formatWheres():

protected function formatWheres()
{
    return (new Collection($this->wheres))
        ->map(fn ($where) => $where['column'].','.'"'.str_replace('"', '""', $where['value']).'"')
        ->implode(',');
}

Once converted into a comma-separated string (for example, exists:projects,id,tenant_id,"NOT_NULL"), the validator parses the string back into an array of parameters using ValidationRuleParser::parseParameters() and passes them to ValidatesAttributes::getExistCount() or ValidatesAttributes::validateUnique(). These methods extract the extra key-value pairs via getExtraConditions() and forward them to DatabasePresenceVerifier::addConditions().

Inside DatabasePresenceVerifier::addWhere(), the verifier has no knowledge of whether a condition originated from a raw string rule or a fluent where('column', $value) call. It inspects the string value directly to determine the SQL operator:

  • If $value === 'NULL', it invokes $query->whereNull($key).
  • If $value === 'NOT_NULL', it invokes $query->whereNotNull($key).
  • If str_starts_with($value, '!'), it invokes $query->where($key, '!=', mb_substr($value, 1)).
  • Otherwise, it invokes $query->where($key, '=', $value).

Furthermore, because DatabaseRule implemented its own convenience methods whereNull(), whereNotNull(), and whereNot() by delegating directly to $this->where($column, 'NULL'), $this->where($column, 'NOT_NULL'), and $this->where($column, '!'.$value), the class itself conflated literal equality values with internal operator tokens. In addition, crafting values containing backslashes and double quotes (such as x\",id,NOT_NULL,type,"!) allowed attackers to confuse the CSV parameter parser during string deserialization and inject or override adjacent column conditions.

Code Analysis

The remediation, implemented in commits 029e3a4ceb0c8b7e8394639b161e7d4ef906af54 (Laravel 13.x) and ef1821b33245d58631784ac2093aed0c5bb91242 (Laravel 12.x), resolves the vulnerability by preserving explicit operator metadata inside DatabaseRule and bypassing the string serialization round-trip during rule execution.

First, Illuminate\Validation\Rules\DatabaseRule was updated so that where(), whereNot(), whereNull(), and whereNotNull() record an explicit operator field alongside the column and value instead of encoding operators into the value string:

// File: src/Illuminate/Validation/Rules/DatabaseRule.php
 
public function where($column, $value = null)
{
    if ($column instanceof Arrayable || is_array($column)) {
        return $this->whereNested(fn ($query) => $query->where($column));
    }
 
    if ($column instanceof Closure) {
        return $this->using($column);
    }
 
    if (is_null($value)) {
        return $this->whereNull($column);
    }
 
    $value = enum_value($value);
 
    // Explicitly store '=' as the operator for literal comparisons
    $this->wheres[] = ['column' => $column, 'operator' => '=', 'value' => (string) $value];
 
    return $this;
}
 
public function whereNot($column, $value)
{
    if ($value instanceof Arrayable || is_array($value)) {
        return $this->whereNotIn($column, $value);
    }
 
    $value = enum_value($value);
 
    // Explicitly store '!=' instead of prepending '!'
    $this->wheres[] = ['column' => $column, 'operator' => '!=', 'value' => (string) $value];
 
    return $this;
}
 
public function whereNull($column)
{
    $this->wheres[] = ['column' => $column, 'operator' => 'NULL', 'value' => null];
 
    return $this;
}
 
public function whereNotNull($column)
{
    $this->wheres[] = ['column' => $column, 'operator' => 'NOT_NULL', 'value' => null];
 
    return $this;
}

Second, a new queryConditions() method was introduced on DatabaseRule. When preparing conditions for the presence verifier, queryConditions() inspects every condition with an '=' operator. If the target value matches 'NULL', 'NOT_NULL', or starts with '!', it wraps the condition in a query closure (fn ($query) => $query->where($column, '=', $value)). Because DatabasePresenceVerifier executes closures directly against the underlying query builder rather than running them through addWhere(), the value is bound strictly as a literal equality parameter:

// File: src/Illuminate/Validation/Rules/DatabaseRule.php
 
public function queryConditions()
{
    $conditions = [];
 
    foreach ($this->wheres as ['column' => $column, 'operator' => $operator, 'value' => $value]) {
        // Wrap ambiguous literal values in an explicit '=' query closure
        if ($operator === '=' && ($value === 'NULL' || $value === 'NOT_NULL' || str_starts_with($value, '!'))) {
            $conditions[] = fn ($query) => $query->where($column, '=', $value);
        } else {
            $conditions[$column] = $this->formatWhereValue($operator, $value);
        }
    }
 
    return array_merge($conditions, $this->using);
}
 
protected function formatWhereValue($operator, $value)
{
    return match ($operator) {
        '=' => $value,
        '!=' => '!'.$value,
        default => $operator,
    };
}

Third, ValidationRuleParser::prepareRule() and ValidatesAttributes (getExistCount() and validateUnique()) were updated to retain Exists and Unique object instances whenever queryConditions() is non-empty, passing queryConditions() directly to the presence verifier without serializing the rule to a string:

// File: src/Illuminate/Validation/Concerns/ValidatesAttributes.php
 
protected function getExistCount($connection, $table, $column, $value, $parameters)
{
    $verifier = $this->getPresenceVerifier($connection);
 
    // Directly retrieve structured queryConditions() if currentRule is an Exists instance
    $extra = $this->currentRule instanceof Exists
        ? $this->currentRule->queryConditions()
        : $this->getExtraConditions(array_values(array_slice($parameters, 2)));
 
    return is_array($value)
        ? $verifier->getMultiCount($table, $column, $value, $extra)
        : $verifier->getCount($table, $column, $value, null, null, $extra);
}

> [!NOTE] > Fix Completeness Assessment: The patch completely prevents operator confusion and delimiter breakouts when using fluent Rule::exists() and Rule::unique() objects during validation. However, if a developer explicitly casts a DatabaseRule object to a string ((string) $rule) and passes that string into the validator, or manually concatenates user input into a raw 'exists:...' string rule, the legacy string parser remains active for backward compatibility and will still interpret 'NULL', 'NOT_NULL', and '!' as operators.

Exploitation

Exploiting CVE-2026-142637 requires an application endpoint that passes a user-controllable value (such as a request body parameter, query parameter, header, or mutable route parameter) into the second argument of Rule::exists()->where($column, $userInput) or Rule::unique()->where($column, $userInput), and relies on that validation check to enforce data scoping or authorization.

Consider a multi-tenant invoicing controller where a user submits a project_id and a tenant_id (or category/organization key) in an HTTP POST request, and the application validates that the specified project_id belongs to the given tenant_id solely through Rule::exists():

public function storeInvoice(Request $request)
{
    $tenantId = $request->input('tenant_id');
 
    $validated = $request->validate([
        'project_id' => [
            'required',
            Rule::exists('projects', 'id')->where('tenant_id', $tenantId),
        ],
    ]);
 
    Invoice::create([
        'project_id' => $validated['project_id'],
        'amount' => $request->input('amount'),
    ]);
}

Under normal operation, a user in Tenant 101 sends {"project_id": 9999, "tenant_id": "101"}. If project 9999 belongs to Tenant 202, the presence verifier executes:

SELECT COUNT(*) AS aggregate FROM `projects` WHERE `id` = 9999 AND `tenant_id` = '101'

The query returns 0, validation fails, and the invoice creation is rejected. To bypass this check, the attacker modifies the HTTP payload to supply one of three exploit primitives:

  1. NOT_NULL Token Injection: The attacker submits {"project_id": 9999, "tenant_id": "NOT_NULL"}. The rule serializes to exists:projects,id,tenant_id,"NOT_NULL", and the presence verifier executes:

    SELECT COUNT(*) AS aggregate FROM `projects` WHERE `id` = 9999 AND `tenant_id` IS NOT NULL

    Because project 9999 has a non-null tenant_id (202), the count returns 1 and validation passes.

  2. Negation (!) Prefix Injection: The attacker submits {"project_id": 9999, "tenant_id": "!101"}. The presence verifier strips the leading ! and generates an inequality predicate:

    SELECT COUNT(*) AS aggregate FROM `projects` WHERE `id` = 9999 AND `tenant_id` != '101'

    Because 202 != 101, the count returns 1 and validation passes.

  3. CSV Quote/Backslash Escape Breakout: As demonstrated in Laravel's regression test suite (tests/Validation/ValidationExistsRuleTest.php), an attacker can supply a payload containing an escaped quote and comma delimiters, such as x\",id,NOT_NULL,type,"!. When formatWheres() wraps the string in quotes and str_getcsv() reparses it during parseParameters(), the backslash escapes the doubled quote and splits the string into additional key-value pairs, allowing the attacker to append arbitrary column predicates to the presence verifier query.

For Rule::unique(), the impact is inverted: supplying NOT_NULL or !value widens the uniqueness check across all records where the scoped column is non-null or not equal to the input. An attacker can abuse this to cause validation failures (denying record creation if a value exists in another tenant's scope) or probe whether specific attribute values exist within other tenants' datasets (a cross-tenant data existence oracle).

Impact Assessment

CVE-2026-142637 is assigned a CVSS v3.1 base score of 4.8 (Medium) with the vector CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N. The Attack Complexity is rated High (AC:H) because exploitation depends on specific application implementation details: the application must pass untrusted input into a fluent where() validation scope and must lack secondary authorization checks (such as Laravel Policies, Gates, or scoped Eloquent queries) when subsequently retrieving or mutating the record.

When those conditions are met, the vulnerability results in an authorization bypass or Broken Object Level Authorization (BOLA / IDOR) affecting both confidentiality and integrity:

  • Integrity Impact (I:L): Attackers can associate records, foreign keys, or child resources with parent entities belonging to other users or tenants by bypassing Rule::exists() ownership verification.
  • Confidentiality Impact (C:L): Attackers can use Rule::exists() or Rule::unique() validation error responses as a boolean oracle to enumerate whether specific record IDs, emails, or identifiers exist in other tenants' scopes.
  • Availability Impact (A:N): While widening a Rule::unique() check can block legitimate submissions when collisions exist across tenants, it does not cause systemic service disruption.

According to threat intelligence telemetry, the vulnerability currently has an EPSS score of 0.00327 (27.88th percentile), is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog, and has a CISA SSVC assessment of Exploitation: none, Automatable: no, and Technical Impact: partial.

Remediation & Mitigation

The primary remediation is to upgrade laravel/framework to a patched release that decouples fluent DatabaseRule conditions from string serialization:

  • Laravel 12.x: Upgrade to version 12.73.0 or later.
  • Laravel 13.x: Upgrade to version 13.43.0 or later.

Administrators and developers can apply the update via Composer:

composer update laravel/framework --with-dependencies

For applications that cannot be upgraded immediately, developers can apply two code-level mitigations:

  1. Convert Scalar where() Calls to Closure-Based where() Scopes: In all versions of Laravel, passing a Closure to Rule::exists()->where(...) or Rule::unique()->where(...) stores the callback in $this->using (queryCallbacks()), which prevents ValidationRuleParser::prepareRule() from casting the rule to a string and binds parameters directly on the query builder:

    // Vulnerable in < 12.73.0 and < 13.43.0
    Rule::exists('projects', 'id')->where('tenant_id', $request->input('tenant_id'))
     
    // Mitigated via Closure scope
    Rule::exists('projects', 'id')->where(function ($query) use ($request) {
        $query->where('tenant_id', '=', $request->input('tenant_id'));
    })
  2. Enforce Independent Authorization and Trusted Context Scoping: Do not derive security scopes (such as tenant_id or user_id) from untrusted request parameters without first verifying that the authenticated principal is authorized for that scope. Always retrieve scope identifiers from trusted session/authentication state ($request->user()->tenant_id) and enforce explicit authorization via Laravel Policies or scoped Eloquent queries (Tenant::findOrFail(...)->projects()->findOrFail(...)).

> [!WARNING] > Even after upgrading to 12.73.0 or 13.43.0, never construct raw string validation rules by concatenating user input (e.g., 'exists:projects,id,tenant_id,' . $request->input('tenant_id')). Raw string rules must preserve backward compatibility with the 'NULL', 'NOT_NULL', and '!' syntax tokens and remain vulnerable to predicate manipulation if populated with untrusted input.

Official Patches

LaravelGitHub Security Advisory GHSA-ch34-gjmh-c4hp
LaravelLaravel Framework v12.73.0 Release
LaravelLaravel Framework v13.43.0 Release
LaravelPull Request #62426 (13.x Fix)
LaravelPull Request #62425 (12.x Fix)

Fix Analysis (2)

Technical Appendix

CVSS Score
4.8/ 10
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N
EPSS Probability
0.33%
Top 72% most exploited

Affected Systems

laravel/framework (12.x series < 12.73.0)laravel/framework (13.x series >= 13.0.0, < 13.43.0)

Affected Versions Detail

Product
Affected Versions
Fixed Version
laravel/framework
Laravel
< 12.73.012.73.0
laravel/framework
Laravel
>= 13.0.0, < 13.43.013.43.0
AttributeDetail
CVE / GHSA IDCVE-2026-142637 / GHSA-ch34-gjmh-c4hp
Weakness ClassCWE-943: Improper Neutralization of Special Elements in Data Query Logic
CVSS v3.1 Score4.8 Medium (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N)
EPSS Score0.33% (27.88th Percentile)
Affected ComponentIlluminate\Validation\Rules\DatabaseRule (Rule::exists & Rule::unique)
Patched Versionslaravel/framework 12.73.0 and 13.43.0
Exploit StatusProof-of-Concept (Unit test payloads published; no active exploitation)
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1078Valid Accounts
Defense Evasion
CWE-943
Improper Neutralization of Special Elements in Data Query Logic

The application constructs all or part of a data query logic using externally influenced input from an upstream component, but does not neutralize or incorrectly neutralizes special elements that could modify the intended logic of the query when it is executed.

Known Exploits & Detection

GitHub (Laravel Framework Test Suite)Official regression tests in tests/Validation/ValidationExistsRuleTest.php and ValidationUniqueRuleTest.php demonstrating 'NOT_NULL', '!bar', and backslash quote breakout payloads.

Vulnerability Timeline

Patches committed to Laravel 13.x (029e3a4ceb0c8b7e8394639b161e7d4ef906af54) and 12.x (ef1821b33245d58631784ac2093aed0c5bb91242)
2026-11-11
CVE-2026-142637 reserved and published via GitHub Security Advisory GHSA-ch34-gjmh-c4hp
2026-12-02
CVE-2026-142637 ingested by NIST NVD
2026-12-02
CISA ADP Vulnrichment assessment completed and NVD record updated
2026-12-03

References & Sources

  • [1]GitHub Security Advisory: GHSA-ch34-gjmh-c4hp
  • [2]NVD - CVE-2026-142637
  • [3]CVE.org Record: CVE-2026-142637
  • [4]Laravel Framework PR #62426 (13.x Patch)
  • [5]Laravel Framework PR #62425 (12.x Patch)
  • [6]Fix Commit 029e3a4ceb0c8b7e8394639b161e7d4ef906af54 (13.x)
  • [7]Fix Commit ef1821b33245d58631784ac2093aed0c5bb91242 (12.x)
  • [8]Laravel v12.73.0 Release Tag
  • [9]Laravel v13.43.0 Release Tag
  • [10]CVEListV5 JSON Record for CVE-2026-142637
  • [11]Wiz Vulnerability Database - CVE-2026-142637

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 1 hour ago•CVE-2026-142622
3.1

CVE-2026-142622: Cross-Origin Authorization Token Leakage via JSONP Callback in Laravel Broadcasting

CVE-2026-142622 (GHSA-ww2c-pqp9-rvrq) is an origin validation error (CWE-346) in the Laravel Framework (`laravel/framework`) prior to version 12.53.0. The Pusher and Reverb broadcasting drivers previously accepted a `callback` query parameter on the `/broadcasting/auth` endpoint, returning the channel authentication token wrapped in a JSONP response. Because this endpoint also accepted HTTP GET requests without CSRF validation, an external page could include the authorization endpoint via an HTML `<script>` tag to bypass Same-Origin Policy protections and exfiltrate the authenticated user's private or presence channel tokens.

Amit Schendel
Amit Schendel
6 views•10 min read
•about 2 hours ago•CVE-2026-142593
5.3

CVE-2026-142593: Path Traversal via Symlink Resolution Discrepancy in Rack::Directory

CVE-2026-142593 is a path traversal and improper symbolic link resolution vulnerability in the Rack::Directory middleware of the Rack Ruby web server interface. A discrepancy between lexical path validation in Ruby user space and physical path resolution by the operating system kernel allows unauthenticated remote attackers to bypass document root restrictions when a symlinked directory exists inside the served root. Attackers can enumerate file names, directory structures, file sizes, and modification timestamps outside the intended document root.

Alon Barad
Alon Barad
6 views•11 min read
•about 3 hours ago•GHSA-XJ2X-F8QW-37MR
5.3

GHSA-xj2x-f8qw-37mr: Denial of Service via Multi-Byte UTF-8 Slicing Panic in Rust bcrypt Crate

A denial-of-service vulnerability exists in versions 0.19.0 and 0.19.1 of the Rust bcrypt crate (tracked as GHSA-xj2x-f8qw-37mr and RUSTSEC-2026-0199). When parsing a 60-byte hash string containing multi-byte UTF-8 sequences positioned across internal slice offsets, the split_hash function performs direct string slicing across non-character boundaries. This violation of Rust's UTF-8 string invariants triggers an unhandled thread panic (str::slice_error_fail), enabling attackers who can supply or modify hash strings to crash authentication worker threads or terminate processes configured to abort on panic.

Alon Barad
Alon Barad
7 views•10 min read
•about 4 hours ago•CVE-2026-142591
5.3

CVE-2026-142591: Denial of Service via Regex Memory Amplification in Rack QueryParser

CVE-2026-142591 (GHSA-f7cc-57h7-qrcg) is an uncontrolled resource consumption vulnerability in the Rack Ruby web server interface library. The flaw resides in Rack::QueryParser, which uses quantified regular expressions to split query strings, parse application/x-www-form-urlencoded request bodies, and evaluate nested parameter names. In Ruby's Onigmo regular expression engine, greedy quantifiers allocate approximately 48 bytes of native backtracking state per matched character. An unauthenticated remote attacker can transmit crafted payloads containing long runs of spaces or bracket characters within Rack's default 4 MiB byte-size limit to trigger an approximate 48x transient memory amplification, allocating up to 200 MB per request and exhausting process or container memory under concurrent load.

Alon Barad
Alon Barad
7 views•10 min read
•about 5 hours ago•CVE-2026-142592
7.5

CVE-2026-142592: Denial of Service via Multipart Charset Encoding Resolution in Rack

CVE-2026-142592 is an uncontrolled resource consumption vulnerability (CWE-400) in Rack, the modular Ruby web server interface. In affected versions within the 3.1.x and 3.2.x branches, the multipart form-data parser directly passes untrusted charset parameters to Ruby's internal Encoding.find method without pre-validation or caching. Because Ruby's MRI runtime traverses the entire $LOAD_PATH searching for shared libraries whenever an unknown encoding is requested, an unauthenticated attacker can submit a multipart payload with thousands of invalid charset parameters to trigger millions of filesystem lookup operations, exhausting CPU and I/O resources and causing denial of service.

Alon Barad
Alon Barad
7 views•13 min read
•about 6 hours ago•CVE-2026-142596
7.5

CVE-2026-142596: Projection Sanitization Bypass and Schema-Level Exclusion Disclosure in Mongoose

A projection sanitization and schema path exclusion bypass vulnerability exists in Mongoose versions 8.5.0 through 8.24.9 and 9.0.0 through 9.12.1. Due to insufficient validation of MongoDB projection syntax in `sanitizeProjection` and `applyPaths`, attackers supplying untrusted projection inputs to queries can force the retrieval of sensitive schema fields configured with `select: false`, such as password hashes, reset tokens, and multi-factor authentication secrets.

Amit Schendel
Amit Schendel
8 views•10 min read