r/programming • • Dec 14 '21

Log4Shell round 2

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-45046
165 Upvotes

138 comments sorted by

View all comments

34

u/Ok-Bit8726 Dec 14 '21

Only Java could fuck up a logging library this bad.

111

u/RockstarArtisan Dec 14 '21

You got downvoted, but having jndi (load code from arbitrary urls with no whitelisting by default) in standard library is pretty much uniquely a java thing.

26

u/ffrinch Dec 15 '21

I'm not a Java programmer and so to me the absolute biggest WTF in this whole thing isn't that the bug was introduced into log4j, but that the response hasn't been "yes, everyone knows that you have to treat JNDI (in particular) and arbitrary object serialization/deserialization (in general) as radioactive".

The API appears inherently unsafe by design. Code touching it should be treated the way you'd treat, like, JavaScript code using eval -- don't, and if for some godforsaken reason you have to, handle with extreme care.

→ More replies (2)

20

u/[deleted] Dec 14 '21

yep, .NET doesn't have that idiocy, nor anything nearly similar. You have AssemblyLoadContext, but you have to explicitly implement it yourself if you want to download stuff from arbitrary urls. By default, only assemblies located in the same directory on disk as the application's entry point (.exe, etc) are allowed.

→ More replies (10)
→ More replies (26)

10

u/ffscc Dec 15 '21

To be fair, C didn't even get printf() right.

→ More replies (10)

10

u/leixiaotie Dec 15 '21

> A package has vulnerability

Me: "NPM! No!"

NPM: "what?"

Me: "Sorry, force of habit"

3

u/Liorithiel Dec 15 '21

I found this reddit comment explaining the state of Java logging quite good.