No items found.
No items found.
Research
-
mins read
-
November 20, 2026

"It Only Writes Fixed Bytes and Immediately Throws an Exception, Right?" — Weaponizing OpenJDK's AVX-512 Base64 Intrinsic for Pre-Auth Jenkins RCE (CVE-2026- 114938 / Java4Shell)

Olivier Beg
-
Co-founder and Chief Hacking Officer
- -
"It Only Writes Fixed Bytes and Immediately Throws an Exception, Right?" — Weaponizing OpenJDK's AVX-512 Base64 Intrinsic for Pre-Auth Jenkins RCE (CVE-2026- 114938 / Java4Shell)

If you have spent any time in enterprise security over the last decade, you have probably developed a Pavlovian flinch whenever someone puts the words “Java” and “4Shell” in the same sentence. Usually, it means somebody found another fifteen-layer lookup chain inside a logging library maintained by two exhausted volunteers in Nebraska, and now every appliance in your DMZ is mining Monero.

CVE-2026-114938 (“Java4Shell”) is not that.

It is much worse — and, from an engineering perspective, much funnier.

Why? Because the bug is not in a third-party library. It is not in Spring, or Log4j, or Jackson. It is inside OpenJDK itself — specifically inside the high-speed AVX-512 assembly routine that Java’s Just-In-Time (JIT) compiler uses to accelerate java.util.Base64.getDecoder().decode().

When California Security Research (Calif) disclosed the vulnerability, the initial reaction from much of the security industry went like this:

"Sure, if you feed Base64.getDecoder().decode() a malformed string over 128 bytes ending in '=', a length counter underflows from 0 to -1 and writes 64 bytes past the end of the output buffer. BUT:

  1. You don’t even control the bytes written out-of-bounds! The CPU always writes the exact same repeating 3-byte pattern (0x69, 0xa6, 0x9a)!
  2. Two microseconds after the assembly routine finishes, Java notices the bad '=' padding, throws an IllegalArgumentException, and discards the buffer!
  3. Any Java object you overwrite gets its internal class pointer clobbered with garbage (0x9aa6699a), so the next time the Garbage Collector runs, the whole JVM immediately crashes with a segmentation fault (SIGSEGV)!

Nice Denial-of-Service bug. Wake us up when someone turns it into Remote Code Execution."

Today, we are walking through how we turned that “uncontrolled 64-byte fixed-value write followed by an immediate exception” into a 100% pure-network, unauthenticated, zero-crash Remote Code Execution (RCE) exploit against a locked-down, default Jenkins 2.479.1 server on OpenJDK 17 — in ~25 seconds over HTTP, with zero credentials, zero native shellcode, and full survival across Garbage Collection.

This post explains how the exploit works in plain engineering terms, followed by a complete breakdown of the real-world caveats (CPU requirements, concurrent user traffic, -Xmx heap size flags, WAN/VPN latency, and why the server doesn’t crash).

Part 1: The Hardware Bug — How One '=' Sign Breaks Java’s Base64 Decoder

On modern x86-64 CPUs with AVX-512 VBMI instructions (AMD Zen 4/5 EPYC & Ryzen, Intel Ice Lake / Sapphire Rapids and newer), OpenJDK doesn’t decode long Base64 strings one character at a time in Java. Once a method calls Base64.getDecoder().decode() enough times, HotSpot’s C2 JIT compiler swaps in a hand-written assembly routine (StubRoutines::_base64_decodeBlock) that decodes 64 characters at a time in a single CPU vector register (%zmm).

