Tuesday, 17 November 2026
Rīga TV

World and Latvian news in one place

TechnologyPublished: 18 November 2026 at 01:02

OpenJDK Base64 decoder flaw enables remote code execution

Security researcher Quang Luong described a bug in the OpenJDK HotSpot x86-64 Base64 decoder that overwrites heap memory. Combined with heap layout grooming, it can lead to data leaks and remote code execution.

Foto: Hacker News (≥150 p.)

Security researcher Quang Luong of the firm Calif has described a vulnerability in OpenJDK HotSpot, the reference implementation of the Java Virtual Machine. The flaw is in the x86-64 Base64 decoding intrinsic, an optimized routine built on special processor instructions. Specially crafted Base64 input can overwrite allocated heap memory with a constant value, and the researchers turned this into remote code execution.

How the bug arises

HotSpot's C2 compiler, the most aggressive JIT compiler in the Java Virtual Machine, turns frequently called functions into native code. For Base64 decoding it uses an intrinsic that processes input in blocks. When the input is shorter than 64 bytes, a write mask is calculated from the input and output lengths and adjusted for '=' padding characters.

If the remaining input is something like '=' or '==', the output length starts at zero and is then decremented to −1 or −2. The mask then enables all 64 bytes, and data is written past the end of the buffer. With the input 'A' × 64 + '=', a 50-byte buffer is allocated, but writing starts at offset 48. On OpenJDK 17 the input has to be longer: 'A' × 128 + '='.

From overwrite to code execution

The write is constrained: only the first byte is fully controlled, and bytes 48 to 63 always take the value 0x9a. The researchers used a known technique, overwriting a buffer's length so it accepts more data, which gave them controlled write and read capabilities. Even before code execution, this allows leaking Java heap contents, which may include personal data and keys.

To shape the heap layout, the researchers used a technique called Heap Feng Shui, remotely controlling allocation order by sending requests in parts. The attack is sensitive to network latency, so they rented a virtual machine in the same region as the target. A bad layout can crash the JVM, but the attempt can be repeated.

Limitations

Each target needs its own tailored profile, so the attack is not universal. Some profiles require request streaming, which can be disrupted by a proxy that waits for the full request body. The write-up also includes a safe proof of concept for reproducing the bug.

Comments

0/1500

Comments are automatically moderated. No hate, threats, personal data or spam.

Loading comments…

More in this category