2026-11-18 · 10 min read

Sixty-Four A's and an Equals Sign: The Bug Lives in the Fast Path's Tail

Flat isometric diagram of an indigo block conveyor feeding a dark container, with a short violet tail block overshooting the edge and spilling fragments into adjacent cells, and a green node marking the boundary.

You can trigger one of the worst bugs in the modern Java runtime with a string you could type by accident: sixty-four capital A's followed by a single equals sign.

That's it. Sixty-five characters. According to the disclosure of CVE-2026-114938, feeding that string to OpenJDK's Base64 decoder on a supported x86-64 processor corrupts heap memory, leaks it in the style of Heartbleed, and can lead to remote code execution. CVSS 9.2. Pre-auth RCE in Keycloak, Jira, Confluence, Jenkins, and a list of others in their default configurations.

The temptation is to file this under "Java is unsafe after all" and move on. That's the wrong lesson. The bug isn't in Base64, and it isn't really in Java. It's in a shape of code that exists in almost every stack you run: a fast path with a hand-written tail. Once you can see that shape, you'll find it in your own dependencies, and you'll know what to ask about them.

First, what a fast path actually is

Base64 turns binary data into text so it can travel through places that only accept text: email headers, JSON, authentication tokens, file uploads. Three bytes in become four characters out. Every service you run decodes it somewhere, usually without you thinking about it.

Decoding is repetitive work, so libraries try to do many bytes at once. On modern CPUs that means vector instructions — a family of instructions called SIMD, short for single instruction, multiple data. One instruction, dozens of bytes handled in parallel. OpenJDK uses a specific set called AVX-512 VBMI to chew through Base64 sixty-four bytes at a time.

Now count your input. Sixty-five characters is not a multiple of sixty-four. So the decoder does two things in sequence: a bulk loop that eats the first sixty-four bytes in one gulp, and then a separate piece of code that deals with whatever is left over.

That leftover handler has a name. It's called the tail.

The bulk loop and the tail are not the same code, and they are usually not written the same way. The bulk loop comes from a compiler or from well-reviewed intrinsics. The tail is frequently hand-written assembly, added because getting the last few bytes right was easier to write by hand than to express in a high-level language. It is the part of a performance library that gets the least attention and carries the most arithmetic.

Where the arithmetic goes wrong

Here is the sequence in this specific bug, and it's worth following closely because it repeats.

For a sixty-five-character input, the decoder allocates a fifty-byte output array. It decodes the first sixty-four characters correctly. Then the tail sees the stray = — a padding character that doesn't belong in that position — and computes a negative output length.

An output length is a number, and in the place where it gets used, a negative number doesn't stay negative. It becomes enormous. The write-the-remainder step then writes a full sixty-four bytes into a fifty-byte buffer, sending sixty-two bytes past the end of the array and into whatever object happens to sit next to it on the heap.

And now the detail that should unsettle you most: Java does eventually reject the malformed input. Validation works. It just happens after the copy.

Two general lessons, both portable to any codebase:

  • A computed length that comes from untrusted input and then feeds a memory copy is the single most reliable shape of a heap overflow.
  • Order matters. If you validate after you do the work, your validation is a post-mortem, not a guard.

Your tests don't have the shape of an attack

Why did this survive? Not because nobody tested Base64. Base64 is tested constantly, by everyone, at every layer of the stack.

It survived because of the shape of the testing. Random fuzzing generates random lengths and random bytes. The probability of landing on exactly N×64+1 characters, where the extra character is specifically padding, is tiny. Random inputs exercise the bulk loop beautifully. They rarely thread the needle into the tail with the one byte value that breaks the length calculation.

The fix isn't more random fuzzing. It's structured testing that matches the structure of the code:

  1. Length sweeps. If the block size is B, test every input length from 0 to 4B+1, not a random sample. For a 64-byte block, that's about 257 cases per payload. Milliseconds of runtime.
  2. Positional sweeps. For each length, place the special characters — padding, terminators, escape bytes, invalid sequences — at every offset. First byte, last byte, and the boundary either side of each block.
  3. Differential comparison. Keep a slow, obvious, reference implementation. Compare its output to the fast path's output byte for byte. When they disagree, you've found a bug without needing to understand it first. This is the highest-value test in any performance code, and almost nobody writes it.

None of that requires knowing where the bug is. It requires knowing where the code changes behaviour, which is at block boundaries.

This shape is everywhere, not just in Java

Once you start looking for bulk-loop-plus-tail, you find it constantly:

  • UTF-8 validators that check sixteen bytes at a time and hand the remainder to a scalar loop.
  • JSON parsers that scan strings with vector instructions to find quotes and backslashes, then finish the string byte by byte.
  • String search and memory-scanning routines that jump a whole register width at a time.
  • Compression and hashing, where processing blocks and finalising the last partial block are different code paths.
  • CSV parsers, regex engines, and hex decoders — same pattern, same blind spot.

