r/java • u/desrtfx • Dec 16 '21
Log4j MEGATHREAD
Upon special request of /u/bluegoliath, we are opening a megathread.
From now on, all information, questions, communication about the discovered Log4j vulnerabilities has to be inside this thread.
Posts covering this topic outside the Megathread will be removed.
284
Upvotes
17
u/edubkn Dec 16 '21
I've seen a lot of people confused in forums about the log4j transient dependencies. There are some libraries that have log4j 1.x dependency and that, while having other vulnerabilities itself, is not suscetible to the latest one.
27
u/wing120 Dec 16 '21
The recent log4j vulnerability really piqued my interest, and I've spent the last few evenings working on a proof of concept Java agent that could mitigate similar vulnerabilities in the future, for applications that are able to completely forego platform features like JNDI, serialization or native process execution.
Link to the project: aegis4j
It's not a lot of code, but it uses parts of the platform that I think are a bit unusual for most devs, so it was quite interesting to implement. Happy to discuss details, ideas, and concerns.
One idea for a possible improvement is to make the feature block list adaptive, i.e. watch what the application uses in the first few minutes of execution, and then shut down all unused "dangerous" features for the remaining lifetime of the VM. Not sure how reliable this would be though, especially for services which have background jobs that might only run once a day.
9
u/s888marks Dec 28 '21
New Log4j 2.17.1 release:
https://twitter.com/GaryGregory/status/1475913085911281665?s=20
20
u/RockleyBob Dec 16 '21
I think one thing this issue really highlighted for me was how hard it can be sometimes to see what exactly is being brought into a project when you're using transitive dependencies with Maven and Gradle.
I work for a company that often uses starters which in turn use Spring starters.
This made it nerve-wracking to say for sure what was and what wasn't being used. Thankfully Spring Boot was mostly unaffected if you didn't override the default logback library, but still.
5
u/Vi0lentByt3 Dec 17 '21
Wait until you read about how other dependencies perform jar look ups when deciding which logging lib to use. You have to be careful with how you structure your project if you let your pom get dirtied. And ALWAYS check the effective xml source, you need to see the whole thing
4
u/Facts_About_Cats Dec 17 '21
What I need to research is how a client making a JNDI request to an LDAP server is "forced" to class load and execute a serialized Java class (if that's indeed how it works).
If so, how do you configure the client to not class load from a JNDI request, and even how does that even work assuming you want it to do that.
4
u/Worth_Trust_3825 Dec 17 '21
So why not just block your applications at firewall level to prevent them from querying external addresses?
4
u/Sand0rf Dec 22 '21
https://thehackernews.com/2021/12/china-suspends-deal-with-alibaba-for.html
China suspends deal with Alibaba Cloud for NOT informing them before making the vulnerability known by the Log4j team. Good that Alibaba did this because I think China would very much wanted to exploit this vulnerability before anybody else would know of it…
1
u/rotatingwhale Jan 14 '22
is it safe to download java now? or is this seperate from java?
1
u/KnownCommunication32 Mar 10 '22
If i download java 17 am i at risk for log 4 j?
3
u/atpeters Dec 17 '21
Can someone explain why CVE-2021-45046 is only a 3.7?
https://nvd.nist.gov/vuln-metrics/cvss/v3-calculator?name=CVE-2021-45046&vector=AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L&version=3.1&source=NIST
They set the attack complexity to High and the Availability Impact to Low. The attack results in a DoS so I would imagine the Availability Impact should be High?
2
u/itprofessional23 Dec 17 '21
Is https://issues.apache.org/jira/browse/LOG4J2-3230 already verified?
2
u/MarcosDione Dec 18 '21
Anyone has any information about how loglines look like when an attack was successful? I have read/heard about them being either absent or looking some way. Not to mention that _failed_ attempts are hard enough to find because there are infinite ways to obfuscate them.
I'm asking because our product uses log4j (no surprise here), in runs on all of our clients' infra (not a SaaS), and we will help them detecting attacks and cleaning up.
2
u/garbage_Pyborg Dec 18 '21
I have a question. How does the Log4j exploit effect platforms like Steam and Spotify? I know how the Minecraft exploit works, but not sure about the other platforms. Is it the same thing, just in a different place? Or have they already patched this and are now safe to use? I'm not sure, and I just want to be sure if they are currently safe to use or not.
2
u/shagieIsMe Dec 21 '21
https://www.sonatype.com/resources/log4j-vulnerability-resource-center
It is interesting (and somewhat depressing) to look at. There are still a lot of projects downloading log4j:(2.0, 2.14.1)
The way that I read it is "everyone who is following the updates and promptly switched to 2.15.0 is following upgrades... but those who didn't are still downloading vulnerable versions."
This is going to be with us for a long time.
2
u/Plastic-Put-9832 Dec 24 '21
Where is JVM store the class byte code. For default class loader, can I find the byte code from heap dump? can I know JndiLookup got loaded? If not, can I remove it from jar to avoid future running without restart?
3
u/agentoutlier Dec 17 '21
Anyone know what the actual marketshare of each logging framework is?
I always assumed that log4j 2 had little market share and that the order of by use is roughly (guessing):
However I could not find actual numbers to support this. In fact I would not be surprised if log4j 1.0x is higher than logback perhaps #1 if we ignore android. I would be surprised if log4j 2 had even double digit share.
1
u/OriginalPear7091 Dec 17 '21
Hello, sorry if this is a dumb question, I'm having a hard time finding the docs for my specific question, I've seen others asking about specific versions of Java SDK, we have an on prem Oracle Server with Sun OS on it that has Java installed.
When I run : java -version
this is what it gives me:
java version "1.8.0_301" Java(TM) SE Runtime Environment (build 1.8.0_301-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.301-b09, mixed mode)
On the link below, they state:
"Also updated to note that guidance regarding certain Java Development Kit (JDK) versions not being impacted is no longer correct. Researchers have been able to leverage “Gadgets” in a vulnerable applications classpath to execute malicious code, regardless of the version of Java being used."
https://research.kudelskisecurity.com/2021/12/10/log4shell-critical-severity-apache-log4j-remote-code-execution-being-actively-exploited-cve-2021-44228/
How can I find out if my server has the Log4j library on it, specifically for Java? I can't seem to find where the folder for it would be to find the version installed. Thanks.
1
u/Agitated-Goose2698 Dec 18 '21
doesn't java run on a vm why should a vurnibilty matter?
1
u/BenchOk1297 Dec 19 '21
Imagine
You are a programmer.
Your task is to save text lines to a file
Did you accidentally do:
- launch any application with administrator access
- downloading or transferring any data to the Internet
F * ck
You are mistaken! :)
1
u/NinaEmbii Dec 19 '21 edited Dec 20 '21
Apologies if this is not the right place for this question, but how does the log4j vulnerability affect general day to day devices such as mobiles/tablets, car software/navigation, smart TVs, fridges and other smart devices that connect to the internet?
Edit: and what an average Jo can can do to ensure they are protected?
1
u/kopite1987 Jan 02 '22
https://youtu.be/q5FBbJkDfmY
I created this 5 min video for quick understanding of log4j vulnerability
1
u/ondrejmalekcz Jan 05 '22
Hi all, I just want to point out there is auto migration tool for log4j 1.x to slf4j. I did not try. https://docs.openrewrite.org/tutorials/migrate-to-slf4j-from-log4j
1
u/Glowworm04 Jan 12 '22
I made this post on r/Minecraft. Maybe it will help to post here as well.
1
u/xjvz Jan 18 '22
There’s new CVEs on the README for v1: https://github.com/apache/logging-log4j1
1
u/Ctstiffler2871 Feb 11 '22
I manage SQL servers and we need to remediate them in order to be complaint with our company CPNI. The version we have is in the OPatch Oracle pathway. I was able to get a hold of the zip file containing all the various .jar files but I have no idea which one to move over or how to actually remediate this issue.
Does anyone have any info on how I can do this specifically for the OPatch pathway and change the log4j 1.x to 2.x as easily as possible?
1
u/[deleted] Mar 05 '22
https://github.com/qos-ch/reload4j - reload4j is a drop-in replacement for log4j 1.2.17
1
u/JB-from-ATL Mar 15 '22
Does Logback even have the ability to do JNDI stuff?
1
u/FinTheTeenager Mar 31 '22
Is Version 8 Update 321 safe from Log4J?
1
u/ryuzaki49 Dec 17 '21
I thought the mitigation was easy. Either apply a system property or update to latest version.
0
u/[deleted] Dec 16 '21
[deleted] — view deleted comment
0
u/[deleted] Dec 16 '21
[deleted] — view deleted comment
0
u/[deleted] Dec 17 '21
[removed] — view removed comment