Dev48
Language
  • About
  • Services
  • Industries
  • Technologies
  • Articles
  • Contacts
Book a call
    Home/Articles/A technical guide to mitigate java4shell with trurisk eliminate
Dev48
info@dev48.org+375 29 320-40-96WhatsApp@isky_by

© 2026 · All rights reserved.

A Technical Guide to Mitigate Java4Shell with TruRisk Eliminate

Source: Qualys•November 20, 2026 at 06:36 PM

A Technical Guide to Mitigate Java4Shell with TruRisk Eliminate

Executive Summary Java4Shell (CVE-2026-114938) is a heap out-of-bounds write in HotSpot’s AVX-512 Base64 decoder on x86-64. Calif reported it and showed pre-auth RCE in Keycloak, Jira, Confluence, Artifactory, Jenkins, and PingFederate. Nobody has reported exploitation in the wild as of…

Executive Summary

Java4Shell (CVE-2026-114938) is a heap out-of-bounds write in HotSpot’s AVX-512 Base64 decoder on x86-64. Calif reported it and showed pre-auth RCE in Keycloak, Jira, Confluence, Artifactory, Jenkins, and PingFederate. Nobody has reported exploitation in the wild as of November 17, 2026. CISA issued an alert that same day, urging everyone to patch now.

Your Java4Shell Response Plan

  • Patch to Oracle 17.0.21.1, 21.0.13.1, 25.0.5.1, or 27.0.1.1, or to your vendor’s build with JDK-8393212.
  • If you can’t patch today, start the JVM with -XX:-UseBASE64Intrinsics and restart it.
  • You’re only exposed on an x86-64 CPU with AVX-512 VBMI. ARM64 isn’t affected.

Tip for Qualys customers: you can apply the step 2 flag with TruRisk Eliminate, targeting only the hosts that need it and rolling it back in one click.

Affected Java Builds and Their Fixed Releases

Oracle shipped the fixed builds on November 17, 2026. October’s builds are still vulnerable.

Distro packages built before the fix are vulnerable even when the version looks current. Ubuntu’s 17.0.21.0.3 and Oracle Linux’s 17.0.21 are two examples.

How the Java4Shell Attack Chain Works

This is a typical Java4Shell attack chain:

  • The attacker needs a Base64 decode value they can control. Vulnerability discoverers were able to reach this pre-authentication condition via authentication in Keycloak, Jira, Confluence, Artifactory, Jenkins and PingFederate, and after login in Kafka, Solr, Elasticsearch, Gerrit and Spinnaker. A Java client that opens a TLS connection to a malicious server is exposed too.
  • The attacker then sends valid decodes until the server compiler compiles the fast path, then the bad input: 64 valid characters and one =, or 128 and one = on older 17 builds.
  • The target must pass the gates in the source. The JVM must see avx512_vbmi and avx512bw with UseAVX=3, the intrinsic must be on, and on 17u the input must be longer than 128 characters.
  • The stub’s tail handling goes wrong. The next section walks through it.
  • On a fixed build, or with the intrinsic off, nothing happens. Otherwise, 62 or 63 bytes land past the destination array on the Java heap.
  • Vulnerability researchers mentioned that they groomed the heap (G1 regions, thread-local allocation buffers) to turn that write into code execution. Unsuccessful exploitation will lead to a denial-of-service condition on the endpoint.

This remote code execution chain has only been mentioned as achieved by the vulnerability researchers. Nobody has reported it in the wild yet.

Tracing Java4Shell to Its Root Cause

Based on the jdk17u source at the fix commit, HotSpot generates the stub in generate_base64_decodeBlock (it shows up as implDecode at runtime), and C2 calls it from java.util.Base64$Decoder.decode0 once that method is hot. JDK-8268276 added the AVX-512 decoder in JDK 18 and JDK-8296735 backported it to 17.0.6, so 17.0.5 and older are clean.

The whole vector decoder sits inside if (VM_Version::supports_avx512_vbmi() && VM_Version::supports_avx512bw()). Without both features HotSpot only builds the scalar 4-character loop, which is fine. 17u has no AVX2 decoder; the AVX2 tables in that file are for encoding. MIME input goes straight to the scalar loop. Basic and URL input take the vector path once it’s longer than 128 characters.

