๐Ÿ”ฅ What Happened, Without the Hype Link to heading

On November 17, 2026, a JVM bug nicknamed Java4Shell (CVE-2026-114938) went public, and Oracle and OpenJDK shipped fixes the same day. CISA told everyone to patch immediately. The headlines said “remote code execution in Java.”

Here’s the short version. The bug is a heap overflow in HotSpot’s x86-64 Base64 decoder. It isn’t in the Java code you’d read in java.util.Base64. It’s in the hand-tuned AVX-512 machine code the JIT swaps in for it. Feed that decoder a malformed final block and it writes past the end of its buffer. Java rejects the input, but the damage is already done.

How bad is it? It depends who you ask:

  • Oracle scores it 8.1 (High) under CVSS 3.1. The researchers who found it score it 9.2 under CVSS 4.0.
  • Crashing the JVM is easy. Remote code execution is harder, but it’s been done. It needs an exploit built for the target. The researchers built them for default installs of Keycloak, Jira, Confluence, Artifactory, Jenkins and PingFederate, all before login, and for sample Spring Boot and Struts apps. They’re holding those exploits back for now and plan to publish them later.
  • OX Security estimates that under 0.12% of JVMs are at risk of code execution and about 0.8% at risk of a crash. It also says its own model probably understates the risk.
  • No exploitation in the wild had been confirmed as of November 18.

So: probably not the end of the world. But a crash any anonymous client can trigger with one request is still an outage, and the exploits are already written. They just haven’t been published yet. Patch it. And while you patch, find out whether you were actually exposed, because the answer tells you what to look at next time.


๐Ÿงญ Three Checks: Are You Exposed? Link to heading

A service is at risk only if all three are true.

1) Your JDK build is affected Link to heading

Line Affected Fixed in
17 17.0.6 through 17.0.21.0.3 17.0.21.1
21 up to 21.0.13.0.3 21.0.13.1
25 up to 25.0.5.0.3 25.0.5.1
27 up to 27.0.1.0.3 27.0.1.1

Java 11, standard Java 8, and 17.0.0 through 17.0.5 aren’t affected. The one Java 8 exception is Oracle’s performance build, fixed in 8u513-perf. If you’re on a non-LTS release that’s out of support, like 26, no fix is coming for it: move to 25.0.5.1 or 27.0.1.1. Vendor builds such as Corretto, Zulu or GraalVM add their own digits to the version, so match your build against your vendor’s advisory, not just this table.

Check the JVM that’s running, not the one on your laptop or in your Dockerfile:

kubectl exec <pod> -- java -version
# or
docker exec <container> java -version

If you build images with Spring Boot’s bootBuildImage or spring-boot:build-image (Paketo buildpacks), java isn’t on the PATH for a plain exec. Go through the buildpack launcher instead, and keep the second --: the default “tiny” images have no shell, and without it the launcher tries to run the command through one.

kubectl exec <pod> -- /cnb/lifecycle/launcher -- java -version

2) Your CPU has AVX-512 VBMI Link to heading

The broken code path exists only on x86-64 CPUs with the AVX-512 VBMI extension. Per OX Security, that’s Intel Xeon Ice Lake and newer (Sapphire Rapids, Emerald Rapids, Granite Rapids) and AMD Zen 4 and newer. Skylake, Cascade Lake, Zen 2 and Zen 3 aren’t affected. Neither is ARM: Graviton and Ampere are safe.

On AWS, that covers the Intel Ice Lake (m6i, c6i), Sapphire Rapids (m7i, c7i) and Granite Rapids (m8i) families, and the AMD m7a and m8a families (EPYC 9R14 and 9R45: Zen 4 and Zen 5). Don’t trust instance names, though. Autoscaling groups and node pools mix generations, so ask the machine:

grep -m1 '^flags' /proc/cpuinfo | tr ' ' '\n' | grep -E '^(avx512f|avx512bw|avx512vbmi|bmi2)$'

That’s Calif’s check. The fast path needs all four flags: avx512f, avx512bw, avx512vbmi and bmi2. If all four print, the CPU qualifies. Real Ice Lake and Zen 4 chips have all four, but a virtual machine can hide some of them, so check rather than assume.

Or test the machine directly Link to heading

Calif, who found the bug, published a small test on its disclosure page: one class, Base64Trigger. It runs the decoder until the JIT swaps in the fast machine code, then decodes the malformed input into a large array and checks whether bytes past the decoded output changed. On an affected JDK and CPU it prints REPRODUCED. Every write stays inside that array, and Calif says it’s safe to run.

