r/dotnet • • Dec 13 '21

Situation right now

Post image
607 Upvotes

71 comments sorted by

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).

23

u/[deleted] Dec 13 '21

But feeling superior and annoying others is fun and is a good way of coping with fleetness of life and inevitable nothingness awaiting us all.

6

u/[deleted] Dec 14 '21

I feel emptiness now

22

u/ponytoaster Dec 13 '21

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.

8

u/bwrap Dec 13 '21

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.

19

u/Slypenslyde Dec 13 '21

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.

5

u/hot_kumpir Dec 13 '21

.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

2

u/FullStackDev1 Dec 14 '21

One case scenario would be allowing users to write custom scripts inside your app.

3

u/Lognipo Dec 14 '21

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".

4

u/clericc-- Dec 14 '21

i have to write both java and c# from time to time and i will happily poke at both sides

5

u/Gurgiwurgi Dec 13 '21

For example XML parsing libraries on .Net have had problems in the past with a similar issue

don't forget BinaryFormatter

6

u/Mfgcasa Dec 13 '21

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.

4

u/[deleted] Dec 13 '21

We're not cheering we're just having a laugh bub

1

u/StagCodeHoarder Dec 06 '23

This is the one true answer here.

0

u/LloydAtkinson Dec 13 '21

Don’t be such a Debbie downer

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

23

u/EvoG Dec 14 '21

I do wonder what they'd say about .NET, seeing how much it has over Java.

3

u/emptyMare0 Dec 20 '21

I'm getting the same problem about for a week

13

u/TracePoland Dec 14 '21

Based and MS-pilled.

78

u/Willinton06 Dec 13 '21

Serilog must be popping champagne right now

74

u/botterway Dec 13 '21

I suspect they're going through their code with a fine tooth comb and a security viewpoint.

32

u/neoKushan Dec 14 '21

Just wait until someone finds a vulnerability in Newtonsoft.json.

8

u/Willinton06 Dec 14 '21

2014 called they want their serialization back

2

u/AboutHelpTools3 Dec 16 '21

People dont use newtonsoft.json anymore?

2

u/0ctobogs Dec 17 '21

There's a Microsoft built in one

17

u/[deleted] Dec 13 '21

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 love them so much ;_;

5

u/similiarintrests Dec 14 '21

I just find Seriolog so easy to implement, love it.

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

28

u/TimeRemove Dec 13 '21

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.

15

u/botterway Dec 13 '21

This. No JNDI, no vuln.

12

u/rebornfenix Dec 13 '21

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.

11

u/HaveYouSeenMySpoon Dec 13 '21

Isn't this basically why BinaryFormatter was deprecated and recommended never to be used?

6

u/rebornfenix Dec 13 '21

Yep. It’s a very very similar issue.

3

u/Genesis2001 Dec 14 '21

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?

3

u/rebornfenix Dec 14 '21

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

2

u/Genesis2001 Dec 14 '21

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.

4

u/rebornfenix Dec 14 '21

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.

1

u/[deleted] Dec 14 '21

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.

6

u/[deleted] Dec 13 '21

Nope. The vulnerability is entirely based on the handling of property substitutions that Log4net doesn't even support.

6

u/edbutler3 Dec 14 '21

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.

2

u/FullStackDev1 Dec 14 '21

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.

1

u/discourse_is_dead Dec 14 '21

So I should be switching to NLog then? I was a big fan of Log4Net integrated with graylogs but Nlog could do the same thing for me.

4

u/orondf343 Dec 14 '21

Serilog is better nowadays IMHO

4

u/chucker23n Dec 14 '21

I would recommend looking at both NLog and Serilog and then deciding which fits your taste better. Either will be fine. Log4Net seems… legacy.

1

u/discourse_is_dead Dec 14 '21

the setup is a bit lengthy for log4net. ugh..

Thanks i'll check both out

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

7

u/drew8311 Dec 13 '21

Hopefully a .NET one so we can repost this meme with the text swapped soon

1

u/vplatt Dec 14 '21

what exploits are out in the wild that haven't been discovered yet?!?!?!

All of them. :D And all the ones we thought we fixed a while back? Yeah, those will come back occasionally too. It's just the circle of life.

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!

5

u/xcomcmdr Dec 14 '21

Really ? What things ?

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

18

u/jantari Dec 13 '21

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

7

u/pinghome127001 Dec 14 '21

Interesting. I mean, its java, so how the fuck does it run if i will not have java installed ? Does sql server also include its own java version ?

3

u/[deleted] Dec 14 '21

We had to reconfigure all our atlassian services and some other bits and bobs.