Tag: movies

Detecting Java4Shell: 4 Sigma rules for trigger-shaped headers and JVM crashes

Detecting Java4Shell: 4 Sigma rules for trigger-shaped headers and JVM crashes

Java4Shell is an awkward bug to detect. There are no IOCs, no exploit in the wild as of November 18, 2026, and the vulnerable code is not in any application you could put a WAF signature in front of: it is hand-written assembly inside the JVM’s JIT compiler. It is reached when attacker input goes to the java.util.Base64 basic or URL decoder after C2 has compiled it, on a CPU with AVX-512 VBMI. The patch is the answer. Detection is what tells you whether someone got there first, or is trying to knock your SSO server over while you wait for a maintenance window.

If you want the bug first, read my analysis of Java4Shell (CVE-2026-114938). This post is the detection side: four behaviour-based Sigma rules, the telemetry each one needs, tuning, safe tests, a correlation for “decode errors, then a crash”, corrected inventory and crash-log commands, and a plain list of what none of it can see.

At a glance

  • Rules: 4 (one high, three medium). No IOC rules, because no IOCs have been published.
  • Domains: Web/App (two header rules and one JVM output rule) and Cross-Platform (crash-log file creation on Windows and Linux).
  • Log sources you need: a WAF, reverse proxy or API gateway that can inspect the Authorization header (not logged by default, and for good reason), file creation events on Java hosts (Sysmon EID 11 or an EDR), and the stdout of Java services (journald, container and pod logs).
  • ATT&CK: T1190 Exploit Public-Facing Application, T1499.004 Endpoint Denial of Service: Application or System Exploitation.
  • Status: three rules are test because the behaviour they match is confirmed by Calif, VulnCheck or Oracle’s documentation; the JWT rule is experimental because it rests on reasoning, not observed traffic.
  • YAML: Detection Rules repo on GitHub (Web-App and Cross-Platform folders).

The case in brief

On x86-64 CPUs with AVX-512 VBMI, HotSpot’s C2 compiler replaces hot java.util.Base64 decode calls with a vectorised routine. Calif found that this routine miscounts = padding: the remaining-length counter drops below zero, the store mask becomes “all lanes”, and 62 bytes land past the end of the output array. The decoder then throws an ordinary IllegalArgumentException (in OpenJDK’s source, the message is “Input byte array has wrong 4-byte ending unit”), so the application sees bad input while its heap is already damaged.

Three facts matter for detection. Warming the decoder with valid input looks like normal traffic. The trigger is Base64 ending in padding just past a 64-character block, an impossible length for valid Base64. And short of a finished chain, the outcome is a crash: VulnCheck says a burst of requests reliably brought a service down, and Calif says failed grooming can crash the JVM. Routes include Basic headers, JWTs, body fields, WebSocket frames and a client-side TLS case (Calif, Equixly, HeroDevs). The full chain is in the analysis.

Detection map

Block diagram: WAF or proxy logs, file creation events and Java service output feed four Sigma rules (Basic auth impossible padding, JWT with padding, hs_err_pid log created, fatal error banner) mapped to T1190 and T1499.004, with body, WebSocket and TLS routes and post-exploitation marked as gaps.
Three telemetry sources, four rules. The input is caught at the edge, the crash on the host.

Two rules read the Authorization header for input no honest client sends. Two catch the JVM crashing, once as a file on disk and once as the header it prints to standard output. The red boxes are the gaps: Base64 in bodies, WebSocket frames and the TLS client route never reach a standard log, and SigmaHQ already covers post-exploitation.

Rule overview

RuleDomainLog sourceATT&CK (tactic / technique)LevelStatus
Basic Authorization with impossible Base64 paddingWeb/Appwebserver (WAF, proxy)Initial Access, Impact / T1190, T1499.004Hightest
JWT Bearer token containing paddingWeb/Appwebserver (WAF, proxy)Initial Access, Impact / T1190, T1499.004Mediumexperimental
JVM fatal error log hs_err_pid createdCross-Platformfile_eventImpact, Initial Access / T1499.004, T1190Mediumtest
JVM fatal error banner in application outputWeb/Appjvm / applicationImpact, Initial Access / T1499.004, T1190Mediumtest