It doesn’t work on Java 17. There the bug needs 128 As before the =, and the test sends 64, so it can’t reproduce it on any 17 build. On 17, use the table and the CPU check.

On 21 and later, it answers the first two checks at once, but only for the JDK and CPU it runs on. So use the same JDK vendor and version as the service, on the same instance type. Run it in a throwaway container or VM, not the service’s own pod: slim and buildpack images often lack the tools to copy a file in and run it. With a full JDK, it runs as a single file: java Base64Trigger.java. With only a JRE, compile it on another machine with javac --release 11 Base64Trigger.java, then run java -cp . Base64Trigger in the folder that holds the class.

Read the result one way only:

  • REPRODUCED means yes: that JDK on that CPU is affected.
  • NOT REPRODUCED doesn’t prove you’re safe. The test doesn’t confirm that the fast code ever kicked in. Fall back on the table and the CPU check.

3) Untrusted Base64 reaches the JDK decoder Link to heading

The vulnerable path is java.util.Base64’s basic and URL decoders. The MIME decoder isn’t affected, and neither are Base64 libraries that bring their own decoder. A library that calls java.util.Base64 under the hood is on the path, though. Spring’s Base64Utils (deprecated in Spring 6, removed in 6.2) and auth0’s java-jwt both do.

Decoding before login matters most, because then anyone on the internet can send the bad input. But it isn’t the only case. If anyone can sign up for an account, a logged-in user can send it too. The real test is “Base64 from anyone I don’t trust.”

Outbound counts too. Qualys reports that the researchers compromised a Java client simply by having it connect over TLS to a malicious server. The details aren’t public yet. Until they are, I’d treat any service that makes TLS calls to hosts an attacker can choose (webhooks, user-supplied URLs, fetching a URL from a request) as exposed on the first two checks alone.

The fast machine-code path kicks in only once the JIT has compiled the decoder. On a service with real traffic, anything on the login path is hot code, so assume it has been compiled.

The first two checks are about your infrastructure. The third is about your code, and that’s where a Spring app gets interesting.


๐ŸŒฑ Where a Spring App Decodes Base64 Before Login Link to heading

The advisories say the researchers reached code execution in a sample Spring Boot app, but not how. So I went and read the source to see where a Spring app hands attacker input to that decoder.

HTTP Basic: yes Link to heading

Spring Security’s BasicAuthenticationConverter pulls the Authorization header apart like this:

return Base64.getDecoder().decode(base64Token);

That’s java.util.Base64, the basic decoder, running on whatever the client sent, before any password is checked. It’s the same in 5.7, 5.8, 6.3, 6.5 and current main. BasicAuthenticationFilter hands the work to that converter, and WebFlux’s ServerHttpBasicAuthenticationConverter uses the same decoder.

So if any endpoint accepts HTTP Basic, the third check is a yes. That includes the internal tool, the Actuator endpoint behind Basic auth, and the admin page “nobody knows about”. Boot’s default security chain turns HTTP Basic on, so if you never wrote your own chain, you have it.

CSRF protection: yes, by default Link to heading

This is the one I didn’t expect. Since Spring Security 6 (Boot 3 and 4), CsrfFilter uses XorCsrfTokenRequestAttributeHandler by default. On every POST, PUT, PATCH or DELETE, it takes the client’s X-CSRF-TOKEN header or _csrf parameter and decodes it:

actualBytes = Base64.getUrlDecoder().decode(actualToken);

That’s the JDK’s URL decoder, on input the client chose. CsrfFilter runs before the authentication filters, so an anonymous client can reach it with no session at all. CSRF protection is on unless you turn it off. So a form-login app with no HTTP Basic anywhere still answers yes to the third check. WebFlux’s CsrfWebFilter does the same, with one extra step: the client needs a stored token first, and the default login page hands one out.

Stateless JSON APIs often call csrf.disable(), and those skip this path. Check rather than assume.

File uploads: yes, by default Link to heading

This one doesn’t need Spring Security, and Spring Security makes it worse. Boot turns multipart handling on by default. When a multipart request’s parts are parsed, Tomcat, Boot’s default server, reads each part’s Content-Disposition header. A name or filename written as a MIME encoded word (=?UTF-8?B?...?=) goes straight to the JDK decoder, in Tomcat’s MimeUtility:

