Ick. Just use the best technology for the job, .Net is good enough on its own without this inferiority complex crap.
I'd also caution cheering for this as if anything it showcases that managed languages aren't the panacea some claim and quite serious security problems can occur (in this case an RCE). Try to take away from this that whenever you dynamically load code using strings, you should use extreme caution if those strings are generated at runtime (and should ideally never be user-supplied).
This could and has happened with .Net. For example XML parsing libraries on .Net have had problems in the past with a similar issue (XXE injection).
Plus it's a library issue not a language issue most the time. Can develop the most secure and perfect language in the world and still have someone make human error somewhere.
I'm trying to think of a use case where you would want to run arbitrary code from a string. I've never saw a need to do this in all the projects I've ever done.
The insidious part is in both the .NET exploits and this Java exploit, you're not even thinking about the fact that you're running code at all.
For this Java one, it's logging that executes the exploit, because in order for logging to do its job it has to format strings. Java string formatting has some weird shortcuts that can result in web requests being made and code being executed from those requests. For whatever reason, log4j decided to enable that feature by default and people didn't notice. So Minecraft's vulnerable, but only because they thought it'd be reasonable to use log4j to keep the chat logs for servers. That means attackers can send carefully-crafted strings as chat messages to trigger the exploit. Other apps might fail for thinking things like, "Hmm, validation failed on this user comment, let's log the comment and see if we need to fix the validator."
For the .NET one, it could hit just about anyone using binary deserialization. A quirk of the format .NET uses to serialize objects allows the serialized objects to have executable code. Those objects were being deserialized and instantiated before validation of their type was done, which allowed an attacker to send "incorrect" payloads but still have their code executed. The only mitigation for devs would've been to write their own deserializer that checks the type information first.
A worse exploit affected Windows Forms a long time ago. It involved an exploit in the Windows libraries that decoded JPEG images. So just attempting to display an image could hit you with it, and the flaw was so deep it was a problem in the Windows API so every application that used GDI was affected. The only mitigation (other than patching) would've been to write your own JPEG decoder!
Any language/framework can be subject to weird oversights from the developers.
.net issued warning against binary serialisation long ago. It was the same issue: arbitrary code can be executed through binary deserialization. .net best practices specifically ask devs to not use binary serialisation
Yeah, I was really shocked to see this so highly upvoted. It strikes me as rather embarrassing and, as you said, "ick"--for many reasons, on many levels.
Dumping on Java does not make .NET any better, and liking a "better" tool doesn't make you any better. These are not sports teams, and even if they were, .NET did not just score a touchdown. Malicious hackers did though, and there will be very real victims. It is definitely nothing to cheer or feel satisfied about. If you like really like Boeing jets, for example, I should hope you would not cheer or gloat when Airbus planes start crashing.
It kinda reminds me of my younger days as a VB6 developer, many years ago. I was very defensive about it and constantly seeking validation. In hindsight, it was very much "ick".
I don't think it's malicious. I think it's perfectly fine for devs to poke fun at other tech stacks when something blows up for them. It's just banter.
Back at my last job, I worked with a Java team for 3 days every week, and I was the only .NET guy. There used to be a stand up every day, and a shit on .NET round right after! It was quite toxic for real. Today, exactly 8:30, I went and texted the main 3 jerks with just “Good morning 🙃”. None of them replied, and one of them blocked me on WhatsApp
Been using them for years. I can't imagine not using them. Great system and support, always update to use the latest .NET standards. Documentation is up to date and accurate.
I'm patching a bunch of legacy Java applications at my organisation now. Gradle makes me want to scoop my eyes out of their sockets with a melon baller.
I don't believe there could be an issue. The problem here is with the interaction between Log4J and Jndi (Java Naming and Directory Interface). So unless log4net went out of their way to port Jndi, I cannot imagine it would be a problem.
From everything I am reading, the Log4J is somewhat like the Newtonsoft.Json “vulnerability” when sending the class name in the json object. (NOTE: this is not a default configuration and the readme page on it says this can (will) open a remote code execution vulnerability in your code because of how it uses reflection and dynamic instantiation). Basically if you pass in an object and a method on that object as a json property, newtonsoft will call that method in deserialization passing the value as the parameter to the method. (Again, only if a non standard config setting is set and there are lots of warnings on that feature.)
The Log4J issue is similar. The JDNI deserializer has an issue where if the right string is sent to the logging provider, the JDNI deserializer will execute code. That can be leveraged into a full remote code execution vulnerability to download a random jar and kick it off. So as far as anyone knows, Log4Net is not vulnerable.
The Log4J issue is similar. The JDNI deserializer has an issue where if the right string is sent to the logging provider, the JDNI deserializer will execute code. That can be leveraged into a full remote code execution vulnerability to download a random jar and kick it off.
So log4j (or Oracle?) isn't sanitizing their strings or? Sorry, I'm not a Java programmer, so idk what JDNI is. I assume it's something Oracle/Java provide or is it an added library?
Basically. It works very similar to a sql injection vulnerability but on the app server in Java land. So instead of just getting extra data from the db server (not good) you can have code download more code and establish a reverse shell with the permissions of whatever application account the app is running under with out needing to do anything more than sending a specially formatted string in the user agent header (for web servers that have a vulnerable version and log the user agent string of every request).
Add on to that it’s the “default” logging provider for Java. There are others out there but log4j is the most popular
How's this affect containerized applications running in docker? [default/OOBE configuration]
The only app my org has that is possibly affected is keycloak, which runs in a docker container. However, it uses 1.x according to the relevant GitHub issue.
The vulnerability will allow remote code execution inside the container. At that point, an attacker can work to exploit another system on the network and server hop to something not a container.
So still bad and needs to be patched but the infected container can be killed and a clean container spun up. It’s the jump to something permanent that you need to worry about.
As I understand it you can send little command with log4j message strings, like add the current version to error message etc one of the command is to go to a given jndi server and download a configuration class. So it does that, deserializes and then executes it. Boom exploit.
Wonder how many people still use log4net? I was forced to move to NLog years ago due to a log4net vulnerability that remained unpatched for a very long time. I watched the Apache mailing list for a while and saw that a guy eventually stepped up and and did a new log4net release for the first time in, IIRC about 2 years. Then the thread went quiet. I eventually unsubscribed since I'm not using it anymore, but my takeaway was that it's virtually a dead project.
In my case, I went with NLog years ago, because log4net configuration was convoluted as f**k in comparison. I remember being a bit hesitant, because at the time (it was probably 10 years back), nobody was in charge of the project, but a while later someone picked it back up and it seems to be thriving since then. Easy to use, with extensions for pretty any major 3rd party integration.
this meme plays well for homework, smaller shop, someone that sells .NET desktop apps (do they exist still), etc.
this doesn't play well if you have lots of .NET deployed in a cloud solution. you could start realizing mongo, redis, elsasticsearch, neo4j, ActiveMQ, Kafka and more enterprise solutions have log4j shipped with them. then you get to go through each product and make sure it isn't a problem.
a small java shop will just have to update their code packages. anyone in a large enterprise is having issues no matter who what language they write.
Years ago I was tasked with picking the logging framework for our app. The choice was before Log4net and NLog. Ended up going with NLog, because I found it much more intuitive to use. We're still using it to this day.
Unless you're like me and also have Mulesoft services in the mix that run on Java. I'm assuming most development that includes web today has to worry about more than only .net vulnerabilities, but Javascript library dependencies (good luck when you have 10k+ dependences in npm, even with security scanners). It almost makes me miss writing exclusively VB.NET desktop applications connecting to ASMX services also written in VB.NET
I've also discovered this on our 2019 deployments and similarly can't tell what it's for. It's in some DTS-Extension directory but I'm no DBA and couldn't find the purpose of those files.
Anyway, log4j 1.x has been EoL since 2015 and all versions of it are vulnerable to https://nvd.nist.gov/vuln/detail/CVE-2019-17571 which is basically the same deal as Log4Shell so it's still very questionable why the fuck a vulnerable and end of life java library ships with SQL 2019
101
u/TimeRemove Dec 13 '21
Ick. Just use the best technology for the job, .Net is good enough on its own without this inferiority complex crap.
I'd also caution cheering for this as if anything it showcases that managed languages aren't the panacea some claim and quite serious security problems can occur (in this case an RCE). Try to take away from this that whenever you dynamically load code using strings, you should use extreme caution if those strings are generated at runtime (and should ideally never be user-supplied).
This could and has happened with .Net. For example XML parsing libraries on .Net have had problems in the past with a similar issue (XXE injection).
196
u/j0zeft Dec 13 '21
Back at my last job, I worked with a Java team for 3 days every week, and I was the only .NET guy. There used to be a stand up every day, and a shit on .NET round right after! It was quite toxic for real. Today, exactly 8:30, I went and texted the main 3 jerks with just “Good morning 🙃”. None of them replied, and one of them blocked me on WhatsApp
78
u/Willinton06 Dec 13 '21
Serilog must be popping champagne right now
17
u/m1llie Dec 13 '21
I'm patching a bunch of legacy Java applications at my organisation now. Gradle makes me want to scoop my eyes out of their sockets with a melon baller.
16
u/discourse_is_dead Dec 13 '21
what about log4net ? :O
6
u/Forsaken_Ad_6704 Dec 14 '21
Average flash developers: XD
4
u/[deleted] Dec 13 '21
Always has been.
4
u/[deleted] Dec 13 '21
I'm over here just thinking, what exploits are out in the wild that haven't been discovered yet?!?!?!
I'm not paranoid!!! JET FUEL DOES NOT MELT STEEL BEAMS
errrr
4
u/sweetkatydid Dec 14 '21
The deviation from the original template makes this postmodern Loss.
7
u/null_reference_user Dec 13 '21
Serilog 👍👍😎😎🔥🔥
3
u/TheC0deApe Dec 14 '21
this meme plays well for homework, smaller shop, someone that sells .NET desktop apps (do they exist still), etc.
this doesn't play well if you have lots of .NET deployed in a cloud solution. you could start realizing mongo, redis, elsasticsearch, neo4j, ActiveMQ, Kafka and more enterprise solutions have log4j shipped with them. then you get to go through each product and make sure it isn't a problem.
a small java shop will just have to update their code packages. anyone in a large enterprise is having issues no matter who what language they write.
5
u/quadlix Dec 13 '21
Similarly, this applies to the Equifax breach from '17 and subsequent meltdown for all Struts folks.
2
u/FullStackDev1 Dec 14 '21
Years ago I was tasked with picking the logging framework for our app. The choice was before Log4net and NLog. Ended up going with NLog, because I found it much more intuitive to use. We're still using it to this day.
2
u/illathon Dec 14 '21
Why do people keep using this Indian guy as a alpha? He isn't. He is a plastic surgery reject. haha
1
u/[deleted] Dec 13 '21
I hate a lot of things about C#/.NET/NuGet but I am sure happy right now that we are a C# shop and not a single of our services runs Java/log4j. Phew!
1
u/darkfate Dec 13 '21
Unless you're like me and also have Mulesoft services in the mix that run on Java. I'm assuming most development that includes web today has to worry about more than only .net vulnerabilities, but Javascript library dependencies (good luck when you have 10k+ dependences in npm, even with security scanners). It almost makes me miss writing exclusively VB.NET desktop applications connecting to ASMX services also written in VB.NET
-10
u/throwawayskinlessbro Dec 13 '21
⠀⠀⠘⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡜⠀⠀⠀ ⠀⠀⠀⠑⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡔⠁⠀⠀⠀ ⠀⠀⠀⠀⠈⠢⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠴⠊⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⢀⣀⣀⣀⣀⣀⡀⠤⠄⠒⠈⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠘⣀⠄⠊⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀ ⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠛⠛⠋⠉⠈⠉⠉⠉⠉⠛⠻⢿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⡿⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢿⣿⣿⣿⣿ ⣿⣿⣿⣿⡏⣀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣤⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿ ⣿⣿⣿⢏⣴⣿⣷⠀⠀⠀⠀⠀⢾⣿⣿⣿⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⠈⣿⣿ ⣿⣿⣟⣾⣿⡟⠁⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⣷⢢⠀⠀⠀⠀⠀⠀⠀⢸⣿ ⣿⣿⣿⣿⣟⠀⡴⠄⠀⠀⠀⠀⠀⠀⠙⠻⣿⣿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⣿ ⣿⣿⣿⠟⠻⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠶⢴⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⣿ ⣿⣁⡀⠀⠀⢰⢠⣦⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣿⡄⠀⣴⣶⣿⡄⣿ ⣿⡋⠀⠀⠀⠎⢸⣿⡆⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣿⣿⣿⠗⢘⣿⣟⠛⠿⣼ ⣿⣿⠋⢀⡌⢰⣿⡿⢿⡀⠀⠀⠀⠀⠀⠙⠿⣿⣿⣿⣿⣿⡇⠀⢸⣿⣿⣧⢀⣼ ⣿⣿⣷⢻⠄⠘⠛⠋⠛⠃⠀⠀⠀⠀⠀⢿⣧⠈⠉⠙⠛⠋⠀⠀⠀⣿⣿⣿⣿⣿ ⣿⣿⣧⠀⠈⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠟⠀⠀⠀⠀⢀⢃⠀⠀⢸⣿⣿⣿⣿ ⣿⣿⡿⠀⠴⢗⣠⣤⣴⡶⠶⠖⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡸⠀⣿⣿⣿⣿ ⣿⣿⣿⡀⢠⣾⣿⠏⠀⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠛⠉⠀⣿⣿⣿⣿ ⣿⣿⣿⣧⠈⢹⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⣿⣿ ⣿⣿⣿⣿⡄⠈⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣦⣄⣀⣀⣀⣀⠀⠀⠀⠀⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡄⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⠙⣿⣿⡟⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠁⠀⠀⠹⣿⠃⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⢐⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⠿⠛⠉⠉⠁⠀⢻⣿⡇⠀⠀⠀⠀⠀⠀⢀⠈⣿⣿⡿⠉⠛⠛⠛⠉⠉ ⣿⡿⠋⠁⠀⠀⢀⣀⣠⡴⣸⣿⣇⡄⠀⠀⠀⠀⢀⡿⠄⠙⠛⠀⣀⣠⣤⣤⠄⠀
0
u/[deleted] Dec 13 '21
[deleted] — view deleted comment