Hacker News new | past | comments | ask | show | jobs | submit

Java4Shell: RCE in OpenJDK when processing Base64

https://calif.io/java4shell/
From the section on performing heap grooming over the network ("Remote Heap Feng Shui"):

> The current attack is sensitive to network conditions, like RTT and jitter. Low, stable round-trip times are preferred for a more reliable attack. In our controlled environment, we performed this attack over the internet through public IP addresses instead of just assuming perfect laboratory conditions. For the current attack path to achieve optimal stability and reliability in exploitation, Calif turned to physics and utilized money to solve the problem, rather than experimenting with TCP/IP stack configuration. In other words, Calif rented another VM in the same region as our target.

And the "Limitations" section:

> There is no universal payload. Each chain needs a decoder route, a live writer, a returned reader or another feedback path, a heap layout, and an application action. Every target needs a bespoke profile. The exploit is not a universal point-and-shoot.

Based on the complexity and constraints, short-term mass-exploitation seems unlikely. It will take some time before there are reliable exploits, and they may require running on infra close to the target.

But a long tail of unpatched java applications/services at high-value targets getting exploited, seems plausible to me.

loading story #50543068
loading story #50539708
loading story #50539828
loading story #50540893
loading story #50542759
loading story #50539582
loading story #50540463
loading story #50540017
loading story #50543553
Super impressive work by Calif as usual.

The exploit conditions are very specific but there are still going to be a lot of hosts impacted. We at Semgrep published some free detection scripts here: https://github.com/semgrep/detection-scripts/tree/main/CVE-2...

They look for these five conditions:

  * HotSpot VM: any OpenJDK build, Oracle JDK, or GraalVM JDK. Only HotSpot generates the stub. OpenJ9 and GCJ are OK. Azul Prime (Zing), which replaces C2 with its own JIT, and any VM name not recognized as HotSpot are [?], never [!].
  * x86-64 JVM on an x86-64 host.
  * Version 17.0.6 or later, not at or above a version listed in FIXED_IN, and no newer than the newest releases checked (see below). Newer versions are [?]: they may carry the fix.
  * The JVM reports avx512_vbmi and avx512bw, and UseAVX >= 3.
  * Base64 intrinsics are on and C2/JVMCI can compile. These turn it off: -XX:-UseBASE64Intrinsics, -XX:DisableIntrinsic=_base64_decodeBlock, -Xint, -XX:TieredStopAtLevel below 4.
The write-up itself matches your version assumption, however it also says:

> According to Oracle, the following Oracle Java SE versions are vulnerable: 8u511b33-perf, 17.0.21.0.3, 21.0.13.0.3, 25.0.5.0.3, 27.0.1.0.3. We thank Oracle for providing this information ahead of publication time.

So according to Oracle at least, JRE8 versions are affected as well.

Seems like it's only a specific "performance pack" version of JRE8 that backported these changes that is vulnerable. Standard JRE8/11 is fine.
25.0.5.0.3 is the latest on the 25 version [0]. Does that mean no patch is available?

[0] https://www.oracle.com/java/technologies/javase/jdk25-archiv...

loading story #50539756
loading story #50540088
They mention GraalVM being affected, but it seems like it isn't when I run their PoC:

  kmiles@dora tmp.wdOJ2BRVwa % /opt/graalvm/bin/java Base64Trigger 
  runtime=21.0.5+9-LTS-jvmci-23.1-b48
  vm=Java HotSpot(TM) 64-Bit Server VM
  rejected=true changed=0 first=-1 last=-1
  NOT REPRODUCED
one note: it means -XX:-UseBASE64Intrinsics OR XX:DisableIntrinsic=_base64_decodeBlock OR -Xint OR -XX:TieredStopAtLevel below 4 (-XX:TieredStopAtLevel=3 and so on)
Wouldn't it be prudent for someone to patch even if they aren't running their code on an AVX512 system right this moment? They could be running on one.. next moment.
Sure, but I think it brings it down from "patch immediately" severity, to just "bump the JDK with next service deploy" severity.

Or, do running machines often have their CPU changed from under them without much notice?

loading story #50539423
loading story #50539816
This looks like Claudese - may be kind to write such things yourself if you intend for humans to read them. (For example, “ HotSpot VM: any OpenJDK build, Oracle JDK, or GraalVM JDK. Only HotSpot generates the stub. OpenJ9 and GCJ are OK. Azul Prime (Zing), which replaces C2 with its own JIT, and any VM name not recognized as HotSpot are [?], never [!].” — I tried parsing at least five times before realizing you’re asking me to decipher LLM talk)
I understood it on first read, anyone that is comfortable with Java ecosystem easily understands the differences between those JVM implementations.