decodedData = Base64.getDecoder().decode(encodedText);

Spring’s own ContentDisposition decodes the filename the same way later, but Tomcat gets there first. Who can trigger the parse:

  • With CSRF on, anyone, on any URL. When a POST has no X-CSRF-TOKEN header, CsrfFilter looks for a _csrf parameter, and on a multipart request that makes Tomcat parse the parts. That happens before any login check. It covers Boot’s default JWT resource server too: Spring Security skips the CSRF check only for requests that carry a bearer token, so a request without one still goes through it.
  • With CSRF off, DispatcherServlet parses the parts before it looks for a controller. That’s anyone who can reach a public path, plus every logged-in user. Without Spring Security, it’s anyone.

Either way, the URL doesn’t have to accept uploads. This is the path that catches stateless APIs and JWT resource servers, which skip HTTP Basic. Calif lists file uploads, next to authentication, as an ordinary way in.

If a service takes no uploads at all, spring.servlet.multipart.enabled=false closes this path. Patch anyway.

Opt-in features: yes, if you use them Link to heading

These decode client-supplied Base64 with the JDK decoder before login:

  • Remember-me decodes its cookie in AbstractRememberMeServices to log you in from it.
  • Spring Session’s default DefaultCookieSerializer Base64-decodes the SESSION cookie.
  • CookieRequestCache, if you swapped it in for the default session-based request cache, decodes its redirect cookie on every request.
  • HTTP/2 over plain HTTP (h2c). With server.http2.enabled=true and no TLS on the connector, which is common behind a load balancer that ends TLS, embedded Tomcat decodes the client’s HTTP2-Settings header with Base64.getUrlDecoder() during the upgrade. That happens before Spring sees the request at all.

Boot turns on none of these for you, and Spring Session only applies when it’s on the classpath. If you use any of them, count it.

What this means Link to heading

Don’t read this as “every Spring app is exploitable.” The first two checks still apply, and code execution still needs an exploit built for the target. But the researchers have shown they can build one for a Spring Boot app, so treat a yes on all three checks as urgent. The headline: on an affected JDK and CPU, a default Spring Boot 3 or 4 app takes attacker-chosen Base64 into the vulnerable decoder before login. One bad header can crash it.

JWT resource servers: not by the token itself Link to heading

If you use Spring Security’s OAuth2 resource server, JWTs are parsed by Nimbus JOSE+JWT. Nimbus decodes token segments with its own hand-written decoder (Base64URL โ†’ Base64 โ†’ Base64Codec). It never calls java.util.Base64. The upload path above still applies to a resource server, though.

Watch your own code around tokens, though. A filter that peeks at a JWT’s payload with Base64.getUrlDecoder() before the token is validated is on the vulnerable path. So is anything else you wrote.

Your own code Link to heading

Custom API-key headers, signed cookies, webhook signatures, “decode this header to find the tenant”: anything that decodes untrusted request data counts. From the root of the repository, find the candidates:

grep -rnE 'getDecoder\(\)|getUrlDecoder\(\)|Base64Utils' --include='*.kt' --include='*.java' .

Then check who can reach each hit: anyone, any logged-in user, or only trusted callers. This grep only sees your code. Libraries that decode for you won’t show up, which is why the framework paths above matter.

A Kotlin aside Link to heading

Kotlin’s own kotlin.io.encoding.Base64 (Base64.Default.decode(...), Base64.UrlSafe.decode(...)) is pure Kotlin, even on the JVM. It doesn’t call java.util.Base64. So code that uses it isn’t on this path, but Kotlin code calling java.util.Base64 is.

That’s useful for triage, not a fix. Don’t rewrite your decoders to dodge a JDK bug. Patch the JDK.


๐Ÿ”Ž Find Every JVM You Run Link to heading

The patch is easy. Finding every place it needs to go is the real work, and the JVMs you forget are the ones that bite.

  • Container base images. A tag like eclipse-temurin:21-jre pins a major version, not a patch. Your image has whatever was current when it was built. Rebuild, then redeploy.
  • CI and build toolchains. The JDK that compiles your code isn’t always the one that runs it, and CI runners often face the internet.
  • jlink and distroless images. They carry their own runtime and won’t pick up a host patch.
  • Tools that bundle Java. Jenkins, Keycloak, Elasticsearch, Jira and Confluence ship their own runtimes. Patch these first: the researchers reached code execution before login on default installs of Keycloak, Jira, Confluence and Jenkins.

