Java4Shell: JDK Vulnerability Exploiting a Flaw in High-Speed Base64 Processing Logic (CVE-2026-114938)

Java4Shell: JDK Vulnerability Exploiting a Flaw in High-Speed Base64 Processing Logic (CVE-2026-114938)

Overview

At approximately 6:00 a.M. On November 18, 2026 (Korea Standard Time), CVE-2026-114938, a vulnerability in Java’s standard Base64 decoder, was disclosed. Calif, the security research firm that discovered and disclosed the vulnerability, named it “Java4Shell” and explained that if malformed Base64 input passes through high-speed processing code on certain CPUs, data can be written beyond memory boundaries.

Java services may use the standard Java decoder to restore Base64-encoded values of authentication credentials or tokens received from external sources. To improve performance when running on certain CPUs, this decoder performs decoding using separate high-speed processing code; the problem arose precisely within this high-speed processing code. Normally, when a decoder receives invalid input, it should detect an error and terminate the operation. However, in this vulnerability, the high-speed processing code could write data beyond the memory range allocated to store the decoding results before the error was confirmed.

This vulnerability has garnered significant attention not only because a high proportion of services use Java, but also because it demonstrates that even in Java’s standard library—which is considered a memory-safe language—memory corruption can be caused solely by externally sent input. Even if the invalid input is ultimately rejected, by that point, data has already been written outside the memory bounds. Oracle assessed this vulnerability as exploitable through the network without authentication, and Calif reported that remote code execution was successfully achieved in some products.

However, remote code execution is not possible on all Java services. Several conditions must be met—such as whether the threat actor’s input is actually passed to the decoder and whether the environment allows memory corruption to lead to code execution—and whether each condition is satisfied must be verified separately for each service. These conditions will be examined in detail later.

 

Background Information

Base64 is a method of converting the bytes of source data into characters that are easy to transmit or display; the actual source data can be text or file bytes. For example, the English text “ABC” takes up 3 bytes when stored in UTF-8; when encoded in Base64, it becomes the four characters “QUJD.” The decoder takes these four characters and restores them to the original 3 bytes.

[Figure 1] Base64 Processing

As shown, Base64 groups the original bytes in sets of three and represents them as four characters. If the last group does not consist of exactly 3 bytes, the empty spaces are filled with “=”; this is called padding. For example, encoding the 1-byte character “A” results in “QQ==,” where the “==” at the end is padding, not part of the original data. If the last group consists of 2 bytes, a single “=” is appended; if it consists of exactly 3 bytes, no padding is added. The decoder must verify that the input follows this rule and treat any input that does not conform as an error.

Java applications can use the JDK’s standard decoder to convert Base64 values back to bytes. The JDK is a package that bundles the tools and standard libraries needed to create and run Java programs, and it includes the VM, which actually executes the programs. The VM includes a JIT (Just-In-Time) compiler that converts frequently executed code into faster machine code during runtime. In this process, the VM sometimes replaces certain frequently used standard functions—such as Base64 decoding—with dedicated code optimized for the CPU. This optimization is called an “intrinsic,” and the high-speed processing code mentioned above refers specifically to the intrinsic for Base64 decoding.

[Figure 2] Base64 Processing Flow in the JVM Environment

The high-speed instruction sets available for use in the intrinsic process vary by CPU. AVX-512 is a set of instructions that enables x86 CPUs to process multiple data items simultaneously, and VBMI and BW are sub-instructions within that set. The VM applies the intrinsic function in question for Base64 decoding only when it determines that the CPU supports these two features. Therefore, this vulnerability occurs only in Java programs running on CPUs that support both VBMI and BW.

 

Cause of the Vulnerability

Recall the padding rules discussed earlier. The problem arises when processing the final portion of an input with incorrect padding. The valid padding character “=” must be included within the last four-character block. However, if only a single “=” remains after all preceding blocks have been processed, this is not a valid input. Before the fix, some AVX-512 accelerated code would first calculate the output length of the final portion before halting due to an error; in doing so, it subtracted one padding character from the remaining 0 bytes, resulting in a value of −1.

High-speed code uses a table to determine which of the 64 memory slots to write the result to. This table is called a write mask, and each slot is designated as either 0 or 1. However, if the incorrectly calculated −1 is entered into this mask, all 64 bits of −1 become 1s, causing all 64 slots to be selected as write targets. Consequently, even if the decoder detects the input error later, it may have already written more bytes than the memory allocated to store the result.

