r/programming • • 13d ago

Java4Shell: RCE in OpenJDK Base64 (Calif)

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

45 comments sorted by

View all comments

105

u/HipstCapitalist 13d ago

I cannot imagine the impact if this affects Minecraft servers...

42

u/siromega37 13d ago

Every. Single. One.

20

u/Sopel97 13d ago

do they decode untrusted base64?

46

u/bwainfweeze 13d ago

There’s an http header that uses base64

4

u/Primary_Ads 13d ago

yikes

17

u/bwainfweeze 13d ago

My least favorite HTTP header too so it's really lemon juice on the papercut.

10

u/n00bz0rz 13d ago

What's your second least favourite HTTP header?

16

u/bwainfweeze 13d ago

Referer. Particularly when paired with Referrer-Policy.

7

u/Vakz 13d ago

Mine's https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Date, primarily used in https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Retry-After#syntax. Who thought "Wed, 21 Oct 2015 07:28:00 GMT" was a reasonable way to do timestamps primarily read by code and not people?

6

u/CornedBee 13d ago

Wait, Apache httpd isn't just lots of Native Americans reading requests and writing responses?

2

u/bwainfweeze 12d ago

Encoding aside, the brilliance of the Date header is that it cancels out most of clock skew between the client and the server.

When HTTP 1.0 was new, we still had computers with CR-2032 batteries on the motherboard to run a clock while the computer was off, and I ran into so many people while doing tech support whose computers thought it was January 2, 1970 because they'd not once thought to replace that battery.

When the server tells you that the document expires on Thursday and it's currently Wednesday, you know how long to keep it for, even if you think it's Tuesday at the moment.

So the two ends of the link can nail down clock skew to a little more than the speed of light delay between them, and Berners-Lee thought of this problem sometime back around 1990. It is actually my favorite header because of that.

I know I used this on one project to solve a particularly hairy consensus problem but I can't remember which, now.

9

u/OffbeatDrizzle 12d ago

99.99% yes. especially when the connections are tls encrypted. java uses it under the hood extensively, and even if you don't use it in your own code directly, you are probably using / hooking into a library that does (knowingly or otherwise)

you should assume that every java app that accepts user input is vulnerable

2

u/sshwifty 12d ago

Assume any app that accepts input is vulnerable.

7

u/CpnStumpy 13d ago

How I miss the days of BO. Simpler times.

7

u/GinaBun 13d ago

From what I have audited so far, it seems that the only attack surface here is server -> client via favicon, could not find any client -> server at all.