Laravel: Validation exists rule can be bypassed with integer or boolean input on MySQL/MariaDB
Package Affected versions Patched versions Description Impact The exists and unique validation rules passed integer and boolean values from the request unchanged to the database query.
On MySQL and Ma
Package
laravel/framework (Composer)Affected versions
>= 13.0.0, < 13.43.0 < 12.73.0Patched versions
13.43.0 12.73.0Description
Impact
The exists and unique validation rules passed integer and boolean values from the request unchanged to the database query. On MySQL and MariaDB, comparing a string column with an integer casts the column to a number. As a result, JSON input such as 0, false or [0] could satisfy a rule like required|exists:invites,code on a non-numeric string column without a valid value. An unauthenticated attacker who can submit JSON could bypass "must reference an existing record" checks. PostgreSQL and SQLite are not affected. Form-encoded input is always a string and is not affected.
Patches
DatabasePresenceVerifier now compares integers and booleans as strings. The fixes are merged on the 13.x branch (laravel/framework#62447) and the 12.x branch (laravel/framework#62448).
Workarounds
Add the string rule (or integer, as appropriate) before exists and unique rules, or cast the input in prepareForValidation().
References
- GHSA-wwq3-m3j5-wv66
- https://nvd.nist.gov/vuln/detail/CVE-2026-142643
- laravel/framework#62447
- laravel/framework#62448
- laravel/framework@2b517db
- laravel/framework@a26c329
- https://github.com/laravel/framework/releases/tag/v12.73.0
- https://github.com/laravel/framework/releases/tag/v13.43.0
Severity
Moderate CVSS overall score This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS). / 10CVSS v3 base metrics
Attack vector Network Attack complexity Low Privileges required None User interaction None Scope Unchanged Confidentiality Low Integrity None Availability None CVSS v3 base metrics Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability. Attack complexity: More severe for the least complex attacks. Privileges required: More severe if no privileges are required. User interaction: More severe when no user interaction is required. Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope. Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user. Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user. Availability: More severe when the loss of impacted component availability is highest. CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:NEPSS score
Weaknesses
Weakness CWE-843Access of Resource Using Incompatible Type
The product 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. Learn more on MITRE. Weakness CWE-1287Improper Validation of Specified Type of Input
The product receives input that is expected to be of a certain type, but it does not validate or incorrectly validates that the input is actually of the expected type. Learn more on MITRE.CVE ID
CVE-2026-142643GHSA ID
GHSA-wwq3-m3j5-wv66Source code
laravel/frameworkCredits
-
localhost8080 Reporter
Uh oh!
There was an error while loading. Please reload this page.
See something to contribute? Suggest improvements for this vulnerability.