Let’s briefly verify this process using a 65-byte input in OpenJDK 21u (Java 21 Update series). The input is an invalid value consisting of 64 Base64 characters “A” followed by a single “=”; since all characters are ASCII, the total size is 65 bytes. As follows is a step-by-step breakdown of what happens:

  1. If we group the 65 characters of the input into blocks of four, we get 17 blocks (rounded up).
  2. The resulting array size is set to 17 × 3 − 1 = 50 bytes. (3 Is the number of bytes returned per block, and −1 accounts for padding.)
  3. Decoding the first 64 “A”s results in 48 bytes being written. Only 2 bytes remain in the array.
  4. However, an incorrect write mask subsequently allows 64 bytes to be written.
  5. Ultimately, 62 bytes are written outside the array, resulting in a memory corruption.

So far, the explanation has been based on the publicly disclosed 21u case. However, the conditions are slightly different for OpenJDK 17u (the Java 17 update series). Since the corresponding fast-processing mechanism in 17u only begins when the input exceeds 128 bytes, the 65-byte example cannot be applied directly. Therefore, in the 17u series, an input of 129 bytes or more—exceeding the threshold—is required for this fast-processing mechanism to occur.

This security vulnerability was fixed with change number JDK-8393212. This change ensures that if the remaining input at the end is shorter than four characters, it is processed via standard validation rather than being sent to the fast-processing path. Below is the actual diff of the fix applied to 21u; lines marked with a “+” indicate newly added code.

       __ BIND(L_finalBit);
       // Now have 1 to 63 bytes left to decode

+      // A padded Base64 tail shorter than one complete block is handled by Java.
+      __ cmpl(length, 4);
+      __ jcc(Assembler::less, L_bruteForce);

The key point of the patch is that the three added lines specify: “If the remaining input is shorter than four characters, skip the high-speed processing and proceed to the safe standard processing.” In this path, each Base64 character is passed as a single input byte; therefore, the number 4 in the code refers to a block of four characters. Before the fix, the last 1–3 characters could reach the point where the write mask was calculated incorrectly, but after the fix, they first undergo Java’s standard input validation. This difference can be verified by comparing the source code of jdk-17.0.21-ga (before the fix) and jdk-17.0.21.1-ga (after the fix).

 

Vulnerability PoC

This PoC video demonstrates how an out-of-bounds write in the Base64 decoder leads to an information leak on the authentication server. The left side of the screen shows the Java authentication server, and the right side shows the Python client. The server decodes the Base64 string sent by the client and compares it to a key hard-coded in the code. It is a simple authentication function that returns “success” if the values match and “fail” if they do not.

[Video 1] Reproduction of Information Leak PoC

If the client sends a Base64-encoded value that differs from the stored key, the decoding proceeds normally, but both the authentication result and the client’s `result` display “fail.” Next, if the client sends a 65-character input consisting of 64 “A”s followed by a single “=”, decoding fails and the authentication result is “fail.” However, due to an out-of-bounds write that occurs before the error is detected, the `output.length` value on the server screen grows abnormally large. Since the server reads up to 0x50 bytes from the result area based on this value and returns a response, the key—which was originally outside the array bounds—is exposed in the client’s `result`.

In a real-world service, memory corruption like the PoC above could lead to a wider range of issues. Sensitive information, such as authentication tokens, could be exposed, the server could crash, or—depending on the application’s architecture—it could lead to remote code execution.

 

Conditions for Exploitation

Based on the root cause of the vulnerability discussed above, we have summarized the conditions required for a threat actor to exploit this vulnerability.

Criteria Prerequisites for an Attack
JDK Build The target Java service is running on a vulnerable JDK build that still contains the defect
CPU Features The VM determines that it can use AVX-512 VBMI and BW on x86-64 (BMI2 is also required in the analyzed 27u path)
Base64 Processing The VM optimizes the decoding using high-speed processing code, and the input length reaches the threshold where high-speed processing begins
The threat actor’s input is received The threat actor’s malformed Base64 is passed to the standard decoder
Additional conditions for code execution Service-specific follow-up conditions that allow memory corruption to lead to actual code execution

[Table 1] Conditions for Exploiting the Java4Shell Vulnerability