Sigma has no standard field for request headers, so the header rules use cs-authorization. Map it to your WAF’s field, or better, run the logic in the WAF and log only the match.

The rules

Basic Authorization with impossible Base64 padding

Context: the HTTP Basic header is the most widely reachable pre-auth route. Equixly says Spring Security decodes it with java.util.Base64 before any password check, and HeroDevs adds Jetty’s BasicAuthenticator and Tomcat’s BasicAuthenticator (9.0.89 and later, 10.1.23 and later) as routes. Equixly suggested flagging invalid padding here. This is the rule I would turn on first.

Condition: alert when a Basic credential has at least 32 Base64 characters, ends in one or two =, and its total length is not a multiple of four. Padded Base64 from any real encoder always is, so this matches only hand-built or corrupted values. The regular expression spells out the four invalid cases (zero, one, two or three characters after the last full block, combined with the wrong amount of padding). I tested it offline against valid encodings of 1 to 79 bytes (no match) and every combination of 28 to 139 characters with one or two =. The 32-character floor follows Equixly’s note that Java 21 and 25 need more than 31 bytes of input to reach the vulnerable path (Java 17 needs more than 128).

ATT&CK: Initial Access (TA0001) – T1190 Exploit Public-Facing Application; Impact (TA0040) – T1499.004 Endpoint Denial of Service: Application or System Exploitation.

title: Java4Shell Trigger Shape - Basic Authorization With Impossible Base64 Padding
id: 9dc30520-911b-44ef-a532-16ff2ef66e47
name: java4shell_basic_auth_impossible_padding
status: test
description: |
Detects HTTP Basic Authorization values of 32 or more Base64 characters that end in '=' padding but whose
total length is not a multiple of four, which no valid encoder produces. This is the input shape that
triggers the CVE-2026-114938 (Java4Shell) heap overflow in the HotSpot AVX-512 Base64 decode intrinsic.
references:
- https://calif.io/java4shell/
- https://equixly.com/blog/2026/11/17/cve-2026-114938-pre-auth-heap-overflow-in-java-17-21-and-25/
- https://www.vulncheck.com/blog/java4shell
- https://netsec101.com/?p=326
author: netsec101.com
date: 2026-11-18
tags:
- attack.initial-access
- attack.impact
- attack.t1190
- attack.t1499.004
- cve.2026-114938
- detection.emerging-threats
logsource:
category: webserver
definition: 'Requirement: a WAF, reverse proxy or API gateway that can inspect the Authorization request header, mapped to the field cs-authorization. Access logs do not record this header by default, and storing Basic credentials in a SIEM is a risk in itself: prefer running this logic inside the WAF and logging only the verdict.'
detection:
selection_impossible_padding:
cs-authorization|re: '^[Bb][Aa][Ss][Ii][Cc] +(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]?={1,2}|[A-Za-z0-9+/]{2}=|[A-Za-z0-9+/]{3}==)$'
selection_min_length:
cs-authorization|re: '^[Bb][Aa][Ss][Ii][Cc] +[A-Za-z0-9+/]{32}'
condition: all of selection_*
falsepositives:
- Vulnerability scanners and fuzzers that send malformed Basic credentials
- Broken clients that truncate or hand-build the header (rare; baseline first)
level: high

View on GitHub

False positives and tuning: exclude authorised scanners by source address, and baseline a week in alert-only mode. The bigger issue is privacy: a Basic header is a username and password in Base64, so do not start shipping it to your SIEM. Most WAFs can run a regex on a header and log only the rule ID; if yours cannot, a length check plus “ends with =” gets most of the value.

How to test: in a test index, write a synthetic WAF log line whose header is a valid Basic value with 32 or more data characters before its == padding, with one = deleted. That value has an impossible length and should match; the unedited value should not. Do not send trigger-shaped input to a real JVM, even in staging, unless it is a box you are happy to crash.

