Exploit database

GH-8189fd22a4a3e34c0da2c893bc4a76c9

dungsocool/cve-2026-114938

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 files8
dungsocool/cve-2026-114938Revision 108226875d3d

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

detect.sh

Shell · 5,230 bytes
#!/bin/bash

# ================================================================
# Java4Shell (CVE-2026-114938) Detection Script
# ================================================================
# Checks if the current system is potentially vulnerable
# Run on the target server (not in Docker)

echo "╔══════════════════════════════════════════════════════╗"
echo "║  Java4Shell (CVE-2026-114938) Vulnerability Checker  ║"
echo "╚══════════════════════════════════════════════════════╝"
echo ""

VULN=0
SAFE=0

# ---- Check 1: Java version ----
echo "=== Check 1: Java Version ==="
if command -v java &> /dev/null; then
    JAVA_VER=$(java -version 2>&1 | head -1)
    echo "[*] $JAVA_VER"

    # Extract major version
    MAJOR=$(java -version 2>&1 | head -1 | sed -E 's/.*"([0-9]+)\..*/\1/')

    if [ "$MAJOR" = "17" ] || [ "$MAJOR" = "21" ] || [ "$MAJOR" = "25" ] || [ "$MAJOR" = "27" ]; then
        echo "[!] Java $MAJOR detected — POTENTIALLY VULNERABLE"
        VULN=$((VULN+1))
    elif [ "$MAJOR" = "8" ] || [ "$MAJOR" = "11" ]; then
        echo "[+] Java $MAJOR — NOT AFFECTED (no Base64 intrinsic)"
        SAFE=$((SAFE+1))
    else
        echo "[?] Java $MAJOR — unknown, check vendor advisory"
    fi
else
    echo "[+] Java not found on PATH — N/A"
    SAFE=$((SAFE+1))
fi
echo ""

# ---- Check 2: CPU AVX-512 VBMI ----
echo "=== Check 2: CPU AVX-512 VBMI Support ==="
if [ -f /proc/cpuinfo ]; then
    if grep -q "avx512vbmi" /proc/cpuinfo; then
        CPU_MODEL=$(grep "model name" /proc/cpuinfo | head -1 | cut -d: -f2 | xargs)
        echo "[!] AVX-512 VBMI SUPPORTED — $CPU_MODEL"
        echo "[!] This CPU can trigger the vulnerability"
        VULN=$((VULN+1))
    else
        echo "[+] AVX-512 VBMI NOT found — bug cannot be triggered on this CPU"
        SAFE=$((SAFE+1))
    fi
elif [ "$(uname)" = "Darwin" ]; then
    echo "[*] macOS detected — checking sysctl"
    if sysctl -a 2>/dev/null | grep -q "avx512vbmi"; then
        echo "[!] AVX-512 VBMI SUPPORTED"
        VULN=$((VULN+1))
    else
        echo "[+] AVX-512 VBMI NOT found"
        SAFE=$((SAFE+1))
    fi
else
    echo "[?] Cannot determine CPU features on this OS"
fi
echo ""

# ---- Check 3: Base64 intrinsic enabled ----
echo "=== Check 3: Base64 Intrinsic Status ==="
if command -v java &> /dev/null; then
    B64_FLAG=$(java -XX:+PrintFlagsFinal -version 2>&1 | grep -i "UseBASE64Intrinsics" || echo "")
    if echo "$B64_FLAG" | grep -q "true"; then
        echo "[!] Base64 intrinsic is ENABLED (default)"
        echo "[!] AVX-512 path will be used if CPU supports it"
        VULN=$((VULN+1))
    elif echo "$B64_FLAG" | grep -q "false"; then
        echo "[+] Base64 intrinsic is DISABLED — safe"
        SAFE=$((SAFE+1))
    else
        echo "[?] Cannot determine intrinsic status (flag may not exist on this JVM)"
    fi
else
    echo "[*] Java not found — skipping"
fi
echo ""

# ---- Check 4: Running Java processes ----
echo "=== Check 4: Running Java Processes ==="
JAVA_PROCS=$(ps aux 2>/dev/null | grep "[j]ava" | grep -v grep || echo "")
if [ -n "$JAVA_PROCS" ]; then
    echo "[*] Found running Java processes:"
    echo "$JAVA_PROCS" | while read -r line; do
        PID=$(echo "$line" | awk '{print $2}')
        CMD=$(echo "$line" | awk '{for(i=11;i<=NF;i++) printf "%s ", $i; print ""}')
        echo "    PID $PID: $CMD"
    done

    # Check if any have intrinsic disabled
    if echo "$JAVA_PROCS" | grep -q "UseBASE64Intrinsics"; then
        echo "[+] Some processes have Base64 intrinsic flag set"
    fi
else
    echo "[*] No running Java processes found"
fi
echo ""

# ---- Check 5: Listening ports with Java ----
echo "=== Check 5: Java Services Listening ==="
if command -v ss &> /dev/null; then
    ss -tlnp 2>/dev/null | grep java || echo "[*] No Java services listening"
elif command -v netstat &> /dev/null; then
    netstat -tlnp 2>/dev/null | grep java || echo "[*] No Java services listening"
else
    echo "[*] Cannot check (no ss or netstat)"
fi
echo ""

# ---- Summary ----
echo "════════════════════════════════════════"
echo "  SUMMARY"
echo "════════════════════════════════════════"
if [ $VULN -ge 3 ]; then
    echo "  [!!!] HIGH RISK — All conditions met"
    echo "  Action: Patch immediately or add -XX:-UseBASE64Intrinsics"
elif [ $VULN -ge 2 ]; then
    echo "  [!!] MEDIUM RISK — Some conditions met"
    echo "  Action: Check vendor advisory, plan patching"
elif [ $VULN -ge 1 ]; then
    echo "  [!] LOW RISK — Few conditions met"
    echo "  Action: Monitor vendor advisories"
else
    echo "  [+] NOT VULNERABLE — None of the conditions met"
fi
echo ""
echo "  Vulnerable indicators:  $VULN"
echo "  Safe indicators:        $SAFE"
echo "════════════════════════════════════════"