Here is what happens when you pass a Base64 string of length 129 bytes (or any 64 × K + 1 bytes, like 71,745 bytes) where the final trailing character is '=':

  1. The Bulk Loop: The assembly routine processes the first 64 × K bytes in 64-byte chunks (48 output bytes per 64 input bytes), advancing its output pointer to 8 bytes before the end of the allocated byte[] destination array (dst).
  2. The Tail Calculation: Now 1 trailing byte ('=') remains. The routine calculates how many decoded output bytes a 1-byte tail should produce:
    output_size=⌊1/4⌋×3=0 bytesoutput_size=⌊1/4⌋×3=0 bytes
  3. The Underflow: Next, it checks if the last character is '=' (padding). Since '=' means “one fewer output byte,” the assembly executes a single decrement instruction (dec %r13) on output_size without checking if output_size is already zero:
    0−1=0xffffffffffffffff(−1 in 64-bit unsigned math!)0−1=0xffffffffffffffff(−1 in 64-bit unsigned math!)
  4. Why the Overflow Writes Fixed 0x69, 0xa6, 0x9a Bytes:
    • The routine also strips the '=' character from its input read mask (1 >> 1 = 0).
    • To avoid crashing on unreadable memory past the end of the input buffer, the routine pre-fills its 64-byte AVX-512 register (%zmm0) with 64 copies of the letter 'a' (0x61), and uses the input mask to overwrite only the active bytes.
    • Because the input mask is now 0, the CPU reads zero bytes from our input and decodes 64 copies of 'a'. In Base64, 'aaaa' decodes to the 3-byte sequence 0x69, 0xa6, 0x9a.
    • Finally, the routine uses output_size (-1, which has all 64 mask bits set to 1) as its write mask, and blasts 64 bytes of 0x69, 0xa6, 0x9a... into memory.
    • The first 8 bytes land inside dst's 8-byte alignment padding. The remaining 56 bytes smash straight into the header of whatever object sits right after dst in the Java heap!

Part 2: Why 0x69, 0xa6, 0x9a Is the Luckiest Constant in History

In 64-bit OpenJDK (with heaps under 32 GB), every byte[] array in memory starts with a 16-byte header:

  • Bytes 0..7 (markWord): Locking and garbage-collection metadata (8 bytes).
  • Bytes 8..11 (narrowKlass): A 32-bit compressed pointer identifying the object’s class (0x6838 for byte[].class).
  • Bytes 12..15 (length): A 32-bit signed integer storing the array’s length (4 bytes).
  • Bytes 16+: The actual bytes of the array.

When our 64-byte overflow spills out of dst and overwrites the header of the next byte[] array in memory, look at what lands on that array’s header:

Because 69 a6 9a repeats every 3 bytes, any 4-byte integer inside the overflow takes one of three values depending on its alignment:

  • a6 9a 69 a6 = -1,503,028,570 (negative — useless as an array length)
  • 9a 69 a6 9a = -1,700,369,510 (negative — useless as an array length)
  • 69 a6 9a 69 = 0x699aa669 = +1,771,742,825 (+1.77 GB — a valid, positive Java array length!)

When dst ends 16 bytes before the victim array, the 4 bytes that land on the victim array’s .length field (+0x0c) are 69 a6 9a 69 = 0x699aa669 (+1.77 GB)!

Suddenly, a normal 128 KB byte[] buffer that Jenkins is actively writing into thinks it is 1.77 gigabytes long — allowing it to read and write out-of-bounds across the entire Java heap!

The Catch: The 0x9aa6699a Class-Pointer Time Bomb

There is one huge problem. While the victim array’s .length (+0x0c) becomes +1.77 GB, its narrowKlass class pointer (+0x08) gets overwritten with 0x9aa6699a.

  • Why doesn’t writing into the byte[] crash immediately? Because when Java writes a byte into a primitive byte[] array, the CPU only checks index < array.length and writes to array + 16 + index. It never checks the class pointer (narrowKlass)!
  • Why WILL it crash a moment later? If the Garbage Collector (GC) runs while any thread still holds a reference to that corrupted array, the GC inspects the 0x9aa6699a class pointer, tries to read unmapped memory, and instantly crashes the entire JVM (SIGSEGV).

To build a weaponized, zero-crash RCE exploit, we have to use that corrupted array to bootstrap a clean primitive and erase the corrupted reference from the thread stack before the Garbage Collector can ever see it.

Part 3: How the 4-Stage Exploit Chain Works

To turn this into unauthenticated RCE on a default Jenkins 2.479.1 server (where anonymous users have zero permissions and every page redirects to /login), the exploit runs four stages over standard HTTP connections:

1. JIT WarmupTrigger C2 AVX-512 compilationwithout hitting deopt traps

2. TLAB EscapeFill per-thread buffers so arraysland in shared G1 Eden memory

3. Cross-Region Heap LayoutPlace victim buffers at start of Region R+1and overflow buffer at end of Region R

4. 3-Socket Relay & Admin FlipForge clean headers -> close corrupted socketLeak 4.19MB via /login -> flip Admin ACL