JWT Bearer token containing Base64 padding

Context: libraries that decode JWT segments with Base64.getUrlDecoder(), such as Auth0 java-jwt, reach the flawed decoder (Equixly, HeroDevs). Jackson, Commons Codec, JJWT and Nimbus use their own decoders and do not. Equixly points out that JWT segments are encoded without padding, so a JWT containing = is malformed by definition, and the trigger needs a padding character.

Condition: alert when the Authorization header holds a Bearer token shaped like a JWT (three dot-separated base64url segments, the first starting with eyJ, which is how a JSON header starting with a brace encodes) and the value contains an =. This one is experimental: the logic is sound, but nobody has shown which product’s JWT route is exploitable this way.

ATT&CK: Initial Access (TA0001) – T1190 Exploit Public-Facing Application; Impact (TA0040) – T1499.004 Endpoint Denial of Service: Application or System Exploitation.

title: Java4Shell Trigger Shape - JWT Bearer Token Containing Base64 Padding
id: a176c9f0-eb2f-4c07-a9c0-aa016d23a82e
name: java4shell_jwt_bearer_with_padding
status: experimental
description: |
Detects Bearer tokens shaped like a JWT (three dot-separated base64url segments starting with eyJ) that
contain an '=' character. JWT segments are encoded without padding, and the CVE-2026-114938 (Java4Shell)
trigger needs a padding character, so padding inside a JWT may be an attempt to reach the flawed decoder.
references:
- https://equixly.com/blog/2026/11/17/cve-2026-114938-pre-auth-heap-overflow-in-java-17-21-and-25/
- https://www.herodevs.com/blog-posts/java4shell-cve-2026-114938-spring-boot-tomcat-jetty
- https://calif.io/java4shell/
- https://netsec101.com/?p=326
author: netsec101.com
date: 2026-11-18
tags:
- attack.initial-access
- attack.impact
- attack.t1190
- attack.t1499.004
- cve.2026-114938
- detection.emerging-threats
logsource:
category: webserver
definition: 'Requirement: a WAF, reverse proxy or API gateway that can inspect the Authorization request header, mapped to the field cs-authorization. Not logged by default; tokens in logs are secrets, so prefer evaluating this in the WAF.'
detection:
selection_jwt_shape:
cs-authorization|re: '^[Bb][Ee][Aa][Rr][Ee][Rr] +eyJ[A-Za-z0-9_=-]+\.[A-Za-z0-9_=-]+\.[A-Za-z0-9_=-]*$'
selection_padding:
cs-authorization|contains: '='
condition: all of selection_*
falsepositives:
- Non-compliant token issuers or clients that pad base64url segments (verify against your identity provider)
- Security testing and fuzzing of API authentication
level: medium

View on GitHub

False positives and tuning: check your own identity provider and API clients first. A non-compliant issuer that pads its segments would fire on every request, which you will see on day one. JWTs also travel in cookies and query strings; if your applications accept them there, copy the logic to those fields. JWE tokens have five segments and are not matched.

How to test: take a token from a development tenant, add a single = to the end of its payload segment in a synthetic log line, and check that only the edited line matches.

JVM fatal error log hs_err_pid created

Context: when HotSpot crashes it writes a fatal error log named hs_err_pid<pid>.log. Oracle’s troubleshooting guide says it goes to the process working directory, falling back to /tmp on Linux or the TMP/TEMP directory on Windows, unless -XX:ErrorFile moves it. HeroDevs recommends looking for these files since November 17, 2026. Equixly adds that the log will probably not mention Base64, because the corrupted object is usually noticed later, typically by the garbage collector. So the rule does not try to read the content.

Condition: alert when a file whose name is hs_err_pid, a number and .log is created in any directory, on Windows or Linux. There is no product in the log source on purpose, so one rule covers both.

