Article Banner

Java4Shell: Hunting the OpenJDK Base64 Heap Overflow

Java4Shell is a flaw in Java, the platform behind many of the business systems companies run every day, from staff sign-in portals to project trackers. Researchers at Calif showed that one short, oddly shaped string of text, sent over the internet, lets an outsider run commands on the server. In many products it needs no password.

A self-serve drink machine fills each cup by a measured amount, until a customer tricks the measure below zero and the machine reads that as "pour the whole jug." The drink overflows onto whatever sits beside the cup. Java4Shell tricks Java's fast text decoder the same way, so it writes past its own space onto the program data beside it, and a skilled attacker shapes that spill into control of the server.

Calif took over widely used sign-in, code storage and build systems in their default setup, and the same flaw lets an attacker read memory holding private keys and access tokens. A company hit this way loses the server, the data behind it and the trust of every system that relies on it. Oracle and the OpenJDK project shipped fixes on November 17, 2026.

Hunting Controls & Observations

The bug sits in the HotSpot C2 compiler's x86-64 Base64 decoding intrinsic, an AVX-512 VBMI fast path that only runs after the decoder has been called often enough to be compiled. Nothing touches disk on the way in, so the evidence lives in three places: the request carrying the malformed Base64, the JVM that receives it, and whatever that JVM does once the write lands.

  • Endpoint Controls: Microsoft Defender for Endpoint on Linux and Windows, or Sysmon for Linux (Event IDs 1, 3 and 11), on every host running a Java service: processes started by java, outbound connections it opens, and hs_err_pid*.log fatal error files.
  • Network Controls: WAF and reverse proxy logs with full request URLs. Only a WAF that inspects bodies and headers sees Base64 delivered in a login form, an Authorization header or a file upload.
  • Application & Platform Controls: service manager restart events, application logs recording java.lang.IllegalArgumentException from Base64 decoding, and the launch arguments of each JVM.
  • Asset Inventory: JDK versions per host (Microsoft Defender Vulnerability Management software inventory) and the CPU flags avx512f, avx512bw, avx512vbmi and bmi2 from /proc/cpuinfo.
  • Identity & Access: token issuance logs from Keycloak and PingFederate, and the credential stores of Jenkins and JFrog Artifactory, whose secrets sit in the memory the leak primitive reads.

Behavioral Indicators of Attack

Calif withholds its product-specific exploit chains, so these indicators come from the trigger and failure modes the research describes, plus the post-exploitation steps any code execution produces:

  • A Base64 field ending in a long run of one letter and padding (Network): Calif's published trigger is 64 A characters followed by a single = (65 bytes), or 128 A characters and = on OpenJDK 17, delivered through ordinary authentication or file upload features.
  • Warm-up traffic before the malformed request (Network): the vulnerable intrinsic only exists after C2 compiles the decoder, so an attacker first sends many well-formed Base64 values to the same endpoint from one source.
  • Base64 decode rejections that arrive too late (Application): Java throws IllegalArgumentException only after the overflow has already written into neighboring heap objects, so a logged rejection does not mean the attempt failed.
  • Unplanned JVM crashes on an exposed host (Endpoint): Calif notes that a misplaced write can crash the JVM and that the exploit simply tries again, so several fatal errors in a short window point to someone aiming the overflow.
  • A web-facing service process starting a shell or download tool (Endpoint): java as the parent of sh, bash, curl, wget, id or whoami is the first visible step after code execution lands.
  • Outbound traffic to addresses no other server contacts (Endpoint and Network): second-stage tooling and command traffic leave through the compromised service's own connections.
  • A Java client that crashes or spawns processes after a TLS session (Endpoint): Calif describes a client-side path in which a Java program connecting to a hostile server is exploited, which puts build agents and integration jobs in scope.

MITRE Enterprise ATT&CK Tactics and Techniques