The vector code decodes 64 characters a pass, and L_finalBit handles the last 1 to 63. Before the fix, a tail of 1 to 3 characters ending in = gave an output size of 0, and the padding step subtracted 1 from it. The output mask then came from bzhiq with an index of -1. bzhiq only reads the low 8 bits of the index, so -1 became 255, nothing got cleared and the mask stayed all ones. The final masked store wrote a full 64 bytes where it should have written none.

The exact trigger condition on 17u follows from the control flow. The input must be longer than 128 characters and go through the basic or URL decoder, since MIME goes to the scalar loop. Inputs of 256 characters or more run through 256-character passes, then everything runs through 64-character passes, so the tail left at L_finalBit is the length modulo 64. Every character in those passes must be valid Base64; a = or any other bad character inside a pass makes the stub exit early and hand the rest to Java. The tail must be 1 to 3 characters ending in =, and any non-padding character in it must also be valid. Put together, the bad lengths are 64k + 1 to 64k + 3 for k of 2 or more: 129 to 131, 193 to 195, 257 to 259 and so on. Legitimate padded Base64 always has a length that’s a multiple of 4, so none of these inputs is valid anyway. Unpadded values such as JWT segments can have other lengths, but they never end in =. That makes length modulo 64 plus a trailing = a tighter hunting signal than “not a multiple of 4”.

The fix, JDK-8393212, adds four lines at L_finalBit: if fewer than 4 characters remain, jump to L_bruteForce, the scalar path. The commit title is “Base64 optimization improvements”, which tells you nothing.

The fix closes the underflow and causes no other change. The new check runs before the stub computes either the input mask or the output size. With 4 or more characters left, the output size starts at (length / 4) × 3, which is at least 3. Padding takes off at most 2, so the size stays at 1 or more and bzhiq always gets a valid index. A tail made only of = fails the validity check and drops to the scalar loop. Tails of 1 to 3 characters never reach the vector code at all. I checked memory safety only. I didn’t check whether the stub decodes every odd-length tail of 4 to 63 characters correctly, and the fix doesn’t touch that logic.

No CWE is assigned yet. I’d file it as an integer underflow (CWE-191) that causes an out-of-bounds write (CWE-787). Windows x64 gets the same vector code; the function only differs in how it reads its arguments there. I’ve only read the 17u source. Calif’s shorter trigger on newer lines suggests a lower threshold than 128 characters there, but I haven’t confirmed it.

Confirm Exposure From Inside the Java Runtime

A JVM is exposed only when all four of these conditions are true:

  • It runs on an x86-64 CPU with avx512f, avx512bw, avx512vbmi and bmi2. That covers Intel Ice Lake, Sapphire, Emerald and Granite Rapids, and AMD Zen 4 and newer. Skylake-SP and Cascade Lake have AVX-512 but no VBMI.
  • It’s OpenJDK 17.0.6 or later, or 18 to 27, below the fixed builds. Oracle’s 8u511 Enterprise Performance Pack counts too, because it ships a 17-based VM.
  • UseAVX=3 and UseBASE64Intrinsics=true, which are the defaults on those CPUs.
  • Attacker input reaches the basic or URL decoder in java.util.Base64. Basic auth and JWT parsing do this before login.

A quiet service isn’t safe. The attacker warms up C2 with valid decodes first.

The OS doesn’t change the bug. Windows x64 gets the same generated code as Linux, though only Linux has public testing.

I wouldn’t rely on /proc/cpuinfo. It doesn’t exist outside Linux, and an empty result looks like “not affected”. Ask the JVM what it sees instead, on any OS: java -Xlog:os+cpu -version 2>&1 | grep -oE ‘avx512f|avx512bw|avx512_vbmi|bmi2’ | sort -u java -XX:+PrintFlagsFinal -version 2>/dev/null | grep -E ‘ (UseAVX|UseBASE64Intrinsics) ‘

All four flags, UseAVX = 3 and UseBASE64Intrinsics = true mean that runtime is exposed. Run the check with each java binary on the host, since each runtime reports its own settings.

Turn the intrinsic off with -XX:-UseBASE64Intrinsics and restart the JVM. With that flag HotSpot never generates the stub, which I confirmed in the source and on a live JVM. Oracle hasn’t published it as a workaround.