Stage 1: Warming Up the JIT Compiler (Without Tripping Traps)

On a freshly started Jenkins server, Base64.getDecoder().decode() runs in Java’s slow interpreter, which doesn’t have the AVX-512 bug.

  • We send 24 quick batches of HTTP requests with Authorization: Basic ... headers. Jenkins decodes those headers before checking who you are, forcing HotSpot’s C2 compiler to compile the vulnerable AVX-512 assembly stub.
  • Why naive warmup fails: If C2 only sees 100% valid Base64 strings during warmup, it assumes the “bad padding exception” branch is dead code and places a deoptimization trap (unstable_if) right after the AVX-512 stub. The moment the exploit triggers the overflow, Java hits that trap, throws away the compiled AVX-512 code, and reverts to the safe interpreter!
  • How we beat it: We mix 2% malformed padding requests into the warmup so C2 compiles the exception path normally, and send two surgical inputs halfway through warmup so C2 compiles decode0 as a standalone Tier-4 method that never deoptimizes.

Stage 2: Turning HTTP Sockets into Remote-Controlled Allocation Buttons (TLAB Escape)

First, how do we hold 22 buffers in memory at the same time over HTTP and trigger allocations on command?

  • The “Remote-Controlled Button” Trick (Content-Length Parking):
    When you send PUT /login with Content-Length: 16000000 (16 MB) and stream a form parameter z= followed by 65,536 'A's, Jetty’s form parser (UrlEncoded.decodeTo) fills its internal 64 KB (65,536-byte) ByteArrayOutputStream2 buffer to 100% capacity and pauses inside InputStream.read() waiting for the remaining bytes of the 16 MB body.
    The moment we send 1 single byte (tag) on that paused socket, Jetty reads byte 65,537, sees its 64 KB buffer is full, immediately doubles the buffer by allocating a fresh 128 KB (byte[131072]) array on the Java heap, and pauses again! That gives us 22 paused sockets where sending 1 byte on any socket allocates a 128 KB array at the exact millisecond we choose.
  • Escaping Private Thread Buffers (TLABs):
    By default, each Jetty worker thread allocates objects inside its own private Thread-Local Allocation Buffer (TLAB) (~100–200 KB). If our Base64 overflow happens inside Thread A’s private TLAB, it just overwrites empty space in Thread A’s own buffer instead of hitting Thread B’s victim buffer.
    When a thread tries to allocate an array larger than the free space left in its TLAB — as long as the remaining free space in its TLAB is between 4 KB and 128 KB — HotSpot leaves the thread’s TLAB untouched and allocates the large array directly in shared G1 Eden memory!
    Before pausing at byte 65,536, each of our 22 sockets streams a ~400 KB warmup body that parks its worker thread with ~50 KB of free TLAB space — large enough that tiny internal Jetty objects stay inside the thread’s private TLAB, and small enough that the 128 KB buffer is forced out into shared G1 memory.

Stage 3: Cross-Region Heap Feng Shui (Region R →→ Region R+1)

OpenJDK’s G1 Garbage Collector divides the heap into 1 MB regions (Region R, Region R+1, etc.).
Here is a quirk of G1 that shapes the entire exploit:

  • Inside a single 1 MB region, memory is allocated bottom-up (from offset +0x00000 toward +0xfffff).
  • Across regions, however, G1 allocates new 1 MB regions top-down in virtual memory: Region R+1 (e.g. 0xd7000000) is allocated first, and when it fills up, the next region Region R (0xd6f00000) is opened directly below it!

Because our Base64 request (dec_sock) allocates its destination buffer (dst) and overflows past the end of dst two microseconds later, the victim buffers must already be sitting in memory at a higher address than dst.
So we allocate in reverse region order:

  1. First (Region R+1): We release our three victim sockets (corrupted_writer, reader_sock, and relay_writer), placing their three 128 KB buffers right at the start of Region R+1 (+0x00000, +0x20010, and +0x40020), followed by 4 more 128 KB buffers to fill Region R+1.
  2. Second (Region R): G1 opens Region R directly below Region R+1. We pack Region R with 4 writer buffers, a 52 KB padding string (pad_sock), and our dec_sock request (PUT /whoAmI/api/xml?wrapper=1AAA...=).