ATT&CK: Impact (TA0040) – T1499.004 Endpoint Denial of Service: Application or System Exploitation; Initial Access (TA0001) – T1190 Exploit Public-Facing Application (a crash can be a failed exploitation attempt).

title: JVM Fatal Error Log hs_err_pid Created
id: 6d8a889e-1a29-4c85-997f-2504dec3eed4
name: jvm_hs_err_pid_crash_log_created
status: test
description: |
Detects creation of a HotSpot fatal error log (hs_err_pid<pid>.log), which the JVM writes when it crashes.
Failed CVE-2026-114938 (Java4Shell) heap grooming and bursts of trigger input crash the JVM, so a new crash
log on an internet-facing Java service running on AVX-512 hardware deserves a look.
references:
- https://calif.io/java4shell/
- https://www.vulncheck.com/blog/java4shell
- https://www.herodevs.com/blog-posts/java4shell-cve-2026-114938-spring-boot-tomcat-jetty
- https://docs.oracle.com/en/java/javase/21/troubleshoot/fatal-error-log.html
- https://netsec101.com/?p=326
author: netsec101.com
date: 2026-11-18
tags:
- attack.impact
- attack.initial-access
- attack.t1499.004
- attack.t1190
- cve.2026-114938
logsource:
category: file_event
definition: 'Requirement: file creation telemetry (Sysmon EID 11 on Windows, Sysmon for Linux EID 11 or an EDR on Linux). Sysmon for Linux file events need an explicit config. Containers: the EDR must see inside the container file system, and the file is lost when the pod restarts.'
detection:
selection:
TargetFilename|re: '[\\/]hs_err_pid[0-9]+\.log$'
condition: selection
falsepositives:
- Ordinary JVM crashes from native code, out-of-memory in native allocations or JDK bugs
- Developers and CI jobs crashing JVMs on build agents (scope to production service hosts)
- Custom -XX:ErrorFile names are not matched; add them if you set one
level: medium

View on GitHub

False positives and tuning: JVMs crash for dull reasons too: native libraries, JDK bugs, bad memory. Scope the rule to production service hosts and drop build agents and developer machines. Then raise the priority where the host is internet-facing and its CPU has AVX-512 VBMI (Ice Lake or newer Xeon, Zen 4 or newer AMD); a crash on a Graviton box is not Java4Shell. If you set a custom -XX:ErrorFile, add that pattern. In Kubernetes the file disappears with the container, which is why the next rule exists.

How to test: with file-event telemetry on, run touch /tmp/hs_err_pid99999.log on Linux or New-Item "$env:TEMP\hs_err_pid99999.log" on Windows, then delete the file.

JVM fatal error banner in application output

Context: the same crash also prints a header to standard output. Oracle’s troubleshooting guide says the header of the fatal error log is also printed to standard output, and its first line is “A fatal error has been detected by the Java Runtime Environment”. In containers, stdout is the one thing almost everyone already collects, and it survives the restart that wipes the hs_err file.

Condition: alert when that sentence appears in the output of a Java service. It is the only header text I match on, because it is the one I could confirm in Oracle’s documentation.

ATT&CK: Impact (TA0040) – T1499.004 Endpoint Denial of Service: Application or System Exploitation; Initial Access (TA0001) – T1190 Exploit Public-Facing Application.

title: JVM Fatal Error Banner In Application Output
id: 988ead27-6a7c-477b-9c70-4d77dcdd6b4a
name: jvm_fatal_error_banner_in_output
status: test
description: |
Detects the HotSpot fatal error header that the JVM prints to standard output when it crashes. It catches
crashes where the hs_err_pid file is lost, such as containers that restart, and is a signal for failed
CVE-2026-114938 (Java4Shell) exploitation or trigger-based denial of service.
references:
- https://docs.oracle.com/en/java/javase/21/troubleshoot/fatal-error-log.html
- https://calif.io/java4shell/
- https://www.vulncheck.com/blog/java4shell
- https://netsec101.com/?p=326
author: netsec101.com
date: 2026-11-18
tags:
- attack.impact
- attack.initial-access
- attack.t1499.004
- attack.t1190
- cve.2026-114938
logsource:
product: jvm
category: application
definition: 'Requirement: the stdout/stderr of Java services collected into the SIEM (systemd journal, container runtime logs, Kubernetes pod logs or the application console log such as catalina.out).'
detection:
keywords:
- 'A fatal error has been detected by the Java Runtime Environment'
condition: keywords
falsepositives:
- Ordinary JVM crashes unrelated to Java4Shell (native libraries, JDK bugs, hardware faults)
level: medium

