by pddpro · 4y ago · 0 comments
Meanwhile, library developers didn't realize app devs would be feeding untrusted strings to their library.
I guess its debatable who's more at fault. I'd argue a logging library that executes the log entries as code is a hell of a footgun.
(Not a Java dev. Maybe log4j had obvious warnings on the tin? If nothing else, there is a UX lesson here.)
What?!
It's a logging library. I would expect users of it to be feeding user input, so that in the case of a bug, I can look at logs to see what input triggered a bug.
Mind you, I also think that original intention was idiotic: Now your java application can't boot up unless your LDAP server is working, and for what? That's the kind of thing that makes global restarts & outage recovery a disaster.
It uses the routing appender that's intended to send logs different ways via string matching and added code that said if the string matching has ${jndi... it should run that jndi code.
The change did what it said it would do. Akin to someone submitting a patch to run eval(log_statment).
That it passed review and was accepted is frightening.
I will admit that I've used it, though. I have an IRC bot written in Python with a "!calc" command that calls eval(). But I use `ast` to build the syntax tree, then walk it and compare every AST object to a white list so you can only use numbers and math operators. Anything else, such as CALLs or strings will throw an error.
- https://blogs.juniper.net/en-us/enterprise-cloud-and-transfo...
- https://www.govcert.ch/blog/zero-day-exploit-targeting-popul...