The tail is also often the only place with variable-size writes, because the remainder is by definition an odd size. Everything the bulk loop does has a fixed width. Fixed widths are easy to bound-check. Variable widths are where the length arithmetic lives.

The promise you thought you bought

One of Java's central selling points is memory safety: the runtime manages memory for you and checks accesses, so the memory-corruption bugs common elsewhere can't reach your code. That promise is real, and it applies to the code you write.

It does not apply to the code underneath. Much of the runtime — the decoder, the crypto, the compression, the regex engine — is written in C, C++, and, in this case, assembly, where memory corruption is still a normal Tuesday.

So the property is not "Java is memory safe." It's "this layer is memory safe, given that the layer below it is correct." That's a meaningful guarantee and it's still worth a lot. But it's a conditional, and the condition is somebody else's assembly.

Three questions for any dependency with a fast path

You cannot audit every dependency. You can ask three questions that separate "theoretical" from "in scope for my patch window this weekend."

  • Does my input reach the fast path? Fast paths are gated — on CPU features, on input size thresholds, on content type. If your service decodes a few hundred bytes of Base64 in a JWT, you may never touch the vectorised routine. If you accept file uploads, decode headers, or process message payloads of arbitrary size, you almost certainly do. The gate tells you which endpoints matter.
  • Is the tail hand-written? Look for assembly files, intrinsics (functions named _mm512… or vld1q…), target-feature attributes, or unsafe blocks. If the fast path came from the compiler's auto-vectoriser, the tail came from the compiler too, and compiler-generated code is boring and broadly tested. Hand-written tails are where the interesting bugs hide.
  • Does the tail do length arithmetic or variable-size writes? If a length is computed from input and then used in a copy or an index, that's the exact shape of a heap overflow. Not a maybe. That's the shape.

Three yeses doesn't mean the dependency is broken. It means you treat it like a critical dependency: you track its advisories, you patch in hours rather than sprints, and you'd rather turn the feature off than wait.

The trade-off nobody priced

There's a fair objection to all of this: without fast paths, everything gets slower. Base64 decoding at gigabytes per second is a genuine engineering achievement, and the teams that wrote it did careful work. Removing it would hurt real workloads.

The honest framing is narrower. The optimisation helps the small set of users decoding enormous volumes. It ships to everyone else anyway, including the services whose entire Base64 traffic is a few megabytes a day of token and header decoding. On those systems, the fast path has no upside and all of the downside. As the disclosure put it, an optimisation few applications needed became a serious security risk for everyone who inherited it.

There's a tempting response: just turn the fast path off. Some runtimes let you restrict CPU features, and that's a legitimate mitigation for a service that doesn't need the throughput. Two caveats. First, it's a mitigation, not a fix — patch anyway, because the vulnerable code is still on disk. Second, disabling a CPU feature across a fleet is exactly the kind of change that quietly doesn't apply to one instance in a region nobody checked. If you go that route, verify it per host, not per config file.

And notice the economics on the other side. The disclosure reported that finding the vulnerability took one researcher about an hour, and a working exploit two more, for under $200 in model tokens. Attack surface you don't use is not free. It's cheap for the person probing it and expensive for the person who has to patch it.

What I'd actually do on Monday

Not a re-architecture. Four small things.

Grep your own code for decode calls that take attacker-controlled input — Base64, hex, UTF-8 validation, compression. Those are the endpoints that matter, and there are usually far fewer of them than you'd guess.

Patch the runtime, including the JDKs embedded inside application servers and CI images that never appear on your dependency dashboard.

Write one length-sweep test for the parsers you own. Not the dependencies — yours. You have at least one hand-written decoder or scanner in your codebase, and it has never been tested at every length from zero to four block sizes.

And when a vendor tells you their parser is fast, ask them for the test that compares the fast path to the slow one. The ones who have it will be pleased you asked. The ones who don't will change the subject, and that's your answer.

Key Takeaways

  • The OpenJDK Base64 bug is a fast-path bug: a vectorised bulk loop plus a hand-written tail that mishandled padding and produced a negative output length.
  • Every performance-critical routine has a tail. Hand-written tails carry variable-size writes and length arithmetic, which is the classic heap-overflow shape.
  • Random fuzzing exercises the bulk loop and misses the tail. Test with exhaustive length sweeps around block boundaries and positional sweeps of special bytes.
  • Differential testing against a slow reference implementation finds these bugs without requiring you to understand them.
  • Memory safety is a property of a layer, not a language. Java protects your code; the assembly and C underneath it is still C and assembly.
  • Ask three questions of any fast-path dependency: does my input reach it, is the tail hand-written, does the tail compute lengths or do variable-size writes?
  • Invalidation after the write is not validation. Order matters more than the check itself.
  • An optimisation you don't benefit from is pure attack surface — and at a few hundred dollars of AI-assisted research, that surface gets probed cheaply.

[ Call to action ]

Ready to scale your engineering team?

Tell us the roles you need to fill and we'll get back within 24 hours.