Dec 3, 2026·11 min read·5 visits
Laravel versions prior to 12.73.0 and 13.43.0 pass uncast integers and booleans from JSON payloads directly to database queries during 'exists' and 'unique' validation checks. On MySQL and MariaDB, comparing a string column to integer 0 or boolean false causes non-numeric strings to coerce to 0, allowing attackers to bypass validation checks on invite codes, tokens, and slugs.
CVE-2026-142643 is a type confusion vulnerability in the Laravel Framework validation subsystem (Illuminate\Validation\DatabasePresenceVerifier) affecting versions prior to 12.73.0 and 13.43.0. When processing JSON-encoded HTTP requests, the framework preserves native integer and boolean scalar types and passes them unchanged into SQL parameter bindings for 'exists' and 'unique' validation rules. On MySQL and MariaDB databases, comparing a string column against an integer value triggers implicit numeric type coercion, causing any non-numeric string entry to evaluate to zero. Consequently, an unauthenticated remote attacker can submit an integer zero or boolean false in a JSON payload to bypass record-existence validation rules without knowing a valid string identifier.
The Laravel Framework provides a declarative input validation subsystem used across PHP web applications and APIs to enforce data integrity before executing controller logic. Among its built-in constraints, the exists and unique rules verify whether a submitted input value is present in or absent from a specified database table and column. These rules are backed by the Illuminate\Validation\DatabasePresenceVerifier component, which constructs and executes SQL COUNT(*) queries through Laravel's query builder and PDO connection layer.
In CVE-2026-142643 (also tracked as GHSA-wwq3-m3j5-wv66), a type confusion flaw classified under CWE-843 (Access of Resource Using Incompatible Type) and CWE-1287 (Improper Validation of Specified Type of Input) exists within DatabasePresenceVerifier. When an application processes requests with an application/json content type, PHP's json_decode() function preserves primitive data types, including integers (0) and booleans (false). Unlike standard URL-encoded form requests (application/x-www-form-urlencoded), where all parameters arrive in PHP's $_POST superglobal as strings, JSON request attributes retain their raw scalar types throughout the validation lifecycle.
Prior to Laravel 12.73.0 and 13.43.0, DatabasePresenceVerifier passed these native integer and boolean values directly to the query builder without casting or normalizing them to strings. When the underlying database engine is MySQL or MariaDB, binding an integer 0 or boolean false into a WHERE clause comparing against a string-typed column (VARCHAR, CHAR, or TEXT) triggers implicit SQL type coercion. MySQL converts the column's string values into numbers during comparison, evaluating any string that begins with non-numeric characters to 0.
As a result, an unauthenticated attacker interacting with a JSON-accepting endpoint can supply 0, false, or [0] for fields validated by exists:table,column and satisfy the validation rule without possessing a valid identifier. This allows attackers to bypass validation guards protecting invitation codes, coupon tokens, password reset identifiers, or tenant slugs, provided the validation rule chain does not explicitly enforce a string type constraint prior to the database lookup.
The root cause of CVE-2026-142643 stems from the interaction between two distinct mechanisms: how PHP deserializes JSON primitives into native scalar types during HTTP request parsing, and how MySQL and MariaDB handle equality comparisons between mismatched data types.
When a client sends an HTTP POST request with Content-Type: application/x-www-form-urlencoded containing invite_code=0, PHP populates the request input array with the string literal "0". When Laravel constructs the presence verification query, PDO binds the parameter as a string (PDO::PARAM_STR), executing SELECT COUNT(*) FROM invites WHERE code = '0'. Because both operands are strings, MySQL performs a standard lexical comparison, which evaluates to false against non-zero string tokens.
Conversely, when a client sends an HTTP request with Content-Type: application/json and the body {"invite_code": 0} or {"invite_code": false}, PHP's JSON parser produces a native integer (int) 0 or boolean (bool) false. When passed into DatabasePresenceVerifier::getCount() or DatabasePresenceVerifier::getMultiCount(), the query builder receives the raw scalar type and passes it to PDO. PDO binds integer values as numeric literals and boolean false as integer 0 in the resulting SQL statement:
SELECT count(*) AS aggregate FROM `invites` WHERE `code` = 0;According to the MySQL and MariaDB type conversion rules, comparing a string column with a numeric operand forces the database engine to convert every string value in the column to a floating-point number before performing a numeric comparison. When MySQL converts a string to a number, it parses leading digits until it encounters a non-numeric character. If the string begins with any non-numeric character (such as 'BETA_INVITE', 'admin-slug', or 'token_xyz'), the numeric conversion yields 0.
Consequently, the expression 'BETA_INVITE' = 0 is evaluated by MySQL as 0 = 0, which returns 1 (true). The COUNT(*) query returns the total number of rows in the target table whose target column begins with a non-numeric character. Because DatabasePresenceVerifier considers the exists rule satisfied whenever the returned count is greater than zero, the validation check passes whenever at least one non-numeric record exists in the database table.
The vulnerable logic resides in src/Illuminate/Validation/DatabasePresenceVerifier.php. This class implements PresenceVerifierInterface and provides two primary methods for checking database records: getCount() for single-value rules (exists and unique) and getMultiCount() for array-based rules where an input array is checked against a column using a WHERE IN clause.
Prior to the patch, both getCount() and getMultiCount() passed the $value and $values arguments directly to the query builder's where() and whereIn() methods without inspecting or normalizing their types:
// Vulnerable code in src/Illuminate/Validation/DatabasePresenceVerifier.php
public function getCount($collection, $column, $value, $excludeId = null, $idColumn = null, array $extra = [])
{
// $value is passed directly; (int) 0 or (bool) false remain uncast
$query = $this->table($collection)->where($column, '=', $value);
if (! is_null($excludeId) && $excludeId !== 'NULL') {
$query->where($idColumn ?: 'id', '<>', $excludeId);
}
return $this->addConditions($query, $extra)->count();
}
public function getMultiCount($collection, $column, array $values, array $extra = [])
{
// Array elements in $values retain raw integer or boolean types
$query = $this->table($collection)->whereIn($column, $values);
return $this->addConditions($query, $extra)->distinct()->count($column);
}In commits 2b517db47fca33b9bf48a15287af63702ace3f99 (Laravel 13.x, PR #62447) and a26c3295498fc4de4b878d634fe2a9ae264d9a29 (Laravel 12.x, PR #62448), the maintainers introduced a helper method named prepareValue() to normalize integer and boolean inputs into strings before binding them to the query:
diff --git a/src/Illuminate/Validation/DatabasePresenceVerifier.php b/src/Illuminate/Validation/DatabasePresenceVerifier.php
index e5a3c10..4a8b79d 100644
--- a/src/Illuminate/Validation/DatabasePresenceVerifier.php
+++ b/src/Illuminate/Validation/DatabasePresenceVerifier.php
@@ -44,7 +44,7 @@ public function __construct(ConnectionResolverInterface $db)
*/
public function getCount($collection, $column, $value, $excludeId = null, $idColumn = null, array $extra = [])
{
- $query = $this->table($collection)->where($column, '=', $value);
+ $query = $this->table($collection)->where($column, '=', $this->prepareValue($value));
if (! is_null($excludeId) && $excludeId !== 'NULL') {
$query->where($idColumn ?: 'id', '<>', $excludeId);
@@ -64,11 +64,26 @@ public function getCount($collection, $column, $value, $excludeId = null, $idCol
*/
public function getMultiCount($collection, $column, array $values, array $extra = [])
{
- $query = $this->table($collection)->whereIn($column, $values);
+ $query = $this->table($collection)->whereIn($column, array_map($this->prepareValue(...), $values));
return $this->addConditions($query, $extra)->distinct()->count($column);
}
+ /**
+ * Prepare a value for comparison with a database column.
+ *
+ * @param mixed $value
+ * @return mixed
+ */
+ protected function prepareValue($value)
+ {
+ return match (true) {
+ is_bool($value) => (string) (int) $value,
+ is_int($value) => (string) $value,
+ default => $value,
+ };
+ }The prepareValue() method uses a match (true) expression to evaluate the type of the input parameter. If $value is a boolean (is_bool($value)), it is first cast to an integer (false becomes 0, true becomes 1) and then cast to a string ('0' or '1'). If $value is an integer (is_int($value)), it is cast directly to its string representation ((string) $value). For getMultiCount(), array_map($this->prepareValue(...), $values) applies this normalization across all elements in the array.
> [!NOTE]
> Fix Completeness Assessment: While prepareValue() handles is_bool() and is_int(), it does not explicitly check is_float(). In PHP, json_decode('{"code": 0.0}') or json_decode('{"code": 0e0}') produces a native floating-point number (float) 0.0. Because is_int(0.0) and is_bool(0.0) both evaluate to false, a float value falls through to the default => $value branch. If a float 0.0 is passed to PDO and bound without string quoting or cast as a float parameter in MySQL, numeric coercion against string columns can still occur unless the application explicitly validates the field with the string validation rule.
Exploiting CVE-2026-142643 requires no authentication or specialized privileges if the target validation rule is exposed on a public endpoint (such as user registration, password recovery, or promotional code redemption). The prerequisites for successful exploitation are:
12.73.0 or Laravel 13.x prior to 13.43.0.exists (or Rule::exists()) against a string column without prepending the string type constraint (e.g., 'invite_code' => 'required|exists:invites,code').Consider a Laravel controller protecting an invite-only registration workflow:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class RegistrationController extends Controller
{
public function register(Request $request)
{
$validated = $request->validate([
'email' => ['required', 'email', 'unique:users,email'],
'invite_code' => ['required', 'exists:invites,code'],
]);
// Business logic proceeds assuming invite_code exists in database
return response()->json(['status' => 'registered'], 201);
}
}Even if the endpoint is intended to receive standard HTML form submissions, Laravel's Request handling automatically parses JSON payloads whenever the client sets the Content-Type: application/json header. An attacker can send the following HTTP request using integer 0, boolean false, or an array [0]:
POST /api/register HTTP/1.1
Host: vulnerable-laravel.example.com
Content-Type: application/json
Accept: application/json
{
"email": "attacker@example.com",
"invite_code": 0
}When DatabasePresenceVerifier::getCount('invites', 'code', 0) executes, MySQL runs SELECT count(*) AS aggregate FROM invites WHERE code = 0. If the invites table holds a single record with code = 'VIP_ACCESS_2026', MySQL coerces 'VIP_ACCESS_2026' to 0, matches the record, and returns a count of 1. The validation passes, allowing the attacker to reach the post-validation controller logic.
If the downstream controller logic only relies on $request->validate() as a gatekeeper without subsequently fetching the exact record via a strict match, or if the subsequent Eloquent query (Invite::where('code', $request->input('invite_code'))->first()) runs the same uncast integer query against MySQL, the database will return the first non-numeric Invite model from the table to the attacker's session.
CVE-2026-142643 carries a CVSS v3.1 base score of 5.3 (Medium) with the vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N. The attack vector is Network (AV:N) with Low attack complexity (AC:L), requiring no privileges (PR:N) and no user interaction (UI:N). The EPSS score is 0.0044 (40.03rd percentile), indicating a low current probability of mass automated exploitation in the wild, as exploitation depends on application-specific validation rule definitions and business logic.
The primary security impact is the bypass of access control or workflow restrictions enforced via exists validation rules. When developers omit the string validation rule under the assumption that exists:table,column will only match exact values present in the database, attackers can bypass gates protecting registration invites, multi-tenant workspace lookups (exists:tenants,slug), discount vouchers, or API verification tokens.
Furthermore, if the application reuses the validated input value ($request->invite_code) in a subsequent Eloquent query such as Model::where('code', $request->invite_code)->first(), the same MySQL type coercion occurs during model retrieval. In that scenario, the application retrieves and processes the first record in the table whose column value starts with a non-numeric character, leading to unauthorized association with another tenant or consumption of another user's invite token.
For the unique validation rule (unique:users,username), the same type coercion produces the inverse behavior: submitting 0 or false causes the uniqueness check to fail if any existing record in the column begins with a non-numeric character. An attacker can leverage this behavior as an unauthenticated boolean oracle to infer whether a target database table contains any records with non-numeric identifiers.
Applications backed by PostgreSQL or SQLite are not affected by this vulnerability. PostgreSQL enforces strict type checking and rejects comparisons between CHARACTER VARYING and INTEGER with a database exception (ERROR: operator does not exist: character varying = integer), while SQLite's type affinity rules do not coerce non-numeric strings to integer 0 during equality comparisons.
To remediate CVE-2026-142643 at the framework level, upgrade laravel/framework to version 12.73.0 or 13.43.0 (or later). These releases ensure that integer and boolean values are converted to strings inside DatabasePresenceVerifier before executing presence verification queries:
composer update laravel/frameworkIn addition to upgrading the framework, developers should apply defense-in-depth at the application layer by always pairing exists and unique rules with explicit data type validation rules (string or integer). When the string rule is included in the validation chain, Laravel's Validator::validateString() method checks is_string($value) and rejects integer, boolean, float, and array inputs before DatabasePresenceVerifier is ever invoked:
// Vulnerable validation rule definition (missing type constraint)
$request->validate([
'invite_code' => ['required', 'exists:invites,code'],
]);
// Hardened validation rule definition (enforces string type before DB query)
$request->validate([
'invite_code' => ['required', 'string', 'exists:invites,code'],
]);Enforcing the string rule also protects the application against two related risks that DatabasePresenceVerifier::prepareValue() does not cover: floating-point JSON inputs (such as 0.0) passing into the exists query, and downstream Eloquent queries (Model::where('code', $request->invite_code)->first()) executing with non-string scalar types after validation succeeds.
For environments where immediate patching or code deployment is delayed, Web Application Firewall (WAF) rules can be configured to inspect incoming application/json request bodies on sensitive endpoints and reject requests where string-identifier fields (such as code, token, invite, or slug) are supplied as literal unquoted integers (0), booleans (false), or numeric arrays ([0]).
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
laravel/framework Laravel | >= 12.0.0, < 12.73.0 | 12.73.0 |
laravel/framework Laravel | >= 13.0.0, < 13.43.0 | 13.43.0 |
| Attribute | Detail |
|---|---|
| CVE ID | CVE-2026-142643 (GHSA-wwq3-m3j5-wv66) |
| Weakness Class | CWE-843 (Type Confusion) / CWE-1287 (Improper Type Validation) |
| CVSS v3.1 Score | 5.3 Medium (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N) |
| EPSS Score | 0.44% (40.03rd Percentile) |
| Affected Component | Illuminate\Validation\DatabasePresenceVerifier |
| Database Dependency | MySQL / MariaDB (Implicit String-to-Integer Coercion) |
| Patched Versions | Laravel 12.73.0, Laravel 13.43.0 |
| CISA KEV Status | Not Listed |
The software allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type.
A validation logic bypass vulnerability exists in the Laravel Framework validation subsystem prior to versions 12.72.0 and 13.43.0. When validating nested attributes or wildcard arrays using the 'sometimes' rule, the framework uses the literal string '__missing__' as an in-band sentinel value to detect absent keys. An attacker who submits the literal string '__missing__' as the value for a nested attribute causes the validator to misinterpret the field as omitted, bypassing all subsequent validation rules while still returning the unvalidated string in the validated dataset.
CVE-2026-142649 (also tracked as GHSA-h2hg-mfj4-rg7q) is an input validation bypass vulnerability affecting the validation subsystem of the Laravel web application framework (laravel/framework). Specifically, the validateIn method in src/Illuminate/Validation/Concerns/ValidatesAttributes.php performs non-strict comparisons when evaluating scalar input values against defined allowlists for the 'in', 'Rule::in', and 'not_in' validation rules. Because PHP's native in_array() function defaults to loose equality (==) when the third parameter ($strict) is omitted, numeric strings with non-canonical representations—such as leading or trailing whitespace, embedded newlines, leading zeros, positive signs, decimal points, or scientific notation—evaluate as equal to standard numeric allowlist entries. Furthermore, because Laravel's validated() and valid() accessor methods return the original, un-canonicalized input string rather than the matched allowlist token, unvalidated characters and unexpected string formats propagate directly into downstream business logic, database queries, and state enforcement checks.
An authenticated SQL injection vulnerability exists in Agenta prior to version 0.122.5 within the tracing database query layer. The full-text content filter handler in api/oss/src/dbs/postgres/tracing/utils.py interpolates user-supplied search strings directly into a SQLAlchemy text() construct without parameter binding or escaping. This flaw allows an authenticated user with read access to spans in a single project to execute arbitrary SQL conditions against the tracing database, bypassing project and tenant isolation boundaries to exfiltrate trace data across the entire platform.
The Samsung/CredSweeper GitHub Action between versions 1.11.6 and 1.16.x contains an argument injection vulnerability (CWE-88) in its composite action definition. The action accepts unvalidated strings for the 'error' and 'hashed' input parameters and passes them directly as command-line arguments to the CredSweeper CLI. An attacker capable of controlling these action inputs can inject the '--log_config' flag pointing to an attacker-controlled YAML file. Because CredSweeper loads this configuration using Python's logging.config.dictConfig, which supports instantiating arbitrary callables via the '()' factory key, this flaw leads to arbitrary command execution within the GitHub Actions runner environment.
CVE-2026-92542 (GHSA-6m9p-4h64-m6vh) is an authentication bypass by spoofing and confused deputy vulnerability in the overlay network driver (libnetwork) of Docker Engine and Moby. The firewall rules responsible for marking outgoing VXLAN datagrams for IPsec encryption fail to distinguish between authentic VXLAN packets generated by the Linux kernel and forged UDP packets sent by local userspace processes. Consequently, an unprivileged user or process executing in the host network namespace of a Linux Docker Swarm node can transmit crafted VXLAN datagrams that the kernel automatically encrypts and routes to peer nodes, enabling blind injection of arbitrary Ethernet frames into encrypted overlay networks.
A critical authentication bypass vulnerability exists in Pion DTLS (versions 2.1.0 through 3.1.13 and 4.0.0-rc.1 through 4.0.0-rc.5) within the DTLS 1.2 server handshake state machine. When a server is configured with a SessionStore and negotiates a certificate-based cipher suite, it prematurely persists the session ID and derived master secret immediately after processing the ClientKeyExchange message. Because this cache write occurs before validating the client's Certificate, CertificateVerify, and Finished messages, an unauthenticated remote attacker can abandon an incomplete initial handshake and immediately perform an abbreviated session resumption handshake using the derived master secret, bypassing mandatory client certificate authentication (RequireAnyClientCert, RequireAndVerifyClientCert) and custom VerifyConnection callbacks.