The first condition is whether the target service is running on a vulnerable JDK build that still contains the flaw. However, even for the same flaw, whether a service is affected depends on the vendor and version. Oracle identifies the following as affected: specific updates in the Java SE 17, 21, 25, and 27 series (17.0.21.0.3, 21.0.13.0.3, 25.0.5.0.3, 27.0.1.0.3), one special performance build (8u511b33-perf), as well as Oracle GraalVM for JDK (17.0.21.0.3, 21.0.13.0.3) and Oracle GraalVM Enterprise Edition (21.3.20.0.3). In contrast, Red Hat explains that the code paths analyzed here do not exist in standard OpenJDK 8 and 11. Therefore, you must verify whether you are affected based on the specific build you are using. One should not assume that “standard OpenJDK 8 is safe” applies to Oracle’s specialized Java 8 performance builds, nor should one conclude that builds from other vendors are equally vulnerable simply because the OpenJDK source is vulnerable.

Even in a vulnerable build, if the JVM determines that it cannot use the required CPU features, the problematic high-speed processing code will not be selected. The features required here are VBMI and BW, which are subsets of AVX-512 as introduced earlier. It is impossible to determine whether a running JVM actually uses these features based solely on the CPU model name.

Even in an environment where the CPU supports the above features, two conditions must be met simultaneously for the “high-speed processing enabled” condition to hold true. First, the relevant Base64 decoding call must actually be optimized using the high-speed processing code (intrinsics). Second, the attack input must be long enough and malformed enough to actually reach the critical branch in that high-speed processing code.

[Figure 3] Conditions under which Base64 decoding reaches the critical branch

First, regarding optimization: the VM does not process every call using high-speed processing from the start. When a sufficient number of identical decoding calls accumulate and are identified as “frequently executed code,” the JIT (Just-In-Time compiler)—as introduced earlier—converts those calls into intrinsics. Therefore, for the problematic high-performance section to execute, this optimization must already be in place by the time the threat actor’s malformed input is processed. This process is not guaranteed solely by the number of iterations and can be disabled via VM startup options. (See the “Recommended Actions” section.)

Next, let’s examine the input side. The “length” referred to here is not the size of the entire HTTP request, but the length of the Base64 input passed to the decoder. This length must exceed the threshold for entering the high-speed processing branch in question, and that threshold varies by version. This is also the source of the difference between the 65-byte and 129-byte examples discussed earlier: while version 17u requires the input to exceed 128 bytes, versions 21u, 25u, and 27u allow entry into the high-speed processing branch if the input exceeds 31 bytes.

Ultimately, the attack cannot succeed based solely on the fact that a threat actor sent a Base64 value once. This is because, with optimizations enabled, a sufficiently long and malformed input must actually pass through the high-speed processing section in question for a memory corruption to occur. Therefore, the number of HTTP requests required for the attack cannot be fixed at a single value.

 

The CPU and JDK conditions described earlier cannot be configured or imposed by the threat actor. What the threat actor manipulates is not the CPU, but only the Base64 value input to be sent to the service; the vulnerability can only be triggered if this value reaches the standard decoder. For example, even if a service decodes authentication credentials or tokens, whether it checks the input first and whether it calls this function before authentication varies from service to service. Therefore, the statement in Oracle’s announcement that “an attack is possible over the network without authentication” should not be interpreted to mean that requests from all Services actually reach the decoder in question.

Furthermore, for the vulnerability to lead to remote code execution, additional conditions may be required, such as the memory layout of the target service, the possibility of repeated calls, and a response that allows the threat actor to verify the results. Calif, which reported this vulnerability, observed code execution in a specific product during both the pre-authentication and post-authentication phases; however, another analysis firm, Blackpoint, confirmed memory corruption and information disclosure in separate local tests but was unable to reproduce remote code execution.

Comparison of
PHP2Shell and Java4Shell

You may wonder whether PHP2Shell, disclosed last October, and the recently revealed Java4Shell can be considered equally dangerous. According to published data, as of the end of 2025, Java accounts for 71.28% of the programming languages used in Korea’s public information systems. Based on this figure alone, the potential impact of Java4Shell may be a greater cause for concern. However, the proportion of a programming language’s use differs from the percentage of systems with vulnerable builds or services that are actually exploitable. What distinguishes the actual risk of these two vulnerabilities is how much information a threat actor must obtain to carry out an attack, and what the threat actor can ultimately achieve by exploiting the vulnerability.

Items PHP2Shell (CVE-2026-109618, CVE-2026-109619) Java4Shell (CVE-2026-114938)
Vulnerability Type Memory corruption: Accessing memory that has been deallocated or not fully initialized (Use After Free, accessing an uninitialized pointer) Memory corruption: Writing beyond the boundaries of an allocated buffer (Out-of-bounds Write)
Vulnerability Mechanism When the server runs out of memory while processing a request and continues to overwrite the request state that was not properly terminated, or when data left over from a previous request is not cleared and gets mixed into the next request In a vulnerable JDK, when Base64 input is processed using high-speed logic rather than standard processing, and that input meets the length and padding conditions, causing the vulnerable section to be actually executed
Trigger Conditions