Here are three more, PTC, Aicas, and ART (even if it runs DEX instead, and only the core language is supported).

I still don't understand what's meant with Azul. Is it affected or not? What is it never?
loading story #50539883
What's with this weird tendency to think everything you don't immediately understand is LLM? It's okay to not understand things. Have you worked with Java at all? Why do you expect to make sense of those technologies if not?

I've done Android development and there's nothing wrong with the way it's phrased. All of that is high signal information.

I've been working with Java for 30 years. The whole thing is phrased oddly and it has nothing to do with the specific technologies.
loading story #50544836
loading story #50547737
Native Image is also unaffected without `-march=native` which is not a default.
I don’t understand what you mean. Could you remove the triple negative to clarify?
Calif is an OpenAI funded shop..
Oracle owns Java and Oracle is "OpenAI funded" in the sense that Oracle's data center buildouts are being done using OpenAI as a consumer.

The circular financing continues!

But seriously, the funding here doesn't matter any more than Project Zero's funding comes from Google. Big companies are trying to improve security for the common software substrates of our industries / governments.

loading story #50547509
What’s that old Chinese proverb? “May you live in interesting times”? It feels like we’re living in interesting times. How long will it take for a bad actor to seriously compromise critical infrastructure? My bet is within six months.

The upside is that it’ll force legacy institutions and organizations with sub-par security to get good at security and modernize their legacy stacks. That, or get pwned in short order.

