r/programming • • 12d ago

Java4Shell: RCE in OpenJDK Base64 (Calif)

https://calif.io/java4shell/
321 Upvotes

45 comments sorted by

View all comments

0

u/[deleted] 12d ago

[deleted] — view deleted comment

35

u/CherryLongjump1989 12d ago edited 12d ago

We're talking about serialization in Java, right? Which is infamous for horrible performance.

Who was using enough base64 that they needed that hand tuned?

Literally HTTP Basic Auth headers, MIME/email attachments, binary blobs inside JSON, Kafka, gRPC payloads, every serialized token or cookie. The hot path for auth and API gateways.

So as long as you don't use Java for any of the things that everyone uses Java for, you're probably fine...

0

u/[deleted] 12d ago

[deleted] — view deleted comment

6

u/CherryLongjump1989 12d ago edited 12d ago

Base64 is re-chunked binary data. You split up your binary data into 6 bit segments and pad them with 2 more bits to get a byte. It's one of the main ways you can shove incompatible binary formats into other binary formats, and it just so happens to fall into the range of ASCII characters. So it's extremely versatile and efficient whenever you have to transfer binary data across a wide variety of protocols, without having to to transcode at every step of the way. So in other words it's ideal for anything network related.

11

u/bwmat 12d ago

Base64 is everywhere these days due to json/xml-based serialization