CVE-2026-109618

  • Use of an unpatched, vulnerable PHP version
  • PHP is running in a configuration where it is directly embedded in the web server (mod_php)
    • Does not apply to configurations using a separate processor (PHP-FPM)
  • A memory limit (memory_limit) is in place (default setting)

CVE-2026-109619

  • Using an unpatched, vulnerable version of PHP
  • Configuration where a single process handles multiple requests sequentially
  • Session upload progress tracking is enabled, or error logging is enabled in PHP 8.5 (default setting)
  • Use of an unpatched, vulnerable OpenJDK version
  • Server equipped with a CPU that supports high-speed Base64 processing
    • AVX-512 VBMI & BW
    • The 27u series includes BMI2
  • The application processes external input using a standard or URL-safe Base64 decoder
    • No MIME decoder that handles line breaks
Expected outcome of a successful attack Memory corruption in the PHP engine itself, which directly processes requests, enabling unauthenticated RCE independently for each verified CVE path The primary outcome is memory corruption; memory disclosure or RCE requires additional exploitation conditions specific to the target application

[Table 2] Comparison Table: PHP2Shell vs. Java4Shell

First, neither vulnerability is easy for an external threat actor to exploit directly. This is because many preconditions must align for an attack to succeed, and it is difficult for an external party to determine whether those preconditions have actually been met.

In the case of PHP2Shell, an attack can only occur if specific conditions are actually reproduced—such as the target server running out of memory while processing a request, or data from one request carrying over to the next without being cleared. For Java4Shell, in a vulnerable JDK, the threat actor’s malformed Base64 input must trigger high-speed processing logic rather than standard processing, and that input must actually pass through the problematic section while meeting specific length and padding conditions. In neither case can an attack succeed based solely on the fact that “the target uses that language.”

Let’s assume, then, that a threat actor has obtained all the necessary information and actually triggered the vulnerability. While the initial result in both cases is memory corruption, the distance from there to actual code execution differs. With PHP2Shell, the damage occurs within the PHP engine itself, which directly processes requests, and exploits that combine these two flaws to achieve unauthenticated RCE have already been disclosed and demonstrated.

In contrast, with Java4Shell, the corruption occurs in the JDK’s Base64 decoder; therefore, to trigger this vulnerable logic, an attacker must separately identify the specific components within applications running on top of the JDK (e.G., Jenkins, JFrog, etc.) That are connected to that logic. Furthermore, threat actors must additionally determine, on a per-target basis, how to use the corrupted memory to cause malfunctions or abnormal behavior as desired by the threat actor. In fact, as mentioned earlier in the section on attack conditions, Blackpoint—which conducted a separate analysis—was only able to confirm memory corruption and information disclosure in local testing and was unable to reproduce remote code execution. In other words, with Java4Shell, there is an additional hurdle to overcome between the “trigger” and “actual exploitation.”

 

Recommended Actions

Since the impact of this vulnerability varies by service, we recommend conducting inspections and implementing countermeasures according to the following items.

1) Verify the JDK in Use

First, verify which JDK the Service is actually running on. Even within the same Java framework, vulnerability status varies by vendor and version; therefore, you must base your assessment on the specific build you are using. Use commands such as `java -version` to verify the vendor (Oracle, OpenJDK distribution, GraalVM, etc.) And the exact build number, then cross-reference this with the list of affected builds outlined in the “Attack Conditions” section above. Builds that do not contain the problematic code path—such as standard OpenJDK 8 and 11—are not affected; therefore, it is important to verify based on your actual build rather than making assumptions.

2) Applying the Patch

If your build is affected, updating to a build where the flaw has been fixed is the fundamental solution. This flaw was fixed in OpenJDK 17u via change JDK-8393212. The affected (vulnerable) builds and fixed builds for each product, as disclosed by Oracle, are as follows.

Product Affected (Vulnerable) Builds Fixed Builds
Oracle Java SE 8 (Enterprise Performance Pack) 8U511b33-perf 8U513-perf
Oracle Java SE 17 17.0.21.0.3 17.0.21.1
Oracle Java SE 21 21.0.13.0.3 21.0.13.1
Oracle Java SE 25 25.0.5.0.3 25.0.5.1
Oracle Java SE 27 27.0.1.0.3 27.0.1.1
Oracle GraalVM for JDK 17 17.0.21.0.3 17.0.21.1
Oracle GraalVM for JDK 21 21.0.13.0.3 21.0.13.1
Oracle GraalVM Enterprise Edition 21.3.20.0.3 21.3.20.1