Why does /whoAmI/api/xml?wrapper=... decode Base64 without credentials?
In Jenkins, /whoAmI/api/xml is accessible to anonymous users and accepts @QueryParameter String wrapper (normally used to name the root XML element). However, Jenkins’s Stapler web framework registers a global type converter (hudson.util.Secret) that checks whether any query parameter looks like an encrypted Jenkins secret: if a parameter matches the Base64 regex \{?[A-Za-z0-9+/]+={0,2}}?, Jenkins automatically passes it straight to Base64.getDecoder().decode() before /whoAmI ever sees it!

  1. The byte sizes in Region R add up to exact byte offset 0xffff0 (16 bytes before the boundary between Region R and Region R+1), so dec_sock's 56-byte overflow crosses the boundary from the end of Region R straight into corrupted_writer at Region R+1 + 0x00000!

Stage 4: The 3-Socket Relay Dance (Zero-Crash Heap Leak →→ Admin ACL Flip)

Now corrupted_writer (at +0x00000) has .length = 1.77 GB, its neighbor reader_sock sits at +0x20010, and relay_writer sits at +0x40020.
Watch how those three sockets work together so the JVM never crashes:

  1. Double Header Forge + Immediate Early EOF Unwind:
    Using corrupted_writer's out-of-bounds write, we overwrite the 16-byte array headers of both reader_sock (+0x20010) and relay_writer (+0x40020) with a 100% valid, GC-safe byte[] header (narrowKlass = 0x6838, length = 4.19 MB).
    Then we immediately close corrupted_writer's TCP socket!
    Closing the socket mid-request causes Jetty to throw an Early EOF exception, which unwinds corrupted_writer's stack frame and permanently removes the corrupted +0x00000 (narrowKlass = 0x9aa6699a) pointer from the thread stack. From that millisecond onward, every live object on every stack has a valid class pointer — even a full Garbage Collection passes cleanly!
  2. Leaking 4.19 MB of Live Server Memory (reader_sock):
    reader_sock is a PUT /login?from=RRR... request. When we send its final byte, Jenkins renders the login HTML page (< input name="from" value="..." >), dutifully reflecting from's enlarged 4.19 MB buffer back to us in the HTTP response!
    Inside that 4.19 MB of live heap memory, the exploit locates two structures:
    • Jenkins’s in-memory permission table (SparseACL.AUTHENTICATED_READ.entries): Three adjacent 32-byte SparseACL$Entry objects ([markWord=1, narrowKlass, sid=2, allowed=1, permission_oop]) where Entry[1] (at entries_oop + 0x40) holds the anonymous rule (allowed = false at entries_oop + 0x5c).
    • A parked socket’s ByteArrayOutputStream2 wrapper object (target_writer): Parked earlier with a unique count = 150 + attempt signature:

ByteArrayOutputStream2 OffsetFieldOriginal ValuePatched Value (via relay_writer)+0x00 .. +0x07markWord0x00000000000000010x0000000000000001 (unchanged)+0x08 .. +0x0bnarrowKlass0x015dd...0x015dd... (unchanged)+0x0c .. +0x0fint count (write cursor)150 + attempt0 (write at index 0)+0x10 .. +0x13byte[] buf (compressed OOP)0xdd933...entries_oop + 0x4c (16B before Entry[1].allowed)

  1. Flipping Anonymous to Admin (relay_writer →→ target_writer):
    Using relay_writer (whose buffer is now 4.19 MB long with a valid header), we stream the leaked heap bytes up to target_writer's ByteArrayOutputStream2 and overwrite count = 0 and buf = entries_oop + 0x4c.
    Why entries_oop + 0x4c instead of entries_oop + 0x5c? Because when Java writes to buf[0], it automatically adds 16 bytes to skip the byte[] header (buf + 16 + 0 = entries_oop + 0x4c + 0x10 = entries_oop + 0x5c)!
    We send a single URL-encoded byte %01 (0x01 = true) on target_writer. Jetty decodes %01 and writes 0x01 straight into Entry[1].allowed, granting Overall/Administer to anonymous, and our exploit runs arbitrary commands via /scriptText!

Part 4: Caveats, Real-World Conditions & FAQ

Whenever we share this exploit, six practical questions come up immediately. Here is the ground truth on every one of them.