Calif's research does not map techniques itself. Each entry below says whether it is stated in the source or inferred from the described behavior:

  • Initial Access (T1190 – Exploit Public-Facing Application): Calif reports code execution without credentials in default configurations of Keycloak, Atlassian Jira, Atlassian Confluence, JFrog Artifactory, Jenkins and PingFederate, and after login in Apache Kafka brokers, Apache Solr, Elasticsearch, Gerrit and Spinnaker. Stated in the source, which calls both lists non-exhaustive and also reached the decoder in Apache Struts and Spring Boot sample apps.
  • Execution (T1203 – Exploitation for Client Execution): The flaw also works in reverse: a Java program that opens a TLS connection to a malicious server is exploitable, a path Calif credits samczsun with demonstrating. Stated in the source.
  • Execution (T1059 – Command and Scripting Interpreter): Code running inside the Java service inherits whatever its service account can launch. Inferred from the described remote code execution, since the chains themselves are private.
  • Credential Access (T1212 – Exploitation for Credential Access): The same out-of-bounds condition leaks Java heap contents in the style of Heartbleed, and Calif says that heap can hold PII, private keys, other secret keys and tokens. Stated in the source.
  • Command and Control (T1105 – Ingress Tool Transfer): Follow-on tooling has to arrive over the service's own network connections. Inferred; Calif describes no post-exploitation activity.
  • Impact (T1499.004 – Application or System Exploitation): Incorrect heap placement can crash the JVM, taking the hosted application offline until it restarts. The crash is stated in the source; the outage is inferred.

Controls' Observables

Endpoint Controls

EDR on a Linux application server sees every process the JVM starts and every file it writes. The usual gap is coverage: agents land on laptops and Windows servers first, while Linux app hosts running Jira or Keycloak stay unmanaged.

  • A command shell whose parent is the application server, not an administrator: the process tree records the product's JVM as parent. On Jira, Confluence or Keycloak hosts that never happens in normal operation, so one event justifies a page; Jenkins is the exception, because build jobs launch shells all day.
    Related MITRE Techniques: T1059, T1190
    Detection Difficulty: EASY
  • A fatal error file appearing beside a running service: the JVM writes its crash report to the working directory as it dies, and the service manager logs the restart. Most teams file a lone crash as a stability ticket, which is exactly how a retrying exploit goes unnoticed.
    Related MITRE Techniques: T1499.004, T1190
    Detection Difficulty: MODERATE

Network Controls

A WAF or reverse proxy is the only control positioned to see the payload itself, and only for the parts of a request it logs or inspects.

  • A request field made almost entirely of one repeated character: a body-inspecting WAF can match it, but default access logs keep only the URL and status code, so delivery in a POST body or header leaves nothing to find. Calif adds that nginx request buffering does not stop its Elasticsearch chain or WebSocket frames, so the proxy is a sensor here, not a fix.
    Related MITRE Techniques: T1190
    Detection Difficulty: HARD
  • New outbound destinations from the application tier: an egress firewall with an allowlist turns this into a deny log at no extra cost. Where app servers have open outbound access, the signal exists only in endpoint telemetry.
    Related MITRE Techniques: T1105
    Detection Difficulty: MODERATE

Platform & Configuration Controls

Patch and configuration management decide exposure before any request arrives: Java4Shell needs an affected runtime and an x86-64 CPU with AVX-512 VBMI.

  • Services started without a mitigation flag: configuration management or EDR command-line data shows whether each JVM starts with -XX:-UseBASE64Intrinsics. A flag set through JAVA_TOOL_OPTIONS or JDK_JAVA_OPTIONS never appears on the command line, so a check that reads only process arguments under-reports coverage.
    Related MITRE Techniques: T1190
    Detection Difficulty: EASY
  • Runtimes bundled inside vendor products: software inventory lists the system JDK, but several of the named products ship their own Java runtime, so a host can report a patched system Java while the service runs an unpatched bundled copy.
    Related MITRE Techniques: T1190
    Detection Difficulty: MODERATE

Identity & Access Controls