[Table 3] Java4Shell Vulnerability Patch Builds

The affected builds listed in the table are representative builds specified by Oracle; builds lower than the fixed builds within the same release line may also be affected. The exact scope—including lower versions where the vulnerable code first appeared—may vary by vendor and distribution, so be sure to check the scope of impact and the fixed versions in your vendor’s official advisory before applying the patch.

3) Temporary Workaround

If an immediate patch is not available, you can reduce the risk by disabling the problematic high-performance processing path using VM startup options. Red Hat recommends applying -XX:-UseBASE64Intrinsics to disable Base64 high-performance optimization, or, on x86-64 systems, apply -XX:UseAVX=2 to limit AVX usage to AVX2 (disabling the AVX-512 Path). While these measures prevent the problematic branch from being selected, they may impact performance and are not a fundamental solution; therefore, they should be used only as a temporary workaround, and a patch should be applied as soon as possible.

4) Check for Exposure Paths

Apart from patches and mitigations, check for any points where externally received values are processed by a standard Base64 decoder. In particular, paths that decode external input prior to authentication should be checked first, as there is a high likelihood that a threat actor’s input could reach the vulnerable code. It is also helpful to verify whether the length and format of the input are validated before decoding, as this helps reduce the attack surface.

 

Conclusion

Java4Shell is a memory corruption vulnerability that originated in the high-speed processing code of the Java standard Base64 decoder; it garnered significant attention because it demonstrated that external input alone could cause problems within standard Java functionality. In particular, given that Korea’s administrative and public information systems rely heavily on Java—to the point of earning the nickname “Java Republic”—the name “Java4Shell” alone is enough to cause considerable anxiety.

However, as we’ve seen, successfully exploiting this vulnerability requires a combination of factors: a vulnerable JDK build, specific CPU features (such as AVX-512 VBMI & BW), actual high-speed code execution, and threat actor input reaching the vulnerable branch. Oracle’s assessment of the attack complexity as “High” further underscores such difficulty. In other words, the fact that many services use Java does not necessarily mean that an equal number of services are Attack Targets; therefore, this is not an issue that warrants excessive concern.

However, “difficult to exploit” does not mean “safe.” In an environment where all conditions are met, this could lead to remote code execution without authentication; therefore, rather than feeling vaguely reassured, it is advisable to follow the recommended actions outlined above to verify the build you are using and apply the patch if affected. A calm, fact-based assessment and response—rather than vague anxiety—is the correct approach to addressing this vulnerability.
 

Source

  1. https://www.mk.co.kr/news/world/12212631
  2. https://raw.githubusercontent.com/CVEProject/cvelistV5/main/cves/2026/114xxx/CVE-2026-114938.json
  3. https://calif.io/java4shell/
  4. https://access.redhat.com/security/vulnerabilities/RHSB-2026-018
  5. https://github.com/openjdk/jdk17u/blob/jdk-17.0.21-ga/src/java.base/share/classes/java/util/Base64.java
  6. https://www.oracle.com/security-alerts/cspunov2026verbose.html
  7. https://www.oracle.com/security-alerts/cspunov2026.html
  8. https://blackpointcyber.com/blog/java4shell-cve-2026-114938-java-base64-decoder-flaw/
  9. https://www.rfc-editor.org/rfc/rfc4648
  10. https://github.com/openjdk/jdk17u/blob/jdk-17.0.21-ga/src/hotspot/share/opto/library_call.cpp#L6943-L6973
  11. https://cdrdv2-public.intel.com/634648/634648-004.pdf
  12. https://github.com/openjdk/jdk17u/blob/jdk-17.0.21-ga/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp#L6024-L6280
  13. https://github.com/openjdk/jdk21u/blob/jdk-21.0.13-ga/src/java.base/share/classes/java/util/Base64.java#L700-L746
  14. https://github.com/openjdk/jdk21u/blob/jdk-21.0.13-ga/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp#L2381-L2394
  15. https://github.com/openjdk/jdk21u/commit/8e115fb5c7c5e2b35f0aa86353ce3f84b49e7319
  16. https://github.com/openjdk/jdk21u/blob/jdk-21.0.13.1-ga/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp#L2534-L2545
  17. https://github.com/openjdk/jdk27u/blob/jdk-27.0.1-ga/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp#L3067-L3077

Gain access to related IOCs and detailed analysis by subscribing to AhnLab TIP. For subscription details, click the banner below.