View on GitHub

False positives and tuning: the same dull crashes as the previous rule, with the same scoping. Two signals sit around it that are worth adding in your SIEM: a container that exits with code 134 (128 plus SIGABRT, which is how a crashing JVM usually ends) and a systemd unit whose main process exited with code=dumped. Both say “this service died hard” without depending on log text.

How to test: print the sentence from a throwaway container or systemd unit whose output you collect, for example echo '# A fatal error has been detected by the Java Runtime Environment:', and check that the rule fires with the right host and service fields.

Correlation: trigger header, then a crash

The pattern I would really alert on is a burst of trigger-shaped input followed by the JVM going down. Most applications swallow the decode exception and return a 400 or 401 without logging it, so the “decode error spike” has to come from the edge rule. Below is a Sigma temporal correlation that joins the Basic header rule and the banner rule on the same backend within 15 minutes. It is an example, not a shipped rule: my validator only handles single rules and I could not run sigma check on it. The alias matters because the proxy’s host field is the virtual host the client asked for, not the machine the JVM runs on, so map backend to an upstream or asset field you actually have.

title: Java4Shell Trigger Header Followed By JVM Crash On The Same Backend
id: 8abecdac-41af-4776-8989-f82a3fa39368
status: experimental
correlation:
type: temporal
rules:
- java4shell_basic_auth_impossible_padding
- jvm_fatal_error_banner_in_output
aliases:
backend:
java4shell_basic_auth_impossible_padding: upstream-host
jvm_fatal_error_banner_in_output: Hostname
group-by:
- backend
timespan: 15m
level: high

The field names upstream-host and Hostname are placeholders: replace them with your own. If you have no edge visibility, a weaker version of the same idea is a spike of 400 or 401 responses from one client address in your access logs, followed by a crash rule firing on that backend.

Retro-hunt and inventory commands, corrected

The draft commands that went around on disclosure day mostly work, with two traps. find / -xdev stays on the root file system, so it misses /var, /opt, /home or /tmp when they are separate mounts, which is common on servers. And java -XX:+PrintFlagsFinal -version starts a fresh JVM from your PATH; it says nothing about the flags of the service that is already running. Here are the versions I would use, on Linux, run inside the container when the JVM lives in one:

# JVM crash logs since October 18, 2026, on all mounted file systems
# (without -xdev this includes network mounts; prune them if that is slow)
find / \( -path /proc -o -path /sys \) -prune -o -type f -name 'hs_err_pid*.log' -newermt '2026-10-18' -print 2>/dev/null
# Was a custom crash-log location set for this JVM?
tr '\0' '\n' < /proc/<PID>/cmdline | grep ErrorFile
# CPU gate: prints 4 when avx512f, avx512bw, avx512vbmi and bmi2 are all present
grep -m1 '^flags' /proc/cpuinfo | tr ' ' '\n' | grep -cE '^(avx512f|avx512bw|avx512vbmi|bmi2)$'
# Is the workaround set on the running process?
tr '\0' '\n' < /proc/<PID>/cmdline | grep -E 'UseBASE64Intrinsics|UseAVX'
tr '\0' '\n' < /proc/<PID>/environ | grep JAVA_TOOL_OPTIONS
jcmd <PID> VM.flags | tr ' ' '\n' | grep -E 'UseBASE64Intrinsics|UseAVX'