Identity platforms cannot see the memory leak. They see the stolen material when someone uses it.

  • Tokens that applications accept but the identity provider never issued: Keycloak and PingFederate sign tokens with keys their JVM holds in memory. A copied signing key mints valid tokens with no matching issuance event, so the gap only shows when relying-party sign-ins are reconciled against the provider's own log.
    Related MITRE Techniques: T1212
    Detection Difficulty: HARD

Insights and Recommendation

A Java4Shell compromise hands the attacker the service account of whichever product they hit. On Keycloak or PingFederate that account holds the keys behind every login; on Jenkins and Artifactory it holds the credentials and packages that feed production builds. The heap leak works without code execution, so a host that only crashed has still had its memory exposed.

Patch first, in order of exposure: the six pre-auth products Calif names, then the post-auth list, then everything else running Java on x86-64. Update each to the November 17, 2026 OpenJDK or Oracle release and check the product's bundled runtime, not only the system JDK. Where a restart has to wait, start the JVM with -XX:-UseBASE64Intrinsics; Calif's alternative, -XX:UseAVX=2, works only on x86-64 and stops an ARM JVM from starting. Calif's /proc/cpuinfo check narrows the list, since a host missing any of the four flags is not affected. Calif also shows nginx request buffering failing against its Elasticsearch chain, so it is no stopgap.

Then hunt the same hosts for at least the last 30 days with the shell and crash-file queries below, and treat any Java service that spawned a shell or crashed without a known cause as compromised: rebuild it, then rotate what it held in memory, starting with Keycloak and PingFederate signing keys and the secrets stored in Jenkins and Artifactory. Build agents and tools that open TLS connections to outside servers need the same update, because the client-side path needs no inbound access at all.

Source and Credits

This summary is based on Calif's research article "Java4Shell: Write once, RCE everywhere," released with the coordinated OpenJDK and Oracle disclosure on November 17, 2026. Calif credits Quang Luong with the vulnerability research and write-up, Jenish Rakholiya with exploit improvements, and samczsun with the client-side exploit.

Threat Hunting IOCs & Queries

Calif's disclosure carries no network indicators or file hashes. It reports no attacks beyond Calif's own testing, and the product-specific chains stay private until users have upgraded, so the indicators below describe the flaw, its trigger and the configuration that blocks it.

Known Indicators of Compromise

  • Vulnerability: CVE-2026-114938, an out-of-bounds heap write in the OpenJDK HotSpot x86-64 Base64 decode intrinsic, scored 9.2 under CVSS 4.0 per Calif
  • Affected Runtimes: OpenJDK 17.0.6 or newer and builds derived from it (Amazon Corretto, Eclipse Temurin, Microsoft Build of OpenJDK, Azul Zulu, BellSoft Liberica, SAP SapMachine, Red Hat OpenJDK, Oracle OpenJDK, Oracle GraalVM for JDK); Oracle lists Java SE 8u511b33-perf, 17.0.21.0.3, 21.0.13.0.3, 25.0.5.0.3 and 27.0.1.0.3 as vulnerable
  • Affected Hardware: x86-64 CPUs with AVX-512 VBMI (Intel Xeon Ice Lake, Sapphire Rapids, Emerald Rapids and Granite Rapids; AMD EPYC and Ryzen Zen 4 or newer); ARM64 is not affected
  • Trigger Shape: 64 A characters followed by =, or 128 on OpenJDK 17, sent after repeated valid decodes; Calif lists =, ==, X=, XY= and === as tails that drive the output length negative
  • Mitigation Flags (configuration checks): -XX:-UseBASE64Intrinsics; -XX:UseAVX=2 (x86-64 only)

Unlike an IP list, nothing here goes stale on a rotation schedule. The trigger shape comes from the bug's arithmetic, so the payload hunt stays useful until the last affected runtime is patched, while the A run itself is only the proof-of-concept's filler and a tailored exploit will replace it. No darknet corroboration is attached: the CVE lookup was unavailable when this guide was written, and with no reported attacks there was no infrastructure to check.

JVM Fatal Error Logs on Java Service Hosts