1. Does the target server need a specific CPU?

Yes — the server must run on an x86-64 CPU with AVX-512 VBMI (avx512vbmi).

  • The vulnerable assembly routine (StubGenerator::generate_base64_decodeBlock) is only generated by OpenJDK when the CPU supports AVX-512 VBMI (specifically the vpermb instruction used to permute 64 Base64 bytes).
  • Which CPUs have AVX-512 VBMI?
    • AMD: Zen 4 and Zen 5 (EPYC 9004 “Genoa”, EPYC 8004 “Siena”, EPYC 4004, EPYC 9005 “Turin”, and Ryzen 7000 / 8000 / 9000 series).
    • Intel: Ice Lake, Tiger Lake, Rocket Lake, Xeon 3rd Gen (Ice Lake-SP), Xeon 4th Gen (Sapphire Rapids), Xeon 5th Gen (Emerald Rapids), and Xeon 6 (Granite Rapids).
    • Cloud Instances: AWS c6i, m6i, r6i, c7i, m7i, r7i, c7a, m7a, r7a; GCP c3, c3d, c4, n2d (Zen 4); Azure Dv5/Ev5 (Ice Lake), Fav6/Dav6; Hetzner / Scaleway / OVH dedicated & cloud EPYC Genoa/Turin instances.
  • What happens on older Intel/AMD (AVX2-only) or ARM64 (Graviton / Apple Silicon) CPUs?
    Nothing. OpenJDK uses a different Base64 implementation on AVX2 and ARM64 that does not contain the L_padding underflow bug.

2. What happens when other people are sending requests to the server at the same time?

Normal background traffic barely touches the exploit, because of private TLAB isolation — with a narrow ~400 ms window where heavy traffic can cause an attempt to miss.

Here is why:

  • Why 95%+ of concurrent HTTP requests have zero effect on our heap layout:
    As we saw in Stage 2, every Jetty worker thread allocates inside its own private Thread-Local Allocation Buffer (TLAB) (~100–250 KB). Normal user requests (loading pages, fetching /api/json, polling build status, webhook pings) only allocate small objects (a few hundred bytes to a few kilobytes). Those allocations happen entirely inside that worker thread’s existing private TLAB and allocate zero bytes inside the shared G1 regions (Region R+1 and Region R) we are grooming!
  • Why traffic during the 1–2 second upload phase (Stage A) doesn’t matter:
    While our 22 sockets are uploading their 8.6 MB of TLAB-draining prefixes, other users can allocate as much as they want. Right after the upload finishes, align_sock sends two 512 KB arrays that retire whatever partial G1 region was open and re-align the heap cursor to a fresh 0.5 MB boundary.
  • What happens during the critical ~400 ms release window (Stages B–E)?:

Concurrent Traffic During the ~400 ms WindowTouches Shared G1 Region?What Happens to the Exploit?Crash RiskNormal web/API requests fitting in the worker thread’s existing TLABNo (0 bytes in shared Eden)Nothing — byte alignment stays exact (0xffff0) and the attempt succeedsZeroAnother worker thread refills a TLAB in the leftover tail of Region R+1Only _retained_alloc_regionShifts dec_sock by +104 KB; reader_sock returns a normal 131 KB login page instead of 4.19 MB, and poc.py automatically retries the next attemptLow (overflow usually lands inside our own filler arrays or empty TLAB space)Another worker refills a TLAB or allocates >100 KB inside Region RYesShifts dec_sock off +0xfffe8 for that attempt; align_sock re-aligns to a fresh 1 MB region on the next attemptModerate — if dec_sock gets pushed right before an unrelated live object from another user’s request, overwriting its class pointer (0x9aa6699a) can crash the JVM when that object is used or GC’dGarbage Collection runs before dec_sock firesEvacuates EdenAll buffers in Stages A–D have valid headers (0x6838), so GC succeeds cleanly and poc.py retries the next attemptZero

  • Can an attacker block concurrent traffic during that 400 ms window?
    Yes. Default Jenkins caps Jetty’s thread pool (QueuedThreadPool) at 200 worker threads. Holding ~175 extra idle connections with partial HTTP bodies for 400 ms temporarily occupies the remaining worker threads so incoming requests wait in the OS kernel’s TCP queue until corrupted_writer.close() finishes.

