<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Java | AtakorLAB</title><link>https://atakorlab.com/tags/java/</link><atom:link href="https://atakorlab.com/tags/java/index.xml" rel="self" type="application/rss+xml"/><description>Java</description><generator>Hugo Blox Builder (https://hugoblox.com)</generator><language>en-us</language><lastBuildDate>Thu, 19 Nov 2026 00:00:00 +0000</lastBuildDate><image><url>https://atakorlab.com/media/sharing.png</url><title>Java</title><link>https://atakorlab.com/tags/java/</link></image><item><title>Writing past the end of an array with a Base64 string: how CVE-2026-114938 turns into code execution</title><link>https://atakorlab.com/blog/cve-2026-114938-java4shell/</link><pubDate>Thu, 19 Nov 2026 00:00:00 +0000</pubDate><guid>https://atakorlab.com/blog/cve-2026-114938-java4shell/</guid><description>
&lt;video controls poster="/blog/cve-2026-114938-java4shell/cve-2026-114938-poc.jpg" &gt;
&lt;source src="https://atakorlab.com/blog/cve-2026-114938-java4shell/cve-2026-114938-poc.mp4" type="video/mp4"&gt;
&lt;/video&gt;
&lt;h2 id="next-up-le-coupable-idéal"&gt;Next up: &lt;em&gt;le coupable idéal&lt;/em&gt;&lt;/h2&gt;
&lt;p&gt;Every few years the industry picks a usual suspect. For the longest stretch it was PHP: the
language we loved to perp-walk, the one where a single &lt;code&gt;?cmd=&lt;/code&gt; and a sloppy &lt;code&gt;include&lt;/code&gt; handed you a
webshell and everyone nodded along: &lt;em&gt;of course&lt;/em&gt; it was PHP. We practically built a genre around it.
php2shell. The perfect culprit. Easy to arrest, easy to convict.&lt;/p&gt;
&lt;p&gt;But if you&amp;rsquo;ve seen the documentary that lends this section its title, you know the trap: the obvious
suspect, the one who &lt;em&gt;looks&lt;/em&gt; guilty, is the one the whole system railroads, while the real killer
walks out the front door because nobody could believe someone that respectable did it. So after all
the years we spent squinting at PHP, let me put the next defendant in the line-up. The one with the
alibi. The one wearing the suit that says &lt;em&gt;memory-safe, enterprise-grade, runs-your-bank&lt;/em&gt;:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Java.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Not Java-the-deserialization-circus you already know. This time there&amp;rsquo;s no gadget chain, no
&lt;code&gt;readObject&lt;/code&gt;, no &lt;code&gt;Runtime.exec&lt;/code&gt; hiding in a library three dependencies deep. The murder weapon is a
&lt;strong&gt;Base64 decoder&lt;/strong&gt;, the most boring, most audited, most &lt;em&gt;obviously innocent&lt;/em&gt; function in the
entire standard library. You send an HTTP request with a Base64 string that&amp;rsquo;s one character too
long, and a few requests later you&amp;rsquo;re running arbitrary commands &lt;strong&gt;as the user the service runs
as&lt;/strong&gt;. Just arithmetic: a decoder that does subtraction in the wrong order and writes 62 bytes it
had no business writing. The rest of this post is the long version of turning those 62 bytes into a
shell, with the wrong turns left in, because the wrong turns are most of what I actually did.&lt;/p&gt;
&lt;p&gt;A note on that &amp;ldquo;as the user the service runs as,&amp;rdquo; because it matters and I want to be precise:
&lt;strong&gt;the bug does not escalate privileges.&lt;/strong&gt; It gives you code execution inside the JVM process, so
your shell inherits whatever account that process already had. On the lab box the service happened
to be launched as &lt;code&gt;root&lt;/code&gt;, so the shell came back as root. That&amp;rsquo;s an operational sin (don&amp;rsquo;t run
your app as root), not something the exploit earns. Run the same vulnerable service as an
unprivileged &lt;code&gt;appuser&lt;/code&gt; and you get a shell as &lt;code&gt;appuser&lt;/code&gt;. The primitive is &lt;em&gt;pre-auth remote code
execution as the service account&lt;/em&gt;; the privilege level is whatever that account was.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ll keep the moralising to one line: everything here ran on a box I was paid to break, behind a
firewall. Don&amp;rsquo;t point this at things that aren&amp;rsquo;t yours.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="part-0-how-i-ended-up-here"&gt;Part 0: how I ended up here&lt;/h2&gt;
&lt;p&gt;The engagement handed me a Java service that decodes auth tokens. Nothing exotic: it takes a
Base64 blob off the wire, decodes it, checks it. The kind of thing that exists in ten thousand
apps. The twist was a line in the scoping notes: &lt;em&gt;&amp;ldquo;the JVM is pinned to an AVX-512 profile.&amp;rdquo;&lt;/em&gt;
That&amp;rsquo;s a weird thing to write down, and weird things in scoping notes are usually there for a
reason.&lt;/p&gt;
&lt;p&gt;AVX-512 matters because &lt;code&gt;java.util.Base64&lt;/code&gt; has a hand-written SIMD intrinsic for the decode
path. HotSpot ships assembly stubs for hot library methods, and Base64 decode is one of them.
On a CPU with AVX-512 VBMI (the variant with &lt;code&gt;vpermb&lt;/code&gt;, arbitrary byte-shuffle across a 512-bit
register), the JIT swaps the plain Java loop for a stub that chews 64 input characters at a time.
It&amp;rsquo;s genuinely fast. It is also, it turns out, wrong at the edges.&lt;/p&gt;
&lt;p&gt;The VPS I was given didn&amp;rsquo;t &lt;em&gt;have&lt;/em&gt; AVX-512. Most cloud silicon doesn&amp;rsquo;t. So before I could even
look at the bug I had to fake the hardware, which is its own little saga (Part 2). But the shape
of the thing was already interesting: a vectorized decoder only misbehaves on inputs the scalar
decoder handles fine, which means the bug is invisible on every machine that can&amp;rsquo;t run the
intrinsic. You could fuzz this for a year on a laptop and never see it.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="part-1-whats-actually-broken"&gt;Part 1: what&amp;rsquo;s actually broken&lt;/h2&gt;
&lt;p&gt;Base64 packs 3 bytes into 4 characters. So a valid encoded string&amp;rsquo;s length is always a multiple
of 4 (padding with &lt;code&gt;=&lt;/code&gt; makes up the difference). Decode takes groups of 4 chars → 3 bytes.&lt;/p&gt;
&lt;p&gt;The question that breaks everything is: &lt;strong&gt;what does the decoder do when the length &lt;em&gt;isn&amp;rsquo;t&lt;/em&gt; a
multiple of 4?&lt;/strong&gt; A string whose length mod 4 is 1 is nonsense: you can&amp;rsquo;t have a leftover of a
single Base64 character, there aren&amp;rsquo;t enough bits to form even one output byte. The scalar
decoder notices and throws &lt;code&gt;IllegalArgumentException&lt;/code&gt;. Correct, boring, safe.&lt;/p&gt;
&lt;p&gt;The AVX-512 stub takes a different route. It processes the bulk of the input in 64-char vector
chunks and then has a &lt;em&gt;tail&lt;/em&gt; handler for the last partial group. The tail computes how many
bytes are left to emit, and here&amp;rsquo;s the sin, paraphrased:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;remaining = outputLength - bytesAlreadyWritten
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When you feed it a length ≡ 1 (mod 4), the bookkeeping makes &lt;code&gt;bytesAlreadyWritten&lt;/code&gt; &lt;em&gt;larger&lt;/em&gt; than
&lt;code&gt;outputLength&lt;/code&gt;. So &lt;code&gt;remaining&lt;/code&gt; goes &lt;strong&gt;negative&lt;/strong&gt;. In a signed world that&amp;rsquo;s just a small negative
number; nobody cares. But this value gets turned into an AVX-512 &lt;strong&gt;store mask&lt;/strong&gt;, a 64-bit
bitmap where each set bit says &amp;ldquo;write this lane of the vector to memory.&amp;rdquo; The code builds the
mask with something morally equivalent to &lt;code&gt;(1 &amp;lt;&amp;lt; remaining) - 1&lt;/code&gt;, expecting a handful of low bits
set. Feed it a negative &lt;code&gt;remaining&lt;/code&gt; and the shift/mask collapses to &lt;strong&gt;all ones&lt;/strong&gt;. Every lane
enabled.&lt;/p&gt;
&lt;p&gt;So instead of writing the 1 or 2 tail bytes it should, the stub executes a full &lt;strong&gt;64-byte masked
vector store&lt;/strong&gt;, starting at offset 48 of the output buffer. The output buffer, for my malformed
token, is 50 bytes. 48 + 64 = 112. That&amp;rsquo;s &lt;strong&gt;62 bytes written past the end of the array.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The token that does it is almost insultingly simple:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;#34;A&amp;#34;*64 + &amp;#34;=&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Sixty-four &lt;code&gt;A&lt;/code&gt;s (one clean vector chunk to make sure the intrinsic is actually engaged) and a
single &lt;code&gt;=&lt;/code&gt; to push the length to 65, and 65 mod 4 = 1. That&amp;rsquo;s the whole exploit input. Everything
after this is just me being greedy about what those 62 bytes land on.&lt;/p&gt;
&lt;h3 id="one-thing-that-cost-me-a-day-you-dont-control-the-bytes"&gt;One thing that cost me a day: you don&amp;rsquo;t control the bytes&lt;/h3&gt;
&lt;p&gt;My first instinct was the obvious one: if I&amp;rsquo;m writing 62 bytes off the end, let me write a
&lt;em&gt;pointer&lt;/em&gt; off the end, groom an object there, classic heap overflow. I spent a good while trying
to steer the &lt;em&gt;contents&lt;/em&gt; of the overflow.&lt;/p&gt;
&lt;p&gt;You can&amp;rsquo;t. I tested token after token (&lt;code&gt;A...&lt;/code&gt;, &lt;code&gt;QUJD&lt;/code&gt;, &lt;code&gt;Z...&lt;/code&gt;) and dumped what actually landed
past the array. The bytes that come from &lt;em&gt;in-bounds&lt;/em&gt; input positions (offset ≤ 47) reflect my
data, sure. But everything from offset 48 onward, the part that&amp;rsquo;s actually out of bounds, is a
&lt;strong&gt;fixed &lt;code&gt;0x9a&lt;/code&gt;-ish fill pattern&lt;/strong&gt; regardless of input. It&amp;rsquo;s whatever garbage the vector register
held, and it&amp;rsquo;s constant. I don&amp;rsquo;t get to pick it.&lt;/p&gt;
&lt;p&gt;That reframes the whole exploit. I&amp;rsquo;m not writing a value I choose. I&amp;rsquo;m writing a &lt;em&gt;fixed, large,
junk value&lt;/em&gt; at a &lt;em&gt;location I choose&lt;/em&gt; (by sizing the output buffer so the overflow lands exactly
where I want). The only degree of freedom is &lt;strong&gt;alignment&lt;/strong&gt;. Which, as it happens, is enough,
because of what sits next to a Java array.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="part-2-making-a-laptop-pretend-to-be-a-server-cpu"&gt;Part 2: making a laptop pretend to be a server CPU&lt;/h2&gt;
&lt;p&gt;Quick detour, because without this nothing runs. The target silicon has no AVX-512, so the
intrinsic never activates on real hardware. I used &lt;strong&gt;Intel SDE&lt;/strong&gt; (Software Development Emulator)
to emulate an Ice Lake server core:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./sde64 -icx -- ./jdk/bin/java ...
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;-icx&lt;/code&gt; tells SDE to present Ice Lake&amp;rsquo;s CPUID, AVX-512 VBMI included, and to emulate any
instruction the real chip can&amp;rsquo;t run. HotSpot does its CPUID probe at startup, believes it&amp;rsquo;s on a
fancy chip, and installs the AVX-512 Base64 stub. From there the bug is live.&lt;/p&gt;
&lt;p&gt;Two JVM flags earned their place through pain:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;-Xbatch&lt;/code&gt; + &lt;code&gt;-XX:-TieredCompilation&lt;/code&gt; force C2 to compile the decode method &lt;em&gt;synchronously&lt;/em&gt;.
Under SDE on a single vCPU, the background compiler is so starved it basically never gets around
to the decoder on its own, so the intrinsic never installs and you sit there wondering why your
&amp;ldquo;working&amp;rdquo; exploit does nothing. Make compilation blocking and the problem disappears.&lt;/li&gt;
&lt;li&gt;A no-op / Epsilon garbage collector, or at least a heap big enough that no collection fires
mid-exploit. This matters more than it sounds and bit me hard (see Part 6).&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id="part-3-from-62-junk-bytes-to-a-readwrite-primitive"&gt;Part 3: from &amp;ldquo;62 junk bytes&amp;rdquo; to a read/write primitive&lt;/h2&gt;
&lt;p&gt;Here&amp;rsquo;s the fact that makes Java heap overflows delicious. A Java array header stores its
&lt;strong&gt;length&lt;/strong&gt; inline, right before the elements. The JVM trusts that length for every bounds check.
So if my 62-byte spray lands on the length field of a &lt;em&gt;neighbouring&lt;/em&gt; array and overwrites it with
&lt;code&gt;0x9a...&lt;/code&gt; (a huge number), that array now believes it is billions of elements long. Every
&lt;code&gt;arr[i]&lt;/code&gt; after that is an unchecked read or write into whatever memory follows it.&lt;/p&gt;
&lt;p&gt;I don&amp;rsquo;t control the junk value, but I don&amp;rsquo;t need to: &lt;em&gt;any&lt;/em&gt; large value turns a bounded array
into an unbounded window. The fixed &lt;code&gt;0x9a69a69a&lt;/code&gt;-flavoured fill is, if anything, perfect: it&amp;rsquo;s
enormous.&lt;/p&gt;
&lt;p&gt;So the groom is just: get a victim array allocated &lt;strong&gt;immediately after&lt;/strong&gt; my decode buffer, size
the buffer so offset-50-onward overflow lands on the victim&amp;rsquo;s length word, fire the token once.
In the lab app that&amp;rsquo;s three lines:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-java" data-lang="java"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;outLen&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// overflow source (decode target)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&lt;/span&gt;&lt;span class="kt"&gt;long&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;long&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;8&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// victim: length gets smashed&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&lt;/span&gt;&lt;span class="n"&gt;Object&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;anchor&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Object&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;App&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// a mirror to leak with, later&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The bump allocator lays those out back-to-back in order, so &lt;code&gt;payload&lt;/code&gt; sits right before &lt;code&gt;meta&lt;/code&gt;.
Here&amp;rsquo;s the whole trick in one picture. The decode writes forward out of &lt;code&gt;payload&lt;/code&gt; and lands on
the one field that matters, the length word of &lt;code&gt;meta&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-gdscript3" data-lang="gdscript3"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="n"&gt;meta&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;long&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="err"&gt;┌───────┬──────────────────────┐&lt;/span&gt; &lt;span class="err"&gt;┌────────┬────────┬──────────────┐&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="err"&gt;│&lt;/span&gt; &lt;span class="n"&gt;hdr&lt;/span&gt; &lt;span class="err"&gt;│&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;..&lt;/span&gt; &lt;span class="mi"&gt;47&lt;/span&gt; &lt;span class="err"&gt;│&lt;/span&gt; &lt;span class="mi"&gt;48&lt;/span&gt; &lt;span class="o"&gt;...&lt;/span&gt; &lt;span class="mi"&gt;49&lt;/span&gt; &lt;span class="err"&gt;│&lt;/span&gt; &lt;span class="err"&gt;│&lt;/span&gt; &lt;span class="n"&gt;klass&lt;/span&gt; &lt;span class="err"&gt;│&lt;/span&gt; &lt;span class="n"&gt;LENGTH&lt;/span&gt; &lt;span class="err"&gt;│&lt;/span&gt; &lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="err"&gt;│&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="err"&gt;└───────┴──────────┴────────────┘&lt;/span&gt; &lt;span class="err"&gt;└────────┴────────┴──────────────┘&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="err"&gt;└────&lt;/span&gt; &lt;span class="n"&gt;valid&lt;/span&gt; &lt;span class="err"&gt;─────┘└─────&lt;/span&gt; &lt;span class="mi"&gt;62&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;byte&lt;/span&gt; &lt;span class="n"&gt;OOB&lt;/span&gt; &lt;span class="n"&gt;spray&lt;/span&gt; &lt;span class="err"&gt;──────▶&lt;/span&gt; &lt;span class="o"&gt;...&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="ow"&gt;in&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;bounds&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;echo&lt;/span&gt; &lt;span class="err"&gt;│&lt;/span&gt; &lt;span class="err"&gt;▲&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;of&lt;/span&gt; &lt;span class="n"&gt;my&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="err"&gt;│&lt;/span&gt; &lt;span class="err"&gt;│&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;AVX&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;512&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt; &lt;span class="n"&gt;starts&lt;/span&gt; &lt;span class="n"&gt;here&lt;/span&gt; &lt;span class="err"&gt;│&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;offset&lt;/span&gt; &lt;span class="mi"&gt;48&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;runs&lt;/span&gt; &lt;span class="mi"&gt;64&lt;/span&gt; &lt;span class="n"&gt;bytes&lt;/span&gt; &lt;span class="err"&gt;─────┘&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;clobbers&lt;/span&gt; &lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;LENGTH&lt;/span&gt; &lt;span class="n"&gt;with&lt;/span&gt; &lt;span class="mh"&gt;0x9a69a69a&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="n"&gt;meta&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;2.5 billion&amp;#34;&lt;/span&gt; &lt;span class="n"&gt;elements&lt;/span&gt; &lt;span class="n"&gt;long&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;After the malformed decode, &lt;code&gt;meta.length&lt;/code&gt; reads back as something like 2.5 billion. Now
&lt;code&gt;meta[i]&lt;/code&gt; for large &lt;code&gt;i&lt;/code&gt; is an out-of-bounds read/write across the heap. That&amp;rsquo;s my primitive.&lt;/p&gt;
&lt;p&gt;The server exposes it as two endpoints, &lt;code&gt;peek(id, i)&lt;/code&gt; and &lt;code&gt;poke(id, i, v)&lt;/code&gt;, which just do
&lt;code&gt;meta[i]&lt;/code&gt; / &lt;code&gt;meta[i] = v&lt;/code&gt;. Perfectly innocent code; the app is &lt;em&gt;supposed&lt;/em&gt; to let a client index
its own cache. The corrupted length is what makes &amp;ldquo;its own cache&amp;rdquo; mean &amp;ldquo;all of memory.&amp;rdquo;&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="part-4-turning-a-relative-window-into-an-absolute-one"&gt;Part 4: turning a relative window into an absolute one&lt;/h2&gt;
&lt;p&gt;A giant array gets me &lt;em&gt;heap-relative&lt;/em&gt; read/write: I can reach anything at a positive offset from
&lt;code&gt;meta&lt;/code&gt;. That&amp;rsquo;s not yet &amp;ldquo;read address X.&amp;rdquo; I need two upgrades: find out &lt;em&gt;where things are&lt;/em&gt;
(&lt;code&gt;addrOf&lt;/code&gt;), and reach addresses the array can&amp;rsquo;t (absolute R/W).&lt;/p&gt;
&lt;h3 id="addrof-the-free-way"&gt;addrOf, the free way&lt;/h3&gt;
&lt;p&gt;Compressed oops are the gift here. On a sub-4 GB heap, HotSpot stores object references as 32-bit
&amp;ldquo;narrow oops,&amp;rdquo; and, crucially on this build, with &lt;strong&gt;base = 0 and shift = 0&lt;/strong&gt;. That means a
narrow oop &lt;em&gt;is&lt;/em&gt; the object&amp;rsquo;s absolute heap address, no decoding. So:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Put a target object into my &lt;code&gt;Object[] anchor&lt;/code&gt; slot.&lt;/li&gt;
&lt;li&gt;Use the corrupted &lt;code&gt;meta&lt;/code&gt; window to read the raw 32-bit word of that slot.&lt;/li&gt;
&lt;li&gt;That word is the object&amp;rsquo;s address. Done. &lt;code&gt;addrOf&lt;/code&gt; for free, no &lt;code&gt;Unsafe&lt;/code&gt;, no leak gadget.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="directbytebuffer-the-absolute-rw-pivot"&gt;DirectByteBuffer: the absolute R/W pivot&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;meta&lt;/code&gt; window can only reach &lt;em&gt;forward&lt;/em&gt; through the heap; it can&amp;rsquo;t touch libjvm&amp;rsquo;s high-mapped
addresses. For that I borrow a &lt;code&gt;DirectByteBuffer&lt;/code&gt;. A DBB has a native &lt;code&gt;address&lt;/code&gt; field (a plain
&lt;code&gt;long&lt;/code&gt; at a known object offset) pointing at its off-heap backing. &lt;code&gt;getLong&lt;/code&gt;/&lt;code&gt;putLong&lt;/code&gt; read and
write relative to that field.&lt;/p&gt;
&lt;p&gt;So: use the &lt;code&gt;meta&lt;/code&gt; window to &lt;strong&gt;overwrite the DBB&amp;rsquo;s &lt;code&gt;address&lt;/code&gt; field&lt;/strong&gt; with any pointer I want, then
call &lt;code&gt;region.getLong(0)&lt;/code&gt; / &lt;code&gt;putLong(0, v)&lt;/code&gt; to read or write &lt;em&gt;that&lt;/em&gt; address. The buffer becomes a
movable aperture over the entire 64-bit space. The server exposes this as &lt;code&gt;region/get&lt;/code&gt; and
&lt;code&gt;region/put&lt;/code&gt;. Two endpoints, arbitrary absolute read, arbitrary absolute write. The memory-safety
story of the whole process is now over; the rest is navigation.&lt;/p&gt;
&lt;h3 id="the-aastore-trap-half-a-day-gone"&gt;The aastore trap (half a day, gone)&lt;/h3&gt;
&lt;p&gt;One genuinely nasty snag. My first corruption target was the &lt;code&gt;Object[]&lt;/code&gt; itself, and I tried to
&lt;code&gt;aastore&lt;/code&gt; into the &lt;em&gt;corrupted&lt;/em&gt; array to plant references. Instant crash. Why: an &lt;code&gt;aastore&lt;/code&gt;
triggers a store-type-check, which walks the array&amp;rsquo;s &lt;strong&gt;klass pointer&lt;/strong&gt;, and my overflow had
smashed the bytes around the header, klass included. The type-check dereferences garbage and
faults.&lt;/p&gt;
&lt;p&gt;The fix is to never write &lt;em&gt;through&lt;/em&gt; the smashed object as a typed store. Do your &lt;code&gt;addrOf&lt;/code&gt; against
a &lt;em&gt;clean&lt;/em&gt; companion array, and compute the smashed object&amp;rsquo;s address arithmetically
(&lt;code&gt;writerAbs = addrOf(payload) + headerDelta&lt;/code&gt;) instead of asking the JVM to touch its poisoned
header. Obvious in hindsight. It was not obvious at 1 a.m.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="part-5-finding-libjvm-and-the-global-nobody-guards"&gt;Part 5: finding libjvm, and the global nobody guards&lt;/h2&gt;
&lt;p&gt;Absolute R/W is great but I&amp;rsquo;m firing blind until I know where &lt;code&gt;libjvm.so&lt;/code&gt; is mapped, since ASLR
moves it every launch. I need one reliable pointer &lt;em&gt;into&lt;/em&gt; libjvm that I can find from an object I
already hold.&lt;/p&gt;
&lt;p&gt;The trick: a class&amp;rsquo;s runtime &lt;code&gt;Class&lt;/code&gt; mirror (e.g. &lt;code&gt;App.class&lt;/code&gt;, the thing already sitting in my
&lt;code&gt;anchor&lt;/code&gt;) carries a hidden &lt;code&gt;Klass*&lt;/code&gt; field at a fixed, build-known offset. Follow it to the
&lt;code&gt;InstanceKlass&lt;/code&gt;, and the first word of a C++ &lt;code&gt;InstanceKlass&lt;/code&gt; is its &lt;strong&gt;vtable pointer&lt;/strong&gt;, which
points at a vtable &lt;em&gt;inside libjvm&lt;/em&gt;. One known constant later:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;libjvm_base = leaked_vtable_ptr − VTABLE_OFFSET
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;and I know where the whole library lives. (&lt;code&gt;VTABLE_OFFSET&lt;/code&gt; is specific to the exact JDK build.
I pulled it by dumping the InstanceKlass vtable offset once under a debugger. Different JDK,
re-derive it.)&lt;/p&gt;
&lt;p&gt;Now, the payoff. HotSpot has a diagnostic flag called &lt;strong&gt;&lt;code&gt;OnError&lt;/code&gt;&lt;/strong&gt;: a string the VM runs via
&lt;code&gt;/bin/sh -c&lt;/code&gt; when it hits a fatal error, so operators can auto-collect diagnostics on a crash.
It&amp;rsquo;s stored as a &lt;code&gt;char*&lt;/code&gt; global in libjvm&amp;rsquo;s flag table. If I can write that pointer, I control a
command that the JVM will cheerfully execute &lt;em&gt;as itself&lt;/em&gt; (i.e. as whatever account the service
process is running under) the next time it crashes. And I have an arbitrary crash on tap: just
point the DBB at an unmapped address and read.&lt;/p&gt;
&lt;p&gt;So the endgame is three writes and a nudge:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Write my command string (&lt;code&gt;id&lt;/code&gt;, or a reverse-shell one-liner) into some memory I know the address
of. The DBB&amp;rsquo;s own backing works.&lt;/li&gt;
&lt;li&gt;Overwrite &lt;code&gt;&amp;amp;OnError&lt;/code&gt; (= &lt;code&gt;libjvm_base + ONERROR_OFFSET&lt;/code&gt;) with a pointer to that string.&lt;/li&gt;
&lt;li&gt;Trigger a segfault. HotSpot&amp;rsquo;s fatal-error handler fires, reads &lt;code&gt;OnError&lt;/code&gt;, and runs
&lt;code&gt;/bin/sh -c &amp;quot;&amp;lt;my string&amp;gt;&amp;quot;&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Executing /bin/sh -c &amp;#34;id&amp;#34; ...
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;uid=0(root) gid=0(root) groups=0(root)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;There it is: the command runs. (On this box the process was running as root, so &lt;code&gt;id&lt;/code&gt; prints
root; see the note at the top. The exploit grabs the &lt;em&gt;service account&lt;/em&gt;, whatever it is, not root
specifically.) From a malformed Base64 string to arbitrary command execution, and at no point did
I call a single function that a code-review grep would flag. The scariest exploits are the ones
made entirely of innocent pieces.&lt;/p&gt;
&lt;p&gt;Finding &lt;code&gt;&amp;amp;OnError&lt;/code&gt;&amp;rsquo;s offset was its own grind. I wrote a little scanner that parsed the static
JVMFlag table out of libjvm and cross-checked it by launching with &lt;code&gt;-XX:OnError=&amp;lt;canary&amp;gt;&lt;/code&gt; and
reading the pointer back to confirm I had the right slot. Tedious, but a one-time cost per build.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="part-6-the-difficulties-collected"&gt;Part 6: the difficulties, collected&lt;/h2&gt;
&lt;p&gt;The clean narrative above hides about three days of flailing. The honest list:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;You don&amp;rsquo;t control the overflow bytes.&lt;/strong&gt; The single biggest reframe. I wasted the first day
trying to write a chosen pointer before accepting the fill is fixed and pivoting to &amp;ldquo;smash a
length field with junk.&amp;rdquo; The lack of control is fine &lt;em&gt;if&lt;/em&gt; the thing you&amp;rsquo;re hitting only needs to
be big, not specific.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;One shot per JVM.&lt;/strong&gt; The C2 compiler &lt;em&gt;deoptimises and blacklists&lt;/em&gt; the decode method after it
sees the malformed input blow up enough times. After that it falls back to the safe scalar path
and the bug is gone until you restart the process. So you get roughly &lt;strong&gt;one reliable overflow per
JVM lifetime&lt;/strong&gt;. The entire exploit chain has to run off a &lt;em&gt;single&lt;/em&gt; trigger: you warm the
intrinsic, fire once, and do all your R/W through the corruption you already have. No &amp;ldquo;try
again.&amp;rdquo; This is the constraint that shapes everything; it&amp;rsquo;s why the groom has to be perfect
before you pull the trigger.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;The GC eats your victim.&lt;/strong&gt; Early on my exploit worked maybe one run in five and I couldn&amp;rsquo;t see
why. It was a young-gen collection firing &lt;em&gt;between&lt;/em&gt; the corruption and my first read, relocating
(or tripping over) an array whose length now claimed to be 2.5 billion elements. The collector
tries to walk it and either moves my landmarks out from under me or dies. Fix: run with
effectively no GC (Epsilon) or a heap large enough that nothing collects during the ~millisecond
of the exploit. Suddenly it was five runs in five.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;The aastore store-check fault&lt;/strong&gt; (Part 4). Touching a corrupted object as a &lt;em&gt;typed&lt;/em&gt; reference
array dereferences its smashed klass. Keep all typed operations on clean objects; treat the
smashed one as raw addresses only.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Getting the intrinsic to actually install under emulation.&lt;/strong&gt; Hours lost to an exploit that was
&amp;ldquo;correct&amp;rdquo; but silently running against the &lt;em&gt;scalar&lt;/em&gt; decoder because C2 never compiled the method
under SDE&amp;rsquo;s starved scheduler. &lt;code&gt;-Xbatch -XX:-TieredCompilation&lt;/code&gt; and an explicit warm-up loop
fixed it. Lesson: before trusting a SIMD-bug exploit, &lt;em&gt;prove the SIMD path is live&lt;/em&gt;. I added a
check that the first malformed token corrupts a throwaway array, and bailed loudly if it didn&amp;rsquo;t.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Build-specific constants.&lt;/strong&gt; The &lt;code&gt;VTABLE_OFFSET&lt;/code&gt; and &lt;code&gt;ONERROR_OFFSET&lt;/code&gt; values are nailed to one
exact JDK build. Point this at another build and you leak a pointer into the wrong place and
segfault for real. Every constant in the chain needs a &amp;ldquo;how I re-derive this&amp;rdquo; note, or future-me
is stuck.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id="part-7-doing-it-over-the-network"&gt;Part 7: doing it over the network&lt;/h2&gt;
&lt;p&gt;Everything above I first proved &lt;em&gt;locally&lt;/em&gt;: a standalone Java program on the box, grooming its own
heap. The obvious objection to a local PoC is &amp;ldquo;so what, you already had code execution to run it.&amp;rdquo;
Fair. The real question is whether a &lt;em&gt;remote, HTTP-only&lt;/em&gt; attacker can do the same, because that&amp;rsquo;s
the actual threat.&lt;/p&gt;
&lt;p&gt;The original token service couldn&amp;rsquo;t be popped remotely, and it&amp;rsquo;s worth saying why clearly: it
decoded attacker Base64 (so the &lt;em&gt;corruption&lt;/em&gt; reproduces over the wire; I could prove the victim
array&amp;rsquo;s length smashes via the response), but it exposed &lt;strong&gt;no persistent, client-indexable object
to then read and write through&lt;/strong&gt;. You can break something you can&amp;rsquo;t subsequently touch. The crash
is remote; the primitive isn&amp;rsquo;t.&lt;/p&gt;
&lt;p&gt;So to show the full remote chain I stood up a second service, &lt;code&gt;MemCacheService&lt;/code&gt;, a deliberately
ordinary-looking &amp;ldquo;remote off-heap cache&amp;rdquo; that exposes exactly the surface a real vulnerable app
&lt;em&gt;would&lt;/em&gt;: decode a blob on &lt;code&gt;/session/open&lt;/code&gt;, and let the client &lt;code&gt;peek&lt;/code&gt;/&lt;code&gt;poke&lt;/code&gt; and &lt;code&gt;region get&lt;/code&gt;/&lt;code&gt;put&lt;/code&gt; its own session buffers by index. Nothing in it is a backdoor; every endpoint is the
kind of thing you&amp;rsquo;d write without a second thought. The corrupted array length is what quietly
turns &amp;ldquo;index your own cache&amp;rdquo; into &amp;ldquo;read and write my whole address space.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;The remote exploit is then just the local chain, re-expressed as HTTP:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;POST /warm&lt;/code&gt; with a few thousand valid tokens → C2 compiles the shared decode helper, intrinsic
goes live.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;POST /session/open&lt;/code&gt; with &lt;code&gt;&amp;quot;A&amp;quot;*64 + &amp;quot;=&amp;quot;&lt;/code&gt; → grooms &lt;code&gt;payload → meta → region → anchor&lt;/code&gt;
back-to-back and fires the overflow; the response hands back &lt;code&gt;meta.length&lt;/code&gt; so I can &lt;em&gt;see&lt;/em&gt; it&amp;rsquo;s
corrupted.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;peek&lt;/code&gt; the &lt;code&gt;anchor&lt;/code&gt; slot → narrow oop → &lt;code&gt;addrOf&lt;/code&gt;. &lt;code&gt;peek&lt;/code&gt; the mirror → &lt;code&gt;Klass*&lt;/code&gt; → vtable →
&lt;code&gt;libjvm_base&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;poke&lt;/code&gt; the DBB&amp;rsquo;s &lt;code&gt;address&lt;/code&gt; field, then &lt;code&gt;region/put&lt;/code&gt; my command string and overwrite &lt;code&gt;&amp;amp;OnError&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;region/get&lt;/code&gt; at a bad address → fatal error → &lt;code&gt;OnError&lt;/code&gt; runs my one-liner as the service
account. It starts a tiny one-shot callback server; the exploit opens one TCP connection to it
and confirms the command executed:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;################ REMOTE EXEC CONFIRMED ################
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; uid=0(root) gid=0(root) groups=0(root)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;########################################################
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Pure HTTP in, command execution out, no shell on the box to begin with. Same bug, same chain,
just posted through a web server instead of a &lt;code&gt;main()&lt;/code&gt;. (Same caveat as before: &lt;code&gt;uid=0&lt;/code&gt; here only
because this lab service was started as root; the primitive gives you the service account, whatever
it is.) (One caveat baked into the design: the detonate step
&lt;em&gt;crashes the target JVM on purpose&lt;/em&gt;, since that&amp;rsquo;s how &lt;code&gt;OnError&lt;/code&gt; fires, so a successful run always
ends with the service dead. Re-run it and you get connection-refused until someone restarts the
service. That&amp;rsquo;s not a flaky exploit, it&amp;rsquo;s the exit condition.)&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="part-8-what-fixes-it-and-what-i-took-away"&gt;Part 8: what fixes it, and what I took away&lt;/h2&gt;
&lt;p&gt;The fix is unglamorous: the tail-length arithmetic in the intrinsic must be computed and masked so
it &lt;em&gt;can&amp;rsquo;t&lt;/em&gt; go negative, and a length ≡ 1 (mod 4) must reject exactly like the scalar path does.
Running with &lt;code&gt;-XX:-UseBASE64Intrinsics&lt;/code&gt; disables the stub entirely and makes the bug vanish, a
fine emergency mitigation if you&amp;rsquo;re stuck on a vulnerable build and happen to run on AVX-512
silicon. Patch the JDK properly when you can.&lt;/p&gt;
&lt;h3 id="if-youre-on-the-other-side-of-this"&gt;If you&amp;rsquo;re on the other side of this&lt;/h3&gt;
&lt;p&gt;Because the whole chain is built from innocent-looking pieces, there&amp;rsquo;s no single &lt;code&gt;Runtime.exec&lt;/code&gt;
to alert on. But the exploit is loud in other ways if you know where to look:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Malformed Base64 at volume.&lt;/strong&gt; The warm-up sends thousands of valid tokens, then the trigger is
a token whose length is &lt;code&gt;≡ 1 (mod 4)&lt;/code&gt; (e.g. 64 &lt;code&gt;A&lt;/code&gt;s + a single &lt;code&gt;=&lt;/code&gt;). A decode endpoint that
normally sees clean input suddenly taking a burst of &lt;code&gt;IllegalArgumentException&lt;/code&gt;-shaped tokens,
immediately followed by a crash, is the signature.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The crash itself.&lt;/strong&gt; Successful exploitation &lt;em&gt;requires&lt;/em&gt; a fatal JVM error; it&amp;rsquo;s how &lt;code&gt;OnError&lt;/code&gt;
fires. An &lt;code&gt;hs_err_pid*.log&lt;/code&gt; / &lt;code&gt;core.*&lt;/code&gt; appearing right after that traffic, with a SIGSEGV in or
near the Base64 stub, is your smoking gun. Treat an unexplained JVM fatal error as a security
event, not just an availability one.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;OnError&lt;/code&gt; executing a child process.&lt;/strong&gt; The payload runs as &lt;code&gt;/bin/sh -c &amp;quot;…&amp;quot;&lt;/code&gt; spawned by the
&lt;code&gt;java&lt;/code&gt; process &lt;em&gt;during a crash&lt;/em&gt;. A shell (or &lt;code&gt;python&lt;/code&gt;, &lt;code&gt;curl&lt;/code&gt;, a reverse-shell one-liner)
parented to a JVM that is simultaneously dying is about as abnormal as process trees get: easy
EDR win. Bonus: flag any JVM whose &lt;code&gt;OnError&lt;/code&gt; flag is set to something nobody put in the launch
config.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cheap hardening.&lt;/strong&gt; Don&amp;rsquo;t run the app as root (the whole &amp;ldquo;it came back as root&amp;rdquo; problem
evaporates). Keep decode endpoints behind auth. And on a vulnerable build you can&amp;rsquo;t patch yet,
&lt;code&gt;-XX:-UseBASE64Intrinsics&lt;/code&gt; closes the door outright.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The part that stays with me isn&amp;rsquo;t the pointer math, it&amp;rsquo;s the &lt;em&gt;shape&lt;/em&gt; of the thing. A SIMD
optimisation introduced a memory-safety bug into a memory-safe language, on a code path that only
exists on specific hardware, triggered by an input the &amp;ldquo;real&amp;rdquo; decoder rejects as garbage. It&amp;rsquo;s
invisible to review (the Java source is fine), invisible to most fuzzing (wrong CPU), and lands in
a method everyone considers boring and safe. Base64 decode. The quietest function in the standard
library.&lt;/p&gt;
&lt;p&gt;Check what your performance intrinsics do at the edges. That&amp;rsquo;s the whole lesson.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Written up from lab notes; all testing was authorized, on owned infrastructure.&lt;/em&gt;&lt;/p&gt;</description></item></channel></rss>