Priority: Medium - the source names JVM crashes as a side effect of failed heap placement; Impact-stage tactic; Tier 1 file telemetry.
Behavior Targeted: Counts hs_err_pid*.log files created per host over 14 days and returns their paths, so a host with several fatal errors sorts to the top.
MITRE ATT&CK: T1499.004, T1190
Telemetry Required: Sysmon for Linux or Sysmon Event ID 11 feeding CIM Endpoint.Filesystem; DeviceFileEvents from Defender for Endpoint agents on either operating system.
Expected Results: One or more crash files on a Keycloak, Jira, Confluence, Artifactory, Jenkins or PingFederate host, especially several within hours. Open the log and check whether the faulting frame sits in compiled Base64 decoding code.
False Positive Likelihood: MEDIUM - memory exhaustion, native library faults and unrelated JDK bugs crash JVMs too, and developer workstations produce these files routinely.
Tuning Guidance: Restrict dest and DeviceName to server groups. One crash a quarter on a host is routine; three in a day is not. Widen the window to 30 days to catch slow retries.
Detection Difficulty: MODERATE - the file is easy to find, but telling an attack from an ordinary crash means reading the log.

Splunk SPL Query

| tstats summariesonly=false count min(_time) AS first_seen max(_time) AS last_seen
    from datamodel=Endpoint.Filesystem
    where earliest=-14d Filesystem.file_name="hs_err_pid*.log"
    by Filesystem.dest Filesystem.file_path Filesystem.file_name
| rename Filesystem.* AS *
| stats sum(count) AS crash_logs dc(file_name) AS distinct_crashes min(first_seen) AS first_seen max(last_seen) AS last_seen values(file_path) AS paths by dest
| sort - distinct_crashes
| convert ctime(first_seen) ctime(last_seen)

Microsoft KQL Query (Defender/Sentinel)

DeviceFileEvents
| where Timestamp > ago(14d)
| where ActionType == "FileCreated"
| where FileName startswith "hs_err_pid" and FileName endswith ".log"
| summarize CrashLogs = count(), FirstSeen = min(Timestamp), LastSeen = max(Timestamp),
    Paths = make_set(FolderPath, 10), Writers = make_set(InitiatingProcessCommandLine, 5)
    by DeviceName
| order by CrashLogs desc

Outbound Connections From Java to Rarely Contacted Public Addresses

Priority: Medium - Command and Control impact and Tier 1 telemetry, but inferred follow-on activity that Calif does not describe.
Behavior Targeted: Groups connections that the java binary opens to public addresses by destination, keeping addresses that only one host reached, fewer than 20 times, in seven days.
MITRE ATT&CK: T1105
Telemetry Required: Sysmon for Linux Event ID 3 (sysmon:linux) or Sysmon Event ID 3 on Windows, with network events enabled in the Sysmon configuration; DeviceNetworkEvents from Microsoft Defender for Endpoint.
Expected Results: A single application server reaching a hosting or residential address on an unusual port, close in time to a crash file or shell event from the other queries.
False Positive Likelihood: HIGH - Jenkins plugin updates, Artifactory remote repositories, license checks and webhooks all reach new addresses legitimately.
Tuning Guidance: Exclude known repository and update destinations by IP or RemoteUrl, lower the connection ceiling, and run it first against hosts that appear in the shell or crash-file results.
Detection Difficulty: HARD - Java services talk outbound constantly, so this works best as a pivot from another hit.

Splunk SPL Query

index=* earliest=-7d EventID=3
    (sourcetype="sysmon:linux" OR source="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational")
    (Image="*/java" OR Image="*\\java.exe")
| where NOT (cidrmatch("10.0.0.0/8", DestinationIp) OR cidrmatch("172.16.0.0/12", DestinationIp) OR cidrmatch("192.168.0.0/16", DestinationIp) OR cidrmatch("127.0.0.0/8", DestinationIp))
| stats count min(_time) AS first_seen max(_time) AS last_seen dc(Computer) AS host_count values(Computer) AS hosts values(DestinationPort) AS ports by DestinationIp
| where host_count=1 AND count < 20
| sort - last_seen
| convert ctime(first_seen) ctime(last_seen)