3. Doesn’t -Xmx (max heap size) change from server to server and break the region math?

Much less than you’d think — because G1 rounds region sizes down to discrete powers of 2 (1 MB, 2 MB, 4 MB, 8 MB).

Admin configurations vary wildly (-Xmx768m, -Xmx1g, -Xmx1500m, -Xmx2g, -Xmx4g, etc.), so you might assume every server has a different heap slab size.
In HotSpot’s G1 source code (heapRegion.cpp), G1 does not scale region size continuously. It takes the average of initial heap (-Xms) and max heap (-Xmx), divides by 2048, and rounds down to the nearest power of 2:

G1HeapRegionSize=2⌊log⁡2(InitialHeapSize+MaxHeapSize2×2048)⌋∈{1 MB,2 MB,4 MB,8 MB,16 MB,32 MB}G1HeapRegionSize=2⌊log2​(2×2048InitialHeapSize+MaxHeapSize​)⌋∈{1 MB,2 MB,4 MB,8 MB,16 MB,32 MB}

Look at how that collapses real-world server configs into just 3–4 buckets:

Server JVM Flags (-Xms / -Xmx)Average HeapG1HeapRegionSizeWorks Unmodified with Default 1 MB Profile?-Xmx512m, -Xmx1g, -Xmx1536m, -Xmx2g, -Xmx3g, -Xms1g -Xmx2g, -Xms2g -Xmx2g< 4 GB1 MB (0x100000)Yes — 100% identical byte math (0xffff0)-Xmx4g or -Xmx6g without -Xms set (default -Xms is RAM / 64, so average heap is still < 4 GB)< 4 GB1 MB (0x100000)Yes — still uses 1 MB regions!-Xms4g -Xmx4g, -Xms4g -Xmx6g4 GB – 7.99 GB2 MB (0x200000)Uses 2 MB parameter profile-Xms8g -Xmx8g, -Xms8g -Xmx12g8 GB – 15.99 GB4 MB (0x400000)Uses 4 MB parameter profile

And adapting from 1 MB to 2 MB or 4 MB regions doesn’t even require opening more sockets: adding (M−1) MB(M−1) MB of 512 KB UTF-16 filler parameters to align_sock and pad_sock consumes the first (M−1) MB(M−1) MB of a 2 MB or 4 MB region, leaving the exact same 1 MB (0x100000) geometry at the end of the region.

4. Why can’t we place the attacker and victim buffers in the same region so region size doesn’t matter at all?

Because of the direction G1 allocates memory:

  • When dec_sock sends its Base64 payload, Java allocates the destination array dst and immediately overflows past the end of dst (dst + size(dst)).
  • That means the victim buffer (corrupted_writer) must already exist in memory at dst + size(dst) before dst is created.
  • Inside a single G1 region, G1’s bump pointer only moves upward (from low addresses to high addresses). Every object created before dst in the same region sits at a lower address than dst — never after dst!
  • Across regions, G1 allocates new regions top-down (Region R+1 at a higher address first, then Region R directly below it). So the only place in the G1 heap where a newly allocated dst can sit immediately below an already-allocated victim buffer is right at the boundary between Region R and Region R+1.

5. What happens if the server’s region size is different than expected (e.g. 2 MB instead of 1 MB)? Does the exploit fail, and does the server crash?

First: the 1 MB exploit completely fails to get RCE on a 2 MB region server — because Stage 3’s 0xffff0 (1.0 MB) byte sum lands halfway through a 2.0 MB (0x200000) region instead of at the region boundary!

We tested this directly by starting Jenkins with -Xms4g -Xmx4g (G1HeapRegionSize = 2 MB) and running all 15 attempts of the 1 MB poc.py against it:

2MB-region Jenkins ready (pid=139579) after 3s
[*] Warming up C2 Base64.decode0 + decodeBlock across 8 connections (24 batches)...
[+] C2 warmup complete.
=== ATTEMPT 1 (candidate c_idx=0) ===
[*] DECODER response: b'HTTP/1.1 500 Server Error'
[+] De-chunked HTTP body from reader_sock: 132676 bytes!   # <-- 131KB original string (NO leak!)
...
=== ATTEMPT 15 (candidate c_idx=3) ===
[*] DECODER response: b'HTTP/1.1 500 Server Error'
[+] De-chunked HTTP body from reader_sock: 132676 bytes!   # <-- 0/15 attempts hit RCE
After poc.py against -Xms4g -Xmx4g, is JPID still alive?
ALIVE (HTTP 200)