Why about a month and not just since disclosure? The vulnerable intrinsic shipped in 17.0.6 in January 2023, Wiz says its tooling had an exploit before full disclosure, and you need a baseline of how often your JVMs crash anyway. jcmd must run as the same user as the JVM and ships only with a full JDK. As for the fix: the Oracle builds that Tenable and HeroDevs report (17.0.21.1, 21.0.13.1, 25.0.5.1, 27.0.1.1 and 8u513-perf) are still unverified, because Oracle’s own page returned HTTP 403 when I tried it. Confirm the version in your vendor’s release notes before you close a ticket on it.

Coverage and gaps

Step in caseTacticTechniqueRuleCovered?
Trigger via Basic auth headerInitial Access (TA0001)T1190Basic impossible paddingYes, if the header is inspected
Trigger via JWTInitial Access (TA0001)T1190JWT with paddingYes, if the header is inspected
Trigger via body field, WebSocket frame or outbound TLSInitial Access (TA0001)T1190–Gap: not in standard logs
Warming the decoder–––Gap: looks like normal traffic
JVM crash, denial of serviceImpact (TA0040)T1499.004hs_err_pid created, fatal error bannerYes
Memory disclosure to beat ASLR–––Gap: product-specific, unpublished
Code execution and what followsExecution (TA0002)T1059.004SigmaHQ Java child-process rulesPartial, not mine

The biggest blind spot is an exploit that never crashes. If the heap grooming works first time, the only evidence before code execution is the trigger, and only if it came in a header you inspect. After that, Java4Shell looks like any Java web RCE, and SigmaHQ’s “Suspicious Java Children Processes” (Linux, Nasreddine Bencherchali, 2022) and “Shell Process Spawned by Java.EXE” (Windows) already cover a JVM starting shells; expect noise from Jenkins controllers that build on the built-in node. Closing the payload gaps needs body inspection in a WAF or a network sensor. VulnCheck’s Snort and Suricata rules are customer-only, so I cannot judge them.

Deploying the rules

Grab the YAML from the repo and convert it with sigma-cli. I have not run these conversions (sigma-cli is not installed where I built the rules), so treat the commands below as untested starting points. The pipeline has to match the log source, and none of these rules fits a stock pipeline cleanly: the header rules use a field you map yourself, the banner rule is a keyword search, and the crash-log rule has no product, so you may need to add product: windows or product: linux to a copy before an OS-specific pipeline will accept it:

# Untested. Crash log: no pipeline, then map TargetFilename to your file-event field
sigma convert -t splunk --without-pipeline file_event_java_hs_err_pid_crash_log_created.yml
# Untested. Fatal error banner: keyword search over your container or journald index
sigma convert -t splunk --without-pipeline java_jvm_fatal_error_banner_in_output.yml
# Untested. Header rules: map cs-authorization to your WAF field first
sigma convert -t splunk --without-pipeline web_cve_2026_114938_java4shell_basic_auth_impossible_padding.yml

Check the generated regex by hand for your backend, since regex dialects differ between SIEMs and I have not tested any of them with these patterns. If yours rejects the non-capturing groups or the anchors, rewrite the expression in its dialect and test it against a valid and an invalid header. Run everything in alert-only mode for a week, look at what fires, then decide what pages someone.

My take

Java4Shell is more detectable than its name suggests, but only at the two ends. The input has a shape no legitimate client produces, and the most likely outcome of a failed or sloppy attempt is a crash, which every runtime announces loudly. The middle, a careful attacker who warms the decoder and lands the exploit first time, is close to invisible. That makes the crash rules the ones I would deploy today on every Java host, and not only for this CVE: an unexplained JVM crash on an internet-facing identity provider has deserved a ticket for years.

If I could ask one thing of the frameworks, it would be a log line. As far as I can tell, Spring Security, Tomcat and Jetty treat a malformed Basic header as a failed login and answer 401 without logging anything at default levels. One WARN-level event with the source address for “credential header failed to decode” would have turned this bug, and the next parser bug, into a one-line SIEM rule. Until then, put the header check in your WAF, watch for crashes, and patch.

Sources