Microsoft KQL Query (Defender/Sentinel)

DeviceNetworkEvents
| where Timestamp > ago(7d)
| where InitiatingProcessFileName in~ ("java", "java.exe")
| where ActionType == "ConnectionSuccess"
| where RemoteIPType == "Public"
| summarize Connections = count(), FirstSeen = min(Timestamp), LastSeen = max(Timestamp),
    HostCount = dcount(DeviceName), Hosts = make_set(DeviceName, 5),
    Ports = make_set(RemotePort, 10), Urls = make_set(RemoteUrl, 5)
    by RemoteIP
| where HostCount == 1 and Connections < 20
| order by LastSeen desc

Shells and Download Tools Spawned by a Java Service

Priority: Medium - the code execution outcome Calif demonstrates; behavior-level durability; Tier 1 telemetry that is rarely benign outside build servers.
Behavior Targeted: Lists launches whose parent is java or java.exe and whose image is a shell, download tool, scripting interpreter or identity command, grouped by host, account and full command line.
MITRE ATT&CK: T1059, T1190
Telemetry Required: Sysmon for Linux Event ID 1, or Sysmon Event ID 1 on Windows, feeding CIM Endpoint.Processes; DeviceProcessEvents from Microsoft Defender for Endpoint.
Expected Results: The service account of Jira, Confluence, Keycloak or PingFederate running id, whoami or uname, or curl and wget pulling from an external URL, with a parent command line that names the product's own jar.
False Positive Likelihood: MEDIUM - Jenkins build steps, Elasticsearch and Solr helper scripts, and vendor startup wrappers launch shells under Java.
Tuning Guidance: Exclude Jenkins build agents by host or by a parent command line containing remoting.jar or agent.jar, but keep the Jenkins controller in scope, since it is on Calif's pre-auth list.
Detection Difficulty: EASY - on most product hosts a single result is worth a call to the application owner.

Splunk SPL Query

| tstats summariesonly=false count min(_time) AS first_seen max(_time) AS last_seen
    from datamodel=Endpoint.Processes
    where earliest=-7d Processes.parent_process_name IN ("java", "java.exe")
        Processes.process_name IN ("sh", "bash", "dash", "zsh", "curl", "wget", "nc", "ncat", "python3", "perl", "id", "whoami", "uname", "cmd.exe", "powershell.exe")
    by Processes.dest Processes.user Processes.parent_process Processes.process_name Processes.process
| rename Processes.* AS *
| sort - last_seen
| convert ctime(first_seen) ctime(last_seen)

Microsoft KQL Query (Defender/Sentinel)

DeviceProcessEvents
| where Timestamp > ago(7d)
| where InitiatingProcessFileName in~ ("java", "java.exe")
| where FileName in~ ("sh", "bash", "dash", "zsh", "curl", "wget", "nc", "ncat", "python3", "perl", "id", "whoami", "uname", "cmd.exe", "powershell.exe")
| summarize Count = count(), FirstSeen = min(Timestamp), LastSeen = max(Timestamp)
    by DeviceName, AccountName, InitiatingProcessCommandLine, FileName, ProcessCommandLine
| order by LastSeen desc

Java Processes Started Without the Base64 Intrinsic Mitigation

Priority: Medium - an exposure list for the T1190 entry point, built from Tier 1 process telemetry.
Behavior Targeted: Collects Java launches from the last 30 days whose command line carries neither -XX:-UseBASE64Intrinsics nor -XX:UseAVX=2, one row per host.
MITRE ATT&CK: T1190
Telemetry Required: Sysmon for Linux or Sysmon Event ID 1 mapped to CIM Endpoint.Processes; DeviceProcessEvents from Microsoft Defender for Endpoint.
Expected Results: Every host still starting Java without either flag. Clear a host from the list once it runs the November 17 release or lacks one of the four CPU flags.
False Positive Likelihood: HIGH by design - this is an exposure inventory, not an alert. Patched hosts, ARM hosts and CPUs without AVX-512 VBMI appear until inventory data clears them, and flags set through JAVA_TOOL_OPTIONS or JDK_JAVA_OPTIONS are invisible here.
Tuning Guidance: Join the host list with JDK versions from software inventory, start with internet-facing hosts, and rerun weekly until the list is empty.
Detection Difficulty: EASY - the command line is logged at every launch.