Look at both halves of what happened in that test:

  1. Why all 15 attempts failed to get RCE:
    Stage 3 is tuned to sum to 0xffff0 (1,048,560 bytes = 1 MB - 16 bytes). On a 1 MB (0x100000) region server, that leaves only 16 bytes between dst and the end of the region (_end), so the 56-byte overflow crosses _end into corrupted_writer at Region R+1 + 0x00000.
    On a 2 MB (0x200000) region server, 0xffff0 is right in the middle of the region — leaving 1,048,592 bytes (1.0 MB) of unallocated free space between dst_end (_top) and the end of the 2 MB region (_end). corrupted_writer is never touched, and reader_sock just returns its normal 132,676-byte login page.
  2. Why 1 MiB →→ 2 MiB is safe, whereas 2 MiB →→ 1 MiB IS destructive (The Modular Arithmetic Rule):
    • Assuming 1 MiB against a 2 MiB host (Safe):
      In a bump-pointer allocator, 0xffff0 (1 MiB - 16B) is only halfway through a 2 MiB (0x200000) region:
      0xffff0(mod0x200000)=0xffff0≠0x1ffff00xffff0(mod0x200000)=0xffff0=0x1ffff0
      Because dst_end (_top) sits in the middle of the 2 MiB region with 1.0 MiB of unallocated free space before _end, the 56 overflow bytes land in unallocated [_top, _top + 56) memory that GC never scans (GC only scans [_bottom, _top)) and that the next allocation at _top zeroes out.
    • Assuming 2 MiB against a 1 MiB host (DESTRUCTIVE!):
      Because 2 MiB (0x200000) is an exact multiple of 1 MiB (0x100000), packing 2 MiB - 16 bytes (0x1ffff0) wraps around modulo 1 MiB:
      0x1ffff0≡0xffff0(mod0x100000)!!0x1ffff0≡0xffff0(mod0x100000)!!
      On a 1 MiB host, a 2 MiB payload fills two consecutive 1 MiB regions and still lands at +0xffff0 (16 bytes before the end of a 1 MiB region)! It overflows across that 1 MiB boundary and overwrites narrowKlass = 0x9aa6699a onto whatever object sits at +0x00000 of the intermediate 1 MiB region (instead of corrupted_writer two regions up). Because the exploit doesn’t know that intermediate object was corrupted and doesn’t unwind it via Early EOF before reader_sock runs, a Young GC while that reference is live crashes the JVM (SIGSEGV)!
    • Operational Rule: Always probe region sizes from smallest to largest (1 MiB →→ 2 MiB →→ 4 MiB), never largest to smallest!

6. Does network latency (running over the Internet or a VPN) break the timing?

It used to — until we replaced sleep() with Kernel TCP Send-Buffer ACK Barriers (SO_NWRITE / SIOCOUTQ).

During heap grooming, 22 sockets upload 8.6 MB of prefix data and pause mid-request (so Jenkins sends no HTTP response until the final bytes are sent).

  • On localhost, socket.sendall() transfers 8.6 MB in 0.2 milliseconds, so a simple time.sleep(0.02) works.
  • Over the internet or a VPN, socket.sendall() returns instantly as soon as the 8.6 MB is copied into your laptop’s OS kernel send buffer (SO_SNDBUF), while the actual packets are still trickling out over the network for the next 1–2 seconds! If the exploit fires the next stage after 20 ms, all the prefix allocations arrive at Jenkins scrambled.
  • How poc.py solves this: Instead of sleeping and guessing, poc.py asks the local OS kernel how many unacknowledged bytes remain in each socket’s TCP send queue (getsockopt(SO_NWRITE) on macOS; ioctl(SIOCOUTQ) on Linux). Because the local kernel only removes bytes from the send queue after the remote Jenkins server’s TCP stack has received and ACKed them, waiting for get_unacked(sock) == 0 guarantees that 100% of every stage has landed in Jenkins before the next stage begins — whether your ping is 0.1 ms or 150 ms.