For a small team, I’d start with a spreadsheet: one row per running service, with columns for JDK build, CPU flag, “decodes untrusted Base64?” and “patched?”. It’s boring, and it’s done in an afternoon. It’s also the list you’ll want for the next one.


๐Ÿฉน Patch, Then Prove It Link to heading

Patch. Move to 17.0.21.1, 21.0.13.1, 25.0.5.1 or 27.0.1.1. Bump the base image, rebuild, redeploy. Then redeploy the services nobody has touched in months, because their images are the oldest.

Stopgap, if you can’t patch today. Rapid7 and OX both point to turning off the intrinsic:

# Kubernetes container spec
env:
  - name: JAVA_TOOL_OPTIONS
    value: "-XX:-UseBASE64Intrinsics"

Or ENV JAVA_TOOL_OPTIONS="-XX:-UseBASE64Intrinsics" in a Dockerfile. If you already set JAVA_TOOL_OPTIONS (heap sizes, a -javaagent), add the flag to that value. A second definition replaces the first. And check that it took: at startup the JVM prints a Picked up JAVA_TOOL_OPTIONS: line. Make sure -XX:-UseBASE64Intrinsics is in it; on buildpack images it will sit among other flags. No flag in that line, no stopgap.

That sends Base64 decoding back to plain Java code, which is slower but safe from this bug. It’s harmless on ARM, so it’s fine in shared images. Take it out once you’ve patched.

You’ll also see -XX:UseAVX=2 suggested, which turns off AVX-512 entirely. It works on x86, but the JVM won’t start with it on ARM. Keep it out of any base image or launch script shared between Intel and Graviton machines, unless you want to swap one outage for another.

Prove it. “We bumped the Dockerfile” isn’t proof. Have every service tell you what it’s running:

@Component
class JavaVersionLogger : ApplicationRunner {
    private val log = LoggerFactory.getLogger(javaClass)
    override fun run(args: ApplicationArguments) {
        log.info("Running on Java {} ({})", Runtime.version(), System.getProperty("java.vendor"))
    }
}

Or let Actuator do it:

management.info.java.enabled=true
management.endpoints.web.exposure.include=health,info

The first line needs Spring Boot 2.6 or later. The second is needed because only health is exposed over HTTP by default. If you already set that list, for example to expose prometheus, add info to it instead: a second definition replaces the whole list, and your metrics endpoint quietly disappears. Then /actuator/info reports the runtime version, and you can check every service with a loop instead of trusting a list. Keep it on the management port or behind auth: you don’t want to tell the internet your exact JDK build in the middle of a CVE.

Defense in depth. CISA’s other advice applies here too: cap header and input sizes, validate at the boundary, and shrink what unauthenticated clients can reach. If an endpoint doesn’t need HTTP Basic, turn it off. That’s the same habit as validating HTTP arguments at the edge: decide what you accept before you do anything with it.


๐Ÿ” The Real Lesson: Upgrade Rhythm Link to heading

The teams that had a calm week were the ones already upgrading on a schedule. Their JDK bump was a one-line PR through a pipeline they trust. Everyone else spent the week finding out what they run.

It’s the same point I keep making about Kotlin upgrades and the Spring Boot 3 โ†’ 4 migration: small, regular steps are cheap, and the big emergency jump is what hurts. A security patch is just an upgrade you didn’t get to schedule.


โœ… Checklist Link to heading

  • List every JVM: services, images, CI, bundled tools
  • For each one: affected JDK build? All four CPU flags (avx512f, avx512bw, avx512vbmi, bmi2) in /proc/cpuinfo?
  • Find untrusted Base64: HTTP Basic, CSRF (on by default), multipart uploads (on by default), remember-me, Spring Session, CookieRequestCache, h2c, custom headers, your own getDecoder() / getUrlDecoder() calls, and outbound TLS to hosts an attacker can choose
  • Patch to 17.0.21.1 / 21.0.13.1 / 25.0.5.1 / 27.0.1.1, rebuild images, redeploy
  • Where you can’t patch yet: -XX:-UseBASE64Intrinsics, and check for the “Picked up” line (never -XX:UseAVX=2 in images shared with ARM)
  • Confirm the running version on every service
  • Turn off HTTP Basic wherever you don’t need it

Sources


Related Posts