Splunk SPL Query

| tstats summariesonly=false count min(_time) AS first_seen max(_time) AS last_seen
    from datamodel=Endpoint.Processes
    where earliest=-30d Processes.process_name IN ("java", "java.exe")
    by Processes.dest Processes.process
| rename Processes.* AS *
| where NOT (like(process, "%-XX:-UseBASE64Intrinsics%") OR like(process, "%-XX:UseAVX=2%"))
| stats sum(count) AS launches max(last_seen) AS last_seen dc(process) AS distinct_command_lines by dest
| sort dest
| convert ctime(last_seen)

Microsoft KQL Query (Defender/Sentinel)

DeviceProcessEvents
| where Timestamp > ago(30d)
| where FileName in~ ("java", "java.exe")
| where not(ProcessCommandLine contains "-XX:-UseBASE64Intrinsics" or ProcessCommandLine contains "-XX:UseAVX=2")
| summarize Launches = count(), LastSeen = max(Timestamp), DistinctCommandLines = dcount(ProcessCommandLine)
    by DeviceName
| order by DeviceName asc

Published Trigger Shape in Web and WAF Request URLs

Priority: Medium - Initial Access; a pattern taken from the published trigger; Tier 2 web telemetry.
Behavior Targeted: Searches request URLs for a run of at least 64 A characters followed by = or its URL-encoded form %3D, the shape of Calif's proof-of-concept input.
MITRE ATT&CK: T1190
Telemetry Required: Web server, reverse proxy or WAF logs normalized to CIM Web; CommonSecurityLog from a WAF or load balancer forwarding CEF to Microsoft Sentinel.
Expected Results: Scanners and copied proof-of-concept code probing login, single sign-on or upload endpoints, often from one source in a burst.
False Positive Likelihood: LOW - Base64 of zero-filled data also produces long A runs, but rarely ends in padding at this length inside a URL.
Tuning Guidance: A tailored exploit replaces the A run with heap-grooming data, so this catches scanners, not every attack. A broader WAF rule follows from the trigger tails Calif lists: valid Base64 has a length divisible by four, and 64 characters plus =, ==, X=, XY= or === never is, so alert on Base64 fields over 64 characters that end in = with a length not divisible by four. Logs that omit bodies and headers miss POST and Authorization delivery entirely.
Detection Difficulty: HARD - the payload usually travels where access logs do not look.

Splunk SPL Query

| tstats summariesonly=false count min(_time) AS first_seen max(_time) AS last_seen
    from datamodel=Web.Web
    where earliest=-7d Web.url="*AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA*"
    by Web.src Web.dest Web.http_method Web.url Web.status
| rename Web.* AS *
| where match(url, "A{64,}(=|%3D)")
| stats sum(count) AS requests min(first_seen) AS first_seen max(last_seen) AS last_seen values(url) AS urls by src, dest
| sort - requests
| convert ctime(first_seen) ctime(last_seen)

Microsoft KQL Query (Defender/Sentinel)

CommonSecurityLog
| where TimeGenerated > ago(7d)
| where RequestURL contains "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
| where RequestURL matches regex @"A{64,}(=|%3D)"
| summarize Requests = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated),
    Urls = make_set(RequestURL, 5)
    by SourceIP, DestinationHostName, DeviceVendor, DeviceProduct
| order by Requests desc

Note: These queries were generated with AI assistance and are a starting point for threat hunting and detection rule considerations.

Back to Hunting off the Red