7. Are other Java applications (besides Jenkins) exploitable for RCE?

The underlying vulnerability (CVE-2026-114938) is in OpenJDK’s java.util.Base64.getDecoder(), so any Java application running an unpatched OpenJDK 17 / 21+ build on an AVX-512 VBMI CPU is vulnerable if it passes untrusted input ≥129≥129 bytes to standard Base64.getDecoder().decode() (note: Base64.getMimeDecoder() is not affected because the AVX-512 stub exits early when isMIME == true).

  • Crash / DoS: Almost any endpoint that decodes a controllable ≥129≥129-byte Base64 token (SAML artifacts, Basic/Bearer auth headers, custom cookies, encrypted tokens) can be crashed remotely.
  • Full RCE: Turning the corruption into zero-crash RCE requires a way to hold primitive arrays (byte[], char[], or int[]) in G1 Eden across concurrent HTTP connections (such as streaming form bodies, multipart uploads, chunked request bodies, or session buffers) so the +1.77 GB length overwrite can be used to forge clean headers and unwind the corrupted reference before GC runs.

8. What happens if Garbage Collection runs while reader_sock is rendering the 4.19 MB /login response?

Earlier we noted that once corrupted_writer is closed (Early EOF) and reader_sock finishes rendering /login, Garbage Collection is 100% safe because no thread stack holds a reference to +0x00000, +0x20010, or +0x40020.

However, during the ~250 milliseconds while reader_sock is actively rendering <input name="from" value="...">, reader_sock's thread stack holds a live reference to from.value (at Region R+1 + 0x20010), whose .length we forged to 4.19 MB (0x420000):

  • In G1, normal Eden regions are 1 MB, and G1’s Young GC evacuates live Eden objects by copying them into 1 MB Survivor regions (G1ParScanThreadState::do_copy_to_survivor_space).
  • Because from.value claims to be 4.19 MB (> 1 MB), it cannot fit inside a 1 MB Survivor region!
  • If a Young GC triggers during that 250 ms window, do_copy_to_survivor_space fails to allocate 4.19 MB, declares an Evacuation Failure on Region R+1, and runs RemoveSelfForwardPtrHRClosure (HeapRegion::object_iterate), which walks Region R+1 linearly from +0x00000 — hitting corrupted_writer's dead +0x00000 header (narrowKlass = 0x9aa6699a) and crashing!
  • Worse, Jenkins’s dom4j XML serializer (XMLWriter.escapeAttributeEntities) executes "&#" + (int) c + ";" for every < 32 byte in the 4.19 MB dump, allocating ~150 MB of temporary String objects in Eden during that 250 ms render!
  • Why the exploit survives this: As long as G1 Eden has at least 160 MB of free headroom (out of ~315 MB total Eden capacity) when reader_sock starts rendering /login, those temporary "&#0;" strings fit inside Eden without triggering a Young GC during the 250 ms render window, and the moment /login finishes, from.value is popped off reader_sock's stack forever.

Takeaways & Remediation

  1. "Fixed-Byte Overflow + Immediate Exception" ≠= Unexploitable:
    In a managed runtime like the JVM, you don’t need to overwrite a function pointer or inject shellcode. Overwriting an adjacent byte[] array’s .length field with the fixed constant 0x699aa669 (+1.77 GB) is enough to forge clean object headers, unwind the corrupted stack frame via Early EOF, leak megabytes of live heap over HTTP, and flip in-memory permission flags.
  2. How to Remediate Immediately:
    • Upgrade OpenJDK to the patched November 2026 Critical Patch Update builds (>= 17.0.22 / >= 21.0.10).
    • Workaround (No Upgrade Required): Add -XX:+UnlockDiagnosticVMOptions -XX:-UseBase64Intrinsics to your JVM startup flags. This disables the AVX-512 Base64 assembly stub and falls back to the pure-Java decoder with negligible performance impact on web workloads.
get a 15 min demo

Start your journey today

Hadrian’s end-to-end offensive security platform sets up in minutes, operates autonomously, and provides easy-to-action insights.

What you will learn

  • Monitor assets and config changes

  • Understand asset context

  • Identify risks, reduce false positives

  • Prioritize high-impact risks

  • Streamline remediation

The Hadrian platform displayed on a tablet.
No items found.