
Java4Shell (CVE‑2026‑114938): Pre‑Auth RCE in Jira, Jenkins & Fixes
CVE‑2026‑114938 (Java4Shell) lets unauthenticated attackers run commands on Jira, Jenkins, Keycloak and other Java apps. Learn the flaw and how to fix it.
Also available in: Español
Overview of the Java4Shell Vulnerability (CVE‑2026‑114938)
The security community identified a critical flaw in the Java runtime that has been dubbed Java4Shell. Assigned the identifier CVE‑2026‑114938, this vulnerability permits an attacker to execute arbitrary operating‑system commands without prior authentication. Because the flaw resides in a core component of the Java platform – the scripting engine that powers the javax.script API – any Java‑based service that exposes this API to untrusted input becomes a potential entry point for remote code execution (RCE).
Why pre‑authentication matters
Most traditional RCE bugs require the attacker to be logged in, possess a valid session token, or otherwise have some level of access to the target system. Java4Shell bypasses these requirements entirely. An attacker can send a specially crafted HTTP request to a vulnerable endpoint, trigger the scripting engine, and immediately gain a shell on the host. The impact is amplified when the vulnerable software runs with elevated privileges, as is common for CI/CD servers, issue‑tracking platforms, and identity providers.
Scope of the problem
Since the vulnerability is tied to a standard Java library, the attack surface is broad. Vendors that embed the affected Java version in their products – including Atlassian Jira, Jenkins, and Red Hat Keycloak – have reported successful exploitation in the wild. The flaw also affects custom‑built applications that use the scripting API without proper input sanitisation.
“Java4Shell demonstrates how a seemingly innocuous scripting API can become a gateway for unauthenticated code execution.” – Security Researcher, Insanen Labs
Technical Mechanics of the Flaw
Root cause in the Java Scripting Engine
The javax.script package provides a way for Java applications to evaluate scripts written in languages such as JavaScript (via the Nashorn engine) or Groovy. In the vulnerable Java version, the engine fails to enforce a strict security manager when evaluating scripts that originate from HTTP parameters. Specifically, the ScriptEngine.eval() method is invoked with user‑supplied data without a sandbox, allowing the script to call java.lang.Runtime.getRuntime().exec() directly.
How the payload is constructed
An attacker crafts a request that includes a script payload in a query string, header, or POST body. The payload typically looks like new java.lang.ProcessBuilder("/bin/sh","-c","whoami").start(). When the vulnerable endpoint passes this string to eval(), the Java runtime spawns a new process, executing the supplied command with the same privileges as the Java process itself.
Why traditional mitigations fail
Many organisations rely on network‑level firewalls or application‑level authentication to block unauthenticated traffic. Because Java4Shell does not require any authentication token, these controls are ineffective once the vulnerable endpoint is reachable. Moreover, the vulnerability does not manifest as a classic injection (e.g., SQL) that can be filtered with a simple regex; it leverages a legitimate API call.
Affected Products and Real‑World Impact
Jira Server and Data Center
Jira’s REST endpoints for issue creation and comment handling invoke the scripting engine to support dynamic field rendering. An unauthenticated attacker can send a crafted /rest/api/2/issue request containing a malicious script, leading to full command execution on the application server. In many deployments, Jira runs as the jira user with sudo privileges, enabling privilege escalation.
Jenkins Continuous Integration
Jenkins plugins that allow users to define build steps using Groovy scripts are particularly vulnerable. The /script endpoint, intended for administrators, was inadvertently exposed without authentication in certain configurations. Exploiting Java4Shell via this endpoint grants the attacker the ability to spawn build agents, pull source code, and exfiltrate credentials stored in Jenkins.
Keycloak Identity Provider
Keycloak uses the scripting engine to evaluate custom authentication flows. An attacker can target the /auth/realms/{realm}/protocol/openid-connect/token endpoint, embedding a script in the grant_type parameter. Successful exploitation yields a shell on the authentication server, compromising all federated applications that rely on the same Keycloak instance.
Other Java‑based services
Any Java application that accepts user input and forwards it to ScriptEngine.eval() – including internal dashboards, microservice orchestrators, and legacy enterprise tools – is at risk. Because the vulnerability is present in the underlying JDK, even applications that do not explicitly use scripting can be affected if a third‑party library does.
Exploitation Flow
Step‑by‑step attack scenario
1. Reconnaissance: The attacker scans public IP ranges for services exposing known Jira, Jenkins, or Keycloak endpoints.
2. Endpoint verification: A simple HTTP GET to /status or /login confirms the presence of the target application.
3. Payload delivery: The attacker sends a POST request to the vulnerable endpoint with a script payload that invokes Runtime.exec() or ProcessBuilder.start().
4. Command execution: The Java process spawns a shell, allowing the attacker to run commands such as whoami, id, or curl to download additional malware.
5. Persistence: The attacker may install a backdoor, create a new system user, or modify startup scripts to retain access.
6. Privilege escalation: If the Java process runs as a privileged system user, the attacker can leverage sudo or set‑uid binaries to gain root.
Detection and Indicators of Compromise
Detecting Java4Shell activity requires a combination of log analysis and behavioural monitoring. Key indicators include:
Unexpected
java.lang.ProcessBuilderorRuntime.execcalls in application logs.Outbound network connections from the Java process to unknown IP addresses shortly after a request to a public endpoint.
New files or scripts created in temporary directories (e.g.,
/tmp,/var/tmp) with suspicious names.Authentication events that appear to originate from the
jira,jenkins, orkeycloaksystem accounts without a corresponding login.
Security information and event management (SIEM) platforms should be tuned to flag these patterns. Additionally, enabling Java’s built‑in -Djava.security.manager flag can generate audit logs for denied operations, providing early warning of exploitation attempts.
Mitigation Strategies
Immediate actions
Apply vendor patches: All major vendors have released updates that either upgrade the bundled JDK to a patched version or disable the vulnerable scripting endpoints. For Jira, upgrade to version 9.13.5 or later. For Jenkins, apply the security fix released on 2026‑09‑15 or later. For Keycloak, upgrade to 22.0.3 or newer.
Restrict network access: Use firewall rules to limit exposure of the affected REST endpoints to trusted IP ranges or internal networks only.
Enable a security manager: Start the Java process with
-Djava.security.managerand a custom policy file that deniesjava.lang.Runtime.execandjava.lang.ProcessBuilderfor all non‑privileged code.Audit and rotate credentials: Assume that any stored credentials may have been compromised. Rotate API tokens, SSH keys, and service account passwords immediately after patching.
Configuration hardening
Beyond patching, organisations should adopt defence‑in‑depth measures:
Disable or remove unnecessary plugins that expose scripting capabilities.
Enforce strict input validation on all HTTP parameters, rejecting any payload that contains script language keywords such as java.lang or Runtime.
Run Java services under dedicated, low‑privilege system accounts with no sudo rights.
Leverage containerisation (Docker, Kubernetes) to isolate each service, limiting the blast radius of a successful exploit.
Long‑Term Remediation and Best Practices
Addressing Java4Shell is not solely a patch‑and‑pray exercise. A sustainable security posture includes:
Regular JDK updates: Subscribe to Oracle’s or OpenJDK’s security advisories and schedule quarterly updates for the runtime environment.
Secure development lifecycle (SDLC): Incorporate static analysis tools that flag usage of
ScriptEngine.eval()with untrusted input. Encourage developers to use alternative, safer templating engines.Runtime application self‑protection (RASP): Deploy RASP solutions that can intercept suspicious method calls (e.g.,
exec) and block them in real time.Penetration testing: Include Java4Shell test cases in regular red‑team exercises to verify that mitigations remain effective after system changes.
By combining prompt patching with robust configuration, continuous monitoring, and a proactive development approach, organisations can dramatically reduce the risk posed by this pre‑authentication RCE vector.
Conclusion
The Java4Shell vulnerability (CVE‑2026‑114938) is a stark reminder that core platform libraries can become attack conduits when exposed to untrusted data. Its ability to grant unauthenticated remote code execution across high‑value services such as Jira, Jenkins, and Keycloak makes it one of the most critical Java‑related flaws of the year. Immediate remediation—applying vendor patches, tightening network access, and enabling a security manager—must be complemented by long‑term hardening practices. Organizations that adopt a layered defense strategy will not only neutralise Java4Shell but also improve resilience against future supply‑chain and runtime‑level threats.



