Laravel: `in` / `Rule::in` validation rule bypass via loose comparison
Package Affected versions Patched versions Description Summary The in validation rule (and Rule::in, and not_in via the same code) compares the scalar input to the allowlist with a non-strict in_array
Package
laravel/framework (Composer)Affected versions
< 12.67.0 >= 13.0.0, < 13.26.0Patched versions
12.67.0 13.26.0Description
Summary
The in validation rule (and Rule::in, and not_in via the same code) compares
the scalar input to the allowlist with a non-strict in_array(). PHP 8 then
compares numeric strings numerically, so many values that are not literally in
the list pass validation — including whitespace-padded, leading-zero,
signed, and scientific-notation forms, and an embedded newline. The value
returned by validated() / valid() is the raw, un-canonicalized input, so
the attacker-controlled bytes flow through to the application even though the
rule was supposed to constrain them to a fixed set.
The array branch of the same method already compares as strings
(array_diff), so this is an internal inconsistency, not intended behavior.
Impact
Any allowlist of numeric values — feature flags (in:0,1), status codes,
role/tenant/enum IDs stored as integers may be bypassed with an
equivalent-but-not-identical representation.
Patched
Fixed in #61146
Reported by
— Sergey Sannikov, GitHub @semx
References
- GHSA-h2hg-mfj4-rg7q
- https://nvd.nist.gov/vuln/detail/CVE-2026-142649
- laravel/framework#61146
- laravel/framework@0db83d4
- https://github.com/laravel/framework/releases/tag/v12.67.0
- https://github.com/laravel/framework/releases/tag/v13.26.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 None Integrity Low 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:N/I:L/A:NEPSS score
Weaknesses
Weakness CWE-697Incorrect Comparison
The product compares two entities in a security-relevant context, but the comparison is incorrect. Learn more on MITRE.CVE ID
CVE-2026-142649GHSA ID
GHSA-h2hg-mfj4-rg7qSource code
laravel/frameworkCredits
-
semx Reporter
Uh oh!
There was an error while loading. Please reload this page.
See something to contribute? Suggest improvements for this vulnerability.