loading story #50546276
loading story #50542903
loading story #50540216
loading story #50542946
loading story #50540598
loading story #50538921
loading story #50540844
loading story #50541393
loading story #50540534
loading story #50540340
Unconfirmed, but people on Twitter suggest this vulnerability has to do with the AVX512 implementation of Base64 decoding, and so this vulnerability can be worked around by running Java with the -XX:UseAVX=2 flag. (https://x.com/sean_a_cassidy/status/2122791344573976817)
loading story #50538884
loading story #50538769
There are presumably more bugs lurking in the hand crafted assembly intrinsics in the JVM. The many eyeballs and shallow bugs thing is only true when the eyeballs actually understand the code.
loading story #50540968
loading story #50539838
loading story #50542777
>The best hacker today is neither AI nor human. It is the centaur hacker, part human, part AI.

I think only really smart people are going to be left in Security and Software. I can barely fathom what this group is doing with AI right now (ignoring that their model probably isn't nerfed and mine would be) and I don't think any of this is trainable for the average developer. This is starting to feel like some of the scientific fields where careers start when you get a MS/PhD. Or like the average developer is on the same level of not being able to convert a Word document to PDF.

loading story #50539972
loading story #50539964
Truth be told; as far as I can tell, the output the human gets from the AI can vary vastly in quality, depending on guardrails on the AI side. Guardrails that are internal (and opaque) to the user, combined with directives the user sets up, often manually.

(for example, I have mine keep ready reference to all of our CMMC controls and best practices)- and not only will my sessions cite referenced material as it responds, but it will do so when it writes code, as well - and it does a pretty decent job of keeping me honest. The one bit I'm struggling with is limiting complexity when it designs a solution to a problem. For larger projects, this can snowball quickly - and I haven't found an effective way to prevent this yet.

Skills can be shared, but it's a bit of a steep climb to getting an entire organization to pick the same skill (to get consistent behavior across the whole org)- sometimes an individual skill as it's written, will conflict with some other personal standard or quirk of how they work, so it's difficult to share them. This really seems, to me, to be very similar to how the software world used to work (as far as interoperability goes), earlier in history when there weren't many open standards, (and NO open source code) - and every competing OS vendor was trying to destroy their competitors so they could become a monopoly.

But yes, there's quite a bit of effort now that goes into maintaining this personal harness, and I'm sure the even smarter folks will come along and figure out workable ways of standardizing and sharing those kinds of harnesses.

I've been in this industry for 30 years, and the way I work has always changed with the times and new tools. It changed a LOT when Dev Ops became a thing. IaC, and containers. This feels kind of like that change, but maybe an order of magnitude. Almost feels like going from assembler to learning something like python; in terms of how much abstraction is being added.

loading story #50544495
They aren’t wrong that we should be deleting more support and removing more features. The idea that the linux kernel by default builds support for all sorts of ancient systems nobody has ever heard of is absurd.
loading story #50540239
loading story #50552479
loading story #50543117
loading story #50539991
Its time to come home to Gentoo
loading story #50541254
loading story #50541227
Before you keep your security team up all night, it looks like proxies save the day here. Might not be a complete fix, obviously a real patch should be applied as soon as possible.

> Request streaming. Some current grooming profiles need partial request bodies to reach the application. A proxy that waits for the complete body removes their release timing. nginx buffers request bodies by default.

https://calif.io/java4shell/#limitations

loading story #50540993
You can also mitigate Java4Shell by starting OpenJDK with either:

-XX:-UseBASE64Intrinsics to disable hardware-accelerated Base64 encoding and decoding, or

-XX:UseAVX=2 to disable AVX-512. Apply this flag only on x86-64 hosts. OpenJDK on ARM doesn't recognize it and will fail to start.

loading story #50539066
loading story #50538491
Their video of the exploit in action would be stronger if it was a bit more straightforward.

All the (impressive!) distracting graphics, the speed of change, and the lack of commentary meant it took me a few watches to actually notice the ‘seashell’ segments were wrapping remote shells that the exploit had given them.

https://youtu.be/-EOYmL4UKvs

More info here: https://www.upwind.io/blog/java4shell-what-we-know-now-and-w...

It's a heap out-of-bounds write in Java’s AVX-512 Base64 decoder.

This attack surface (manually optimized assembly code in the middle of software stacks) looks AWESOME
loading story #50542847
https://github.com/openjdk/jdk/commit/5177a70b385c16f26ede19...
loading story #50540329
Wow. That JIT stub generation code is freaking terrifying: https://github.com/openjdk/jdk/blob/5177a70b385c16f26ede191f...

I suspect it's not the only issue they're going to find there.

loading story #50545295
loading story #50542027
Eclipse Temurin has not released a patch yet....

(Re-reading my comment, sounds like I'm throwing shade. I was just trying to state a fact. In fact most of the third party distros have been caught off guard).

loading story #50544482
loading story #50541482
Given that this is AVX512-only...how many enterprises are out there that run vulnerable java applications on non-intel servers?

Genuine question. Everything I see is Intel all the time. I know that people at home switched to AMD, but they don't run enterprise java.

I also have been told that apparently EPYC was hyped for a while and some hosters give you that. But do corporations run the java applications there?

The name makes it sound like Log4J or the PHP thing, but from what I can tell right now, it kinda isn't all that relevant?

loading story #50539246
loading story #50540559
loading story #50538802
loading story #50541845
loading story #50539170
loading story #50539437
Not even fuzzing these things are criminal in 2026.

Is it difficult to just go through Java, nodejs etc. Base64/hex/.. implementations and fuzz them all?

Does anyone know why this would be missed?

loading story #50545311
loading story #50540814
"Since bzhiq(-1, output_len) doesn’t change any bits if output_len >= 64, this results in output_mask == -1u64."

Should say "output_len & 0xFF >= 64" instead. Bzhi only looks at the bottom byte.

I see no security advisory from Elasticsearch yet,we operate multiple ES clusters and I am not exactly sure what the mitigation is here. Changing our JVM options and restarting the nodes?
loading story #50546188
Upgrade your JVM version.
Seems like -XX:-UseBASE64Intrinsics is the better workaround for now.
loading story #50539103
This thread on the Temurin project is worth a read too: https://github.com/adoptium/temurin/issues/326

Bummer that:

> The Eclipse Foundation is not in the Vulnerability Group (despite their request to join), so we do not get weeks of advance notice regarding CVEs and patches (which would essentially allow us to build & test in advance of an embargo being lifted, and deliver on hour zero).

This only fires on x86 servers whose CPUs have AVX-512 VBMI. ARM boxes like Graviton and older Xeons never run the buggy code.

Could this be what triggered the recent outages?

https://x.com/InfiShark/status/2122786295105913332

Not everywhere... Requires an x86-64 processir with AVX512.
loading story #50538981
Why pair Spock with All Your Base? It was CATS that said the line.
loading story #50544410
I read that mismatch as a deliberate choice to allegorize how much of a mismatch it is to see that kind of memory access issue with Java, of all things.
loading story #50543376
Does anyone know what the attack vector of this is? I'm trying to figure out if our usage is affected by this CVE.
loading story #50538221
loading story #50538152
loading story #50539150
loading story #50538254
loading story #50537908
Why would anyone write the scalar part of a SIMD'd function in assembly code!?
loading story #50542546
loading story #50539002
loading story #50539450
loading story #50545327
This looks like it requires G1? ZGC, ParallelGC or Serial are not affected? Smaller workloads running on singe CPU containers would default to Serial GC.
loading story #50542507
loading story #50542821
loading story #50542402
Does the JIT compiler not do a good enough job at optimizing code that can take advantage of SIMD to just use java code for base64?
Automatic loop vectorization is unreliable since even small innocent-looking code changes can thwart loop shape detection and introduce optimization barriers. Apart from that the JIT is under a tight runtime budget, unlike an AOT compiler.

The Vector API was introduced to communicate intent more clearly to the JVM and to make optimizations more reliable. Unfortunately it is currently still incubating to make adapting it to Project Valhalla possible.

It seems like ARM64 AArch64 instances are not affected.
I wanted to make a PoC but its x86 only
> It took our own Quang Luong an hour to discover the vulnerability, and two more hours to develop the first working exploit. The total token cost was less than $200.

I don't know, man. I just don't know.

Is this supported in Minecraft on FEX?
internet is a terrifying place right now i wonder what exploit hackers knows about, but its not publicly available now
The string of A's reminds me of the ssh exploit recently.
loading story #50543694
is this why half the banks worldwide are offline on and off since yesterday?
i'm tired, boss
"vibe-uncoding" -- have actually been doing quite a bit of that in my older projects.
.
loading story #50538831
{"deleted":true,"id":50540121,"parent":50538240,"time":1794960611,"type":"comment"}
Encode binary data in text because some dumb thing can't process binary. Text back to binary slow, so better make use of ridiculously wide vector width thing to speed up dumb decoding step we should have never become reliant on in hot paths. Derp, memory safety bug. Derp, die because performance "optimization".

Our incredibly high tower of Jenga blocks is falling down under its own weight.

So many promotions because of optimizing cosmically unnecessary work, though.

Derp, derp, this is humans making computers.

As a person who does these kinds of optimizations, it hits in the feels.

loading story #50539523
where is the dancing girl in the exploit videos???
loading story #50539182
me using java for so long I have my own util.Base64 class used everywhere in pure java.

now panicking in case some LLM imported this without me noticing.

edit: it did. :(

loading story #50541866
That Vibe Uncoding section didn't go where I thought it was going. Instead of suggesting people stop vibe coding and potentially introducing more/new vulns, they suggest vibing the removal of features and hoping the model or the tests it generated or whatever catch the edge cases. It really does feel like we're circling the drain here, folks.

Also, (S)FTP is dead? Since when?

loading story #50545981
loading story #50543966
This is the code I use since 20 years back:

http://move.rupy.se/file/base64.txt

If this part becomes the bottleneck; so I need to write a GPU accelerated version I'll eat my own hat.

loading story #50540434
loading story #50540033
Uuuu, bug and exploits part is pretty standard so becomes boring wall of text that is instantly obsolete after patches, I hope ;) And no animation ?? How hard it is to splash there some animation ?? ;)

But there is part of article that somehow nobody mentions ! "A call for vibe-uncoding" and that is a future and sane sanity. How many unused Linux modules laying on disk ? And more commercial systems are usually worse - installer just unpacks and declares warranty void if something is modified or removed - law enforced stupidity.

You have [open] code ? You can clean it by doing very coarse work of not calling unused code or hardcoding return error on calling unused parts.

Like FTP code. Open source IT declared it dead years ago but camera and game manufacturers and probably more industries didn't get a memo. Still we do not implemented ftp replacement and ssh is single point of failure.

Hand-rolled assembly for base64 decoder seems like a great place to plant a backdoor. Wonder who wrote this.
loading story #50545389
New rule: all hand-written SIMD routines must be formally verified.
> "It is the centaur hacker, part human, part AI."

AI is... a horse?

loading story #50544587
Seems like security through obscurity might be a thing after all.
Calif is the new Gobbles. IYKYK.
{"deleted":true,"id":50544753,"parent":50538240,"time":1794999755,"type":"comment"}
The risk owners, security teams, compliance teams - are all holding tight inside a tent built for the usual weather, but facing an un-announced storm now.

Their first priority is not stabilizing the tech tent. They are busy planning the risk distribution, risk outsourcing, legal prep, customer messaging, ToS/SLA reviews, contracts etc. They are reinforcing the good-old fort walls around the tech tent.

Leaving aside the vulnerability, this is a terrible blog post. Even the title is wrong (RCE anywhere, no only on x86). The smug tone and the LLMese makes me want nothing to do with this mob.
If I owned an entire language platform with a JIT, it would not contain assembly in its standard library, it would simply be improved until it generated something at least that fast from high-level source code on that target CPU.

This is something I really like about LLVM. Their libc isn't spilling over with hand-written assembly. It's written in straightforward C++ under the belief that the compiler does, or will do, a good job.

loading story #50542565
loading story #50545355
loading story #50544045
So who leaked it?
is this the root cause of the issue befalling making giant companies right now? i think it's a java DOS for sure, but an RCE?
loading story #50538472
> To speed up Base64 decoding…

But. Just. Why. Maybe just KISS.

loading story #50545405
It's amazing, even in 2026, people still use an utterly unproductive piece of shit language called Java
Just as with CVE-2026-98432, Debian is immediately patched at embargo drop, Ubuntu still isn't patched.

Why do we even pay for Ubuntu?

loading story #50538875
loading story #50546597
loading story #50539249
{"deleted":true,"id":50538395,"parent":50538240,"time":1794950654,"type":"comment"}
{"deleted":true,"id":50538757,"parent":50538240,"time":1794952408,"type":"comment"}
We set UseAVX=2 on all our jdk hosts last year for unrelated thermal issues, turns out that saved us here
{"dead":true,"deleted":true,"id":50540285,"parent":50538240,"time":1794961873,"type":"comment"}
Perhaps its time to eclipse JIT + heap based complex memory allocation algorithm runtimes like java? Now that AI can port code to other safer/better systems like rust. The "simpler" the memory management system is the easier it is to harden against such attacks.

This attack is pretty insane to me for a couple of reasons. That intrinsic implementation is compiler/runtime dependent. There are many implementations of JVMs out there that could be vulnerable.

The other scary thing is that there are likely other intrinsic implementations which hide vulnerabilities that are hard to know without further research.

loading story #50548859
loading story #50549140
Vibe uncoding should be the way forward to prevent these bugs. LLMs should strip and bake our apps with only those required features and libraries to reduce the blast radius instead of affecting everyone. LLMs are not only good with vibe coding but also aka. vibe uncoding.
{"deleted":true,"id":50539022,"parent":50538240,"time":1794953752,"type":"comment"}
Makes me wonder whether we would have the same vulnerability if an LLM had written this decoder. It's tricky to write safe hardware accelerated code.
The fact that mainstream modules have such trivial bugs in logic that can be fully covered by testing is staggering. It is about time software developers will have proper test coverage for their code, at least for basic "unit" modules. Maybe we can even name a testing philosophy to match it.
loading story #50538873
loading story #50538825
loading story #50539185
please stop using native code that hasn't been proven
For anyone who cares, I have a solution "for now":

https://github.com/Qbix/proxy/blob/main/java4shell.md

When PHP2shell was announced, before the patches were available, I wrote a proxy to sanitize input. You should have an input-sanitizing proxy in front of your app servers anyway instead of waiting for patches for as-yet-undiscovered CVEs.

PHP < 8 doesn't have patches coming. It's either the proxy or be pwned. Some our honeypot machines running PHP 5 got infiltrated with full chained kernel-level exploits. The ones with the proxy didn't. Which one do you want to be?

https://github.com/Qbix/proxy -- now updated to help mitigate java4shell

Having said that, my proxy approach wouldn't fully protect ALL Java apps in this case, because:

A Java program that opens a TLS connection to a malicious server can be compromised, even if it exposes no service of its own.

The problem is that you can't intercept and "heal" TLS connections with a proxy, unless you also spoof the TLS certificates. However, since most Java apps don't pin certs, a workaround is using /etc/hosts and a CA cert added in cacerts. Then the proxy approach works even on outbound traffic. And you don't have to wait for the patches.

  1. Add maliciousserver.com -> 127.0.0.1 (or proxy IP) in /etc/hosts
  2. Java app resolves the hostname, connects to your proxy on 443
  3. Proxy presents a cert for maliciousserver.com signed by your local CA
  4. JVM checks: right hostname, trusted CA? handshake succeeds
  5. Proxy connects to the real server (using its own resolver that bypasses /etc/hosts, or the real IP directly)
  6. Normalizes Base64 in the response (assuming Calif relies on a wacky base64)
  7. Relays to Java client (safe)
so what you'd do is:

  1. Generate proxy CA cert
  2. Install in JVM truststore (keytool)
  3. /etc/hosts entries for known hostnames
  4. forward_proxy config block (port, ca_cert, ca_key)
  5. You have three options for routing: 
    HTTPS_PROXY env, 
    JVM flags (-Dhttps.proxyHost), 
    or iptables REDIRECT (covers code that ignores proxy vars)
  6. Start qbixproxy
  7. Verify with curl
The usual disclaimers... lock down the executable, removing any ability to read or write files, only pass traffic through like a proxy. Investigate the repo yourself, with your own Claude or ChatGPT etc. The repo even has links to pre-fill the prompts to do just that.

I'm putting this out under MIT license to help people, but under this license it disclaims all warranties, including implied warranty for merchantibility etc.

loading story #50542081