CVE-2026-142643: CVE-2026-142643: Validation Exists Rule Bypass via Type Confusion in Laravel Framework
CVE-2026-142643: Validation Exists Rule Bypass via Type Confusion in Laravel Framework Vulnerability ID: CVE-2026-142643 CVSS Score: 5.3 Published: 2026-12-03 CVE-2026-142643 is a type confusion vulnerability in the
CVE-2026-142643: Validation Exists Rule Bypass via Type Confusion in Laravel Framework
Vulnerability ID: CVE-2026-142643
CVSS Score: 5.3
Published: 2026-12-03
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.
TL;DR
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.
โ ๏ธ Exploit Status: POC
Technical Details
- 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
Affected Systems
- Laravel Framework (laravel/framework) 12.x prior to 12.73.0 using MySQL or MariaDB
- Laravel Framework (laravel/framework) 13.x prior to 13.43.0 using MySQL or MariaDB
-
laravel/framework: >= 12.0.0, < 12.73.0 (Fixed in:
12.73.0) -
laravel/framework: >= 13.0.0, < 13.43.0 (Fixed in:
13.43.0)
Code Analysis
Commit: 2b517db
Cast integer and boolean values to strings in DatabasePresenceVerifier (13.x - PR #62447)
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,
+ };
+ }
Commit: a26c329
Backport DatabasePresenceVerifier integer and boolean string casting to 12.x (PR #62448)
Mitigation Strategies
- Upgrade laravel/framework to the patched versions (12.73.0 or 13.43.0) where DatabasePresenceVerifier casts integers and booleans to strings prior to query binding.
- Enforce explicit scalar type validation rules (such as 'string') alongside 'exists' and 'unique' validation rules across all form requests and controller validations.
- Cast request attributes explicitly to strings (e.g., $request->string('invite_code')->toString()) before passing them into downstream Eloquent or Query Builder where() clauses.
- Deploy WAF inspection rules to block JSON requests supplying unquoted numeric 0 or boolean false values for string token fields.
Remediation Steps:
- Audit composer.lock to determine if laravel/framework is on version 12.x (< 12.73.0) or 13.x (< 13.43.0).
- Run 'composer update laravel/framework' to upgrade to 12.73.0+ or 13.43.0+.
- Search the application codebase for 'exists:' and 'Rule::exists' definitions and ensure the 'string' rule is prepended for all string-typed database columns.
- Run automated test suites to verify that JSON endpoints reject non-string scalar inputs with HTTP 422 Unprocessable Entity.
References
- GitHub Security Advisory GHSA-wwq3-m3j5-wv66
- NVD - CVE-2026-142643
- CVE Record: CVE-2026-142643
- Fix Commit 2b517db47fca33b9bf48a15287af63702ace3f99 (13.x)
- Fix Commit a26c3295498fc4de4b878d634fe2a9ae264d9a29 (12.x)
- Laravel Pull Request #62447
- Laravel Pull Request #62448
- Laravel v12.73.0 Release Tag
- Laravel v13.43.0 Release Tag
- CVEListV5 JSON Record for CVE-2026-142643
- Wiz Vulnerability Database: CVE-2026-142643
- Shodan CVEDB: CVE-2026-142643
Read the full report for CVE-2026-142643 on our website for more details including interactive diagrams and full exploit analysis.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes โ full credit and traffic to the original publisher.