Skip -XX:DisableIntrinsic=_base64_decodeBlock. Upwind reports it fails unless you also pass -XX:+UnlockDiagnosticVMOptions.

CISA’s alert also suggests validating Base64 at the application boundary, enforcing input-size limits and limiting unauthenticated access. Boundary validation helps if it rejects padded input whose length isn’t a multiple of 4 before the decoder runs. Size limits won’t: the trigger is 65 characters on newer lines, shorter than most Basic-auth and JWT values. Limiting unauthenticated access works, but it means network ACLs or a VPN in front, because the vulnerable decode happens before login.

For Qualys customers, the Java4Shell mitigation is available now with TruRisk Eliminate on Linux and Windows hosts, linked to QIDs such as 389494. As additional QIDs are released for different operating systems, we will test them and add support. The Cloud Agent runs it on the hosts you pick. Before it changes anything, it checks that the host has an AVX-512 VBMI CPU and an affected Java runtime, so hosts that can’t hit the bug are left alone. On the hosts that can, it adds -XX:-UseBASE64Intrinsics to JAVA_TOOL_OPTIONS and keeps whatever value was already there.

The setting takes effect when each JVM restarts, so plan restarts with the application owners. Windows services pick it up after a host reboot. After the change, the agent reports every running Java process with its effective setting, worked out in the order HotSpot applies options. A JVM it can’t read shows up as unknown, so you know where to look instead of assuming it’s covered.

Rollback is one click in the console and restores the previous value. The mitigation doesn’t reach containers; set the flag in the image or pod spec for those. Treat it as a bridge to the patched builds, since Oracle hasn’t published the flag as a workaround.

Code execution is not the only outcome. A successful exploit chain can read Java heap memory before it runs any attacker code. That memory can hold private keys, tokens, and personal data. CISA also warns that crafted input can crash the JVM, so availability is at risk too. Java clients are exposed as well. The researchers report a client-side exploit in which a Java program is compromised simply by connecting over TLS to a malicious server.

Request a Demo

← All articles

What this article says

More in Cybersecurity

All →
Forrester Recognizes Checkmarx in The Forrester Wave™: Agentic Development Security Tools, Q4 2026
Checkmarx

Forrester Recognizes Checkmarx in The Forrester Wave™: Agentic Development Security Tools, Q4 2026

How exposure management can help public sector prepare for PHP2Shell-like vulnerabilities
Tenable

How exposure management can help public sector prepare for PHP2Shell-like vulnerabilities

Signal is Serious About Protecting Your Privacy
Signal

Signal is Serious About Protecting Your Privacy

How to secure autonomous enterprise AI agents in manufacturing environments
Okta

How to secure autonomous enterprise AI agents in manufacturing environments

Securing autonomous enterprise AI agents in retail
Okta

Securing autonomous enterprise AI agents in retail

How to secure every hop in an AI agent’s MCP workflow
Okta

How to secure every hop in an AI agent’s MCP workflow

More from Qualys

Third-Party JavaScript Is Part of Your Attack Surface: Lessons from a Recent Supply-Chain Attack
Qualys

Third-Party JavaScript Is Part of Your Attack Surface: Lessons from a Recent Supply-Chain Attack

NGINX2Root: Five nginx Flaws, Led by CVE-2026-123007. How to Find, Mitigate, and Patch Now
Qualys

NGINX2Root: Five nginx Flaws, Led by CVE-2026-123007. How to Find, Mitigate, and Patch Now

Why AI-ROC Is the Future of Exposure Management
Qualys

Why AI-ROC Is the Future of Exposure Management

Cognizant and Qualys Redefine AI-Era Managed Security Service
Qualys

Cognizant and Qualys Redefine AI-Era Managed Security Service

How to Find, Mitigate, and Patch the Critical Java4Shell Flaw (CVE-2026-114938) Now
Qualys

How to Find, Mitigate, and Patch the Critical Java4Shell Flaw (CVE-2026-114938) Now

Run Your Qualys Program by Conversation, Inside Google Cloud’s Gemini Enterprise
Qualys

Run Your Qualys Program by Conversation, Inside Google Cloud’s Gemini Enterprise