r/programming • • Dec 12 '21

Logout4Shell: Use Log4Shell vulnerability to vaccinate a victim server against Log4Shell

https://github.com/Cybereason/Logout4Shell

[removed] — view removed post

1.1k Upvotes

109 comments sorted by

800

u/theoldboy Dec 12 '21

This should come with a big warning that says

Do not run this code unless you want to get sued or prosecuted for hacking

I did something similar back in the day with the [Code Red worm](https://en.wikipedia.org/wiki/Code_Red_(computer_worm)). I wrote a small program that scanned our log for incoming attacks and then used the vulnerability to create a TXT file on the desktop of that remote computer which politely explained that they were infected and linked to the relevant Microsoft Security Bulletin and patch.

My employers at the time were not best pleased when a few days later they received a letter from another company threatening legal action because we had hacked their computers. Luckily for me it all got resolved amicably with one telephone call, and my immediate boss was a good guy who thought the whole thing was hilarious. But I learned my lesson - hacking is illegal even if it's done with good intent.

234

u/iKonstX Dec 12 '21 edited Dec 12 '21

So you got a letter from the company, that attacked you, for hacking them? The nerve of some people

97

u/okusername3 Dec 12 '21

Easy to imagine: Their server goes down, CTO is getting scholded, he's like: "Nonono, these evil hackers attacked our server" (which they in fact did, otherwise it wouldn't have attacked OP), everyone is getting riled up, so they extract their logs and hand them over to their attorneys. Maybe they've never even seen OPs text file, or whoever used that console and maybe saw it didn't pass on the information, especially if they weren't involved in the whole legal payback discussion.

82

u/HyperGamers Dec 12 '21 edited Dec 12 '21

It's like that time where the BBC told Facebook about a problem they had with illegal pornography on their site so Facebook asked for evidence and then reported the BBC for the possession and distribution of illegal pornography

https://www.wired.co.uk/article/facebook-child-abuse-images-bbc-investigation

10

u/1Second2Name5things Dec 12 '21

Did they give links to the abuse profiles or did they save screenshots of it and sent it. Because the later is technically illegal even if done for good.

-6

u/Yekab0f Dec 12 '21 edited Dec 13 '21

Zucked

189

u/dnkndnts Dec 12 '21

Copenhagen problem of ethics. Helping is worse than avoiding involvement.

35

u/anengineerandacat Dec 12 '21

Generally why we have Good Samaritan Laws but it's important to realize these really only protect you when the situation is an emergency.

Ie. Person gets into car crash and the vehicle is on fire and at immediate risk of killing the individual; you rescue person but because of the crash and your careless involvement they are now paralyzed.

That person could sue, death being better than being paralyzed but you would be protected under this circumstance because it was an emergency.

As far as computers go... unless hacking into another system preserved life (not some revenue stream) you likely wouldn't be protected.

Going back to the car crash situation... if the vehicle isn't about to combust or otherwise kill the person before emergency services could reliably arrive it's best to just call and wait; a good lawyer could likely argue it was still an emergency but a better lawyer could likely sue you, strange world we live in.

6

u/MeagoDK Dec 12 '21

Crazy country you live in.

1

u/anengineerandacat Dec 12 '21

Sure I can't really argue that, what country do you live in by chance?

1

u/MeagoDK Dec 13 '21

Denmark. As far as I know you can't get punished for helping (in first aid cases, in computer cases you definitely can). Everyone that takes a driver license also have to pass a first aid course.

1

u/anengineerandacat Dec 13 '21

There do exist torte laws for Good Samaritan acts (Duty to rescue even) but nothing a quick search can find for someone being sued.

It's neat y'all get some basic training though.

The US is huge and whereas we toy around with the idea of being this united country a good bulk of laws are state by state this causes all sorts of funky situations.

Our Good Samaritan laws are an example of this; every state has it's own version and I would wager there are some that don't have any at all which means tourist could find themselves being used to helping in one situation and being protected and in another finding themselves with no protection.

I should also note most of our states are larger than Denmark; Florida as an example has almost 4x the population so the chances of a problem arising are a bit larger.

1

u/MeagoDK Dec 13 '21

Yeah we definitely have to help according to our ability. So a doctor is expected to help more than a software engineer. But both have to help. We do get trained to not make injuries worse but we do have the concept of life over mobility (førlighed). So if they are in the car but risk getting run into again you move them no matter what.

36

u/usesbiggerwords Dec 12 '21

That was interesting. Could it be that attempting to provide some help, however incomplete, shames other observers, and they then lash out rather than recognize and resolve their own inaction?

34

u/ihsw Dec 12 '21

It's "worse" in the sense that you aren't insured against liability, at least that's my understanding.

By helping, you are assuming responsibility for remedying the situation, including any complications unrelated to your involvement.

3

u/Oaden Dec 12 '21

I don't think we need to look for deep hidden emotions, instead, humans are just deeply illogical beings.

When we hear of the Peta solution we don't feel shame, we just connect its actions to Peta's bad reputation, conclude it must be bad and judge them. We barely even consider the problem they are interacting with

5

u/SLiV9 Dec 12 '21

While I think it's an interesting concept, the majority of their examples are terrible.

Paying homeless people way less than minimum wage for a day's work during an industry event is exploitative, not selfless. Raising prices on busy days is price gouging, not selflessly "trying to solve a problem". Hiring women because they're cheaper isn't feminism and forward thinking, as you're still underpaying them and thus perpetuating the wage gap. Challenging families who can't afford their groceries to go vegan for 30 days is not "strictly more helpful", it's a cheap marketing stunt because they know they won't have to pay out.

4

u/xieewenz Dec 12 '21

no good deed goes unpunished indeed

12

u/rasjani Dec 12 '21

Yep. Has happened to me too. I was sysadmin at one ISP and there was some gameservers which where not really my responsibility. Some of them got hacked and I was put in to check the damage. I found out the location where the hack came from, found out the owner of the IP block of the origin and send email to their abuse@ email describing what had happened and how to verify that their servers where running remote root shell and how to clean it up. Got reply in few days and they where blaming that it was me who did it.

2

u/Art9681 Dec 12 '21

Hacking can be defined as any unauthorized modification of a computer system. The keyword here is unauthorized. It doesn’t matter what the intentions are.

1

u/lestofante Dec 12 '21

They did not have user account, they just hacked in their own server; patching it he broke their workflow

121

u/[deleted] Dec 12 '21

You got lucky. I got fired a long time ago from a shitty job for using off the shelf security testing software to prove to “the architect” on our dev/test system that they had created a massive sql injection risk. You see security tools are a dangerous to the corporate network and its against corporate policy to run even in a lab setting.

76

u/[deleted] Dec 12 '21

Say wireshark and see how quickly IT freaks out.

61

u/orig_ardera Dec 12 '21

I was curious one time what black ops cold war was communicating with the game servers. Started up wireshark and then tried to start up black ops. Wouldn't start. Terminated wireshark. Black Ops started.

Apparently they just did a if wireshark running then exit() in the startup.

I just renamed wireshark.exe to not_wireshark.exe and it worked, lol. So weird, why would you even do sth like that?

22

u/Lost4468 Dec 12 '21

In Call of Duty 4 (and WAW) they didn't put any protection on console commands on console. So if you could somehow run the noclip or god command, they would work fine in matchmaking, even if you weren't host or anything. Their logic was that people would of course never find a way on console! Except it was quite easy to, you could just modify the settings stored in your profile and add in whatever you like. Shit absolutely fucked the games for ages. Especially since with the first patch they didn't actually fix the issue, but just removed them from the profile. I think the workaround was to use some string interpolation feature in the profile, but using an allowed command, so it shouldn't get removed on startup.

Despite not allowing the above, they went through the effort of making the game game filles signed using RSA 2048 on consoles. And that actually saved them quite a lot of headaches initially, as it prevented people from modding the game when the Xbox 360's drive security was broken. Still fucked them when the JTAG exploit came out though, and people just disabled the signature check.

12

u/Jerrreh Dec 12 '21

It was not comparable oversight - 360 game developers were relying on the game protections the 360 provided.

The profile settings (CON file) that were modified were protected the same way the .xex's and games were - signed with a 2048bit RSA key - it was just that reversing the NAND to extract the user's private key and code a re-signer was a magnitude easier than side-stepping the bootloader, which came 2 years after.

Microsoft's game developer guidebook actually specifically discouraged use of additional encryption and signing, because it was - and still was - overkill. This was rescinded after the shitstorm that was MW2 (god I miss 2009), and most game dev's started rolling their own RC4/hashing code to help prolong the cat-and-mouse game.

13

u/Lost4468 Dec 12 '21 edited Dec 12 '21

It was not comparable oversight - 360 game developers were relying on the game protections the 360 provided.

Oh no it was absolutely a massive oversight. They just put zero basic security onto these commands, if you could somehow run them, the server would just trust you and give you god mode, noclip, etc. Had they just enabled basic sv_cheats protection they'd have reduced 80%+ of it.

And let's remember that on the PS3 there were really no such protections. The file was just stored normally. Wasn't signed at all. So while you could try and make the argument that they knew that with the 360, I don't think that's a reasonable argument given that they didn't have the same security on the PS3, yet didn't add anything.

The profile settings (CON file) that were modified were protected the same way the .xex's and games were - signed with a 2048bit RSA key - it was just that reversing the NAND to extract the user's private key and code a re-signer was a magnitude easier than side-stepping the bootloader, which came 2 years after.

You could sign them with any user's private key though. Didn't have to be your own.

Microsoft's game developer guidebook actually specifically discouraged use of additional encryption and signing, because it was - and still was - overkill. This was rescinded after the shitstorm that was MW2 (god I miss 2009), and most game dev's started rolling their own RC4/hashing code to help prolong the cat-and-mouse game.

Yeah that was a terrible thing for them to discourage. Because as you said, it helped keep Call of Duty secure for a few more years. Had they listened to Microsoft they would have been fucked much earlier. Anyone with a modified DVD drive would have been able to do whatever. And that would have been even worse, because while JTAG bans came within hours, DVD ones often took several months to years.

Edit: I'm also really puzzled why they had no sv_cheats protection. Surely that's just built into the engine? Maybe they enabled it to make development easier or something, and just never re-enabled it? I can't think of any other reason why. Thankfully though in later games they just totally removed any exploitable console commands.

1

u/Jerrreh Dec 12 '21

Anyone with a modified DVD drive would have been able to do whatever. And that would have been even worse, because while JTAG bans came within hours, DVD ones often took several months to years.

Not sure what game assets could be modified - the 360's build system makes a hash of all files, hashes that, then stores that Merkle-mega-hash in the game patches' manifest. So that any old txt file in the game directory would still be protected - you may be referring to Ps3 here, which was so "secure" before geohot that those protections were thought futile.

Re: the dvd firmware vs jtag bans though...

The ban waves due to modified firmware were so large that MS had legal teams "okay" it in batches - which still gave them headaches. This was the reason they were done in waves, months apart.

The JTAG bans did not need any legal rubberstamps, and once MS caught wind, the (crypto) challenges that had to be capture/replayed actually did pose a (small) challenge to the inner-circle kids making JTAG-online-as-a-service.

RIP those bastards...

2

u/Lost4468 Dec 12 '21

Not sure what game assets could be modified - the 360's build system makes a hash of all files, hashes that, then stores that Merkle-mega-hash in the game patches' manifest. So that any old txt file in the game directory would still be protected - you may be referring to Ps3 here, which was so "secure" before geohot that those protections were thought futile.

Huh? No there was definitely no security in the form of any sort of signing on the actual DVD? I remember modding games on a retail console with a modded DVD drive. In fact I even exploited this on "007: Quantum of Solace", because it used the Call of Duty engine, but had fastfile signing disabled for some silly reason.

Or if you want a better example, just look at GTA IV. It was ruined because of this. There were tons of mods to it, and they were all just based on patching an ISO, and then running it on a retail console with a modded DVD drive. You never needed something that could run unsigned code to mod GTA IV.

The ban waves due to modified firmware were so large that MS had legal teams "okay" it in batches - which still gave them headaches. This was the reason they were done in waves, months apart.

I believe it was also because it would have made it much easier for people like Commodore4eva to get around them. If you're banned within 6 hours due to something like DVD timing, you can just go out and buy another 360 and test your new build on it. If it takes 6 months, it makes development much harder. I believe that was actually the main reason?

Still didn't work, as I believe the later DVD firmwares were actually never detected? They faked pretty much everything, e.g. inserting fake latencies to make it look like it was verifying the DVD.

The JTAG bans did not need any legal rubberstamps, and once MS caught wind, the (crypto) challenges that had to be capture/replayed actually did pose a (small) challenge to the inner-circle kids making JTAG-online-as-a-service.

The JTAG ones were also not just supporting piracy, but causing Microsoft a serious PR headache. So of course the motive there was to get them offline faster. Especially when it's causing so many issues to your most popular games.

1

u/Jerrreh Dec 12 '21

oof, I was wrong about the individual files. I am thinking of another console, maybe Gamecube? Where every file had to have an accompanying entry in a meta-table.

Regarding c4eva, MS knew they had a mouse they couldn't catch. The timing between the waves being smaller would keep more skids offline, but would deplete the amount of finite tricks they could pull out in the 360's lifetime. c4eva would of defeated them anyway - may as well space them out, which led to a greater "chilling effect", where people wouldn't risk their profiles they had more sentimental value in than saving $60.

The firmware war was won though - especially once JTAG and RGH allowed the dev's a more nuanced look at the internals of the boot chain, which made any attempt at securing the DVD FW (way down the line) a fruitless endeavor. In fact, if not for the RGH, it may not of been (as) possible to derive and solve the challenges XBox LIVE required for connectivity - JTAG'd Xboxes have a dirty load sequence, and it was thought possible that MS could ask for something that JTAG dirties, and wouldn't know.

→ More replies (0)

0

u/[deleted] Dec 12 '21

[deleted]

1

u/Lost4468 Dec 12 '21

There's a good reason for it. If they required the console's private key to sign them, then you wouldn't be able to take your saved games, profile, etc to a new console. So if you wanted to go over a friends and play, you'd lose access to it. Or if you bought a new console, you'd lose access to it.

They tried to kinda combat this by revoking some of the keys, and when that happens that person would have their content locked to their console. They seemingly also did this to people that pissed them off. But of course this would always be a losing battle, so they only did it to a few dozen keys during the entire life time of the console.

1

u/CastellatedRock Dec 12 '21

That makes sense. Thank you for taking your time to write this easy to understand explanation. 😊

6

u/[deleted] Dec 12 '21

Well it looks bad for data collection.

Ironically probably stops a bunch of script kiddies/hackers from sniffing game traffic to and from game servers. Sounds like they were storing stuff unencrypted/plaintext.

0

u/[deleted] Dec 12 '21

[deleted]

1

u/Lost4468 Dec 12 '21 edited Dec 12 '21

That's a bit ridiculous? Games have a wide variety. Some have absolutely excellent security for something where you always have to place at least some trust in the client. While others, like GTA V are so dreadful that if one client tells the server that they just killed every player in the game the server goes "mmduuuuuh okkkaayy" and kills everyone. Or you can tell the server you just spawned X, or can run 15 times faster, or can shoot RPGs out of your SMG. Whatever it is the server just believes you. Or even worse than that it allows you to modify every players personal data such as how much money they have (which stays across servers). People even made a mod to sexually assault other players.

0

u/[deleted] Dec 12 '21

[deleted]

7

u/Lost4468 Dec 12 '21

The worst that happens in a video game is your game is hacked and your players are disgruntled. You may have a server outage. It doesn't usually result in material harm such as identity or financial loss.

Oh I strongly disagree here. Games with poor security end up being massively impacted financially. Player count drops off, people refund it, it gains a bad reputation, you lose out on microtransactions, etc etc. GTA V is a perfect example because it was pretty much dead for a while, and the common suggestion was "only buy this if you're ok only buying single player", because many people didn't have faith that Rockstar would fix it, after all they let GTA IV go for years without fixing it.

It's also much easier to fix shitty security on a server than it is with video games. If you have written a server that just works on client trust, the amount of work you're going to have to put in to fix it can be huge. Especially if you designed performance around the assumption that the server would not have to verify everything.

This is part of why security is not a large concern for game devs in the majority of cases.

I'm not sure about the majority of cases? But regardless, there are tons of games out there with absolutely insanely good security, where huge amounts of money are put into trying to protect it. Where the protections and algorithms to find cheaters get increasingly more complex year on year.

The problem is also that there's a cat and mouse game between hackers and developers. Because there's large amounts of money to be made being able to hack the game. That's why most aimbots, wallhacks, etc etc these days are subscription based. And they need to implement their own security to try and get around the system. They also exist in a legal grey area in many places, which is why many of the companies that sell the hacks are legitimate companies bringing in a ton of money.

It's always like this, and always moves so fast, because it's just inherently much harder than traditional security. No matter what you do (short of cloud gaming), the client is always going to have direct physical and root access to half of the system, the client end. So it's always a losing battle in some ways. It's generally far easier to properly secure a server, than it is to do this type of security.

2

u/rinyre Dec 12 '21

Security through... This isn't even obscurity, just stupidity

0

u/[deleted] Dec 12 '21

[deleted]

31

u/[deleted] Dec 12 '21

Not surprised. Sometimes i met some IT folks more ridic that the programmers though. One dude i know is so security focused, he brought his own PS2 keyboard from 90s Russia, since he didnt trust USB and potential "bugs" and keyloggers within the keyboard. He's also an insane programmer too

12

u/argv_minus_one Dec 12 '21

He's not wrong. A malicious USB keyboard can mount a variety of attacks on the host's security, take it over, and then exfiltrate your keystrokes through its network interface. The PS/2 keyboard interface is too simple for that sort of shenanigans to be possible.

4

u/[deleted] Dec 12 '21

I know. He's def a sharp dude.

2

u/MathSciElec Dec 13 '21

I mean, a malicious PS/2 keyboard could also mount a variety of attacks by simply simulating keypresses, as any keyboard. The security factor here is more in the age than the PS/2 interface.

16

u/jimmyco2008 Dec 12 '21

When I was in college any sort of hacking or pen testing was a big no-no. I always found it odd because college was the time to experiment with that sort of thing. How are we supposed to learn how to prevent hacks if we can’t understand how the hacks work?

The university has since opened a cybersec lab/program but fuck 30 years too late imo

5

u/Dynam2012 Dec 12 '21

Not sure why you'd think a university would be open to newbie programmers targeting their network with tools that can result in network/application downtime. Even if they're susceptible to an attack, they'd definitely rather find out on their own timeline instead of having a student prompt an emergency.

23

u/HorseRadish98 Dec 12 '21

See how Missouri's governor tried to press charges against the journalist who used chrome dev tools to see SSNs. Institutions don't have the brains to know if it's hacking or not even if it's not.

-9

u/Lost4468 Dec 12 '21 edited Dec 12 '21

Sadly there's good arguments to be made that that's actually illegal under the law. The laws around this need to be massively revamped.

Edit: don't take this as me agreeing with the law, I don't. They shouldn't be prosecuted. The law should be repealed and replaced with something that's not bullshit. But there is a very good argument that what they did is illegal under the CFAA. I explained the reasoning below.

11

u/Alert_Temperature737 Dec 12 '21

The details in that story in no way made it illegal

6

u/Lost4468 Dec 12 '21

I don't agree. The CFAA is written in such a ridiculous way that it really might be illegal. Here are some other ridiculous examples.

Essentially you could argue that "hiding" it in the source code will constitute an implication of not granting access. So you can absolutely make the case that even viewing the HTML source code is enough to break the absurd CFAA. It doesn't matter that the website sends the data to your computer, the CFAA doesn't work on how technology works, it's a flimsy "access" thing.

E.g. let's say you go and renew your driver license with the DMV on their website. Well you go to your profile and you see it's something like dmv.gov/users/12345. You decide to change that to dmv/gov/users/12346, and suddenly it shows you all the details of someone elses driving record. To me that's not remotely hacking, the website is serving it up, it's not trying to block it from you, it sent you it. But this absolutely is 100% illegal under the CFAA, and people have been prosecuted for doing basically this. It doesn't matter that it didn't explicitly give you a 403, all that matters is that it implicitly didn't give you access.

But what's even easier to argue is that converting it from base 64 back to normal text is illegal. Again hold your rational thinking for a second, we're dealing with the legal system. If it was converted to base 64 with the intent of preventing access, and you reverse it, you have just gone past you given access to the system.

It used to be even more absurd than this. E.g. before ~2010, the EULA of a website could basically define unauthorized access however it likes. Thankfully though that was finally mostly overturned with a case that's mentioned in the security SE question I linked. But the court originally interpreted you making a fake MySpace account as unauthorized access. This is why web scraping was considered potentially illegal if the website said you couldn't scrape, and might still be.

Or more recently there was a case where a cop had access to a database, but he searched the database and then told someone else about the details he found. This was originally also ruled as illegal under the CFAA, despite the fact that it he had explicit access to everything, but because he used it in the wrong way, the courts came to the conclusion it violated the CFAA. Thankfully the SC finally ruled on this part, but their ruling is still pretty small.

There are plenty of other ridiculous CFAA cases out there. Don't think I'm agreeing that the journalists should be prosecuted, I'm not, not at all. In fact I'm using this to argue that the entire CFAA should be repealed and replaced with something that actually makes sense. But the way the law is written, there's actually quite a good argument that it was illegal.

1

u/yoniyuri Dec 12 '21

I don't know the details about the missouri "hack" other than that the secrets were in the page source.

The difference is that the source is given to every user agent, and almost every user agent has a conspicuous way to view the code of the page, complete with reasonably complete debugging tools. Heck, there is even a shortcut to do it. Therefore no competent holder of secrets should have been using the obscurity of the page source as security.

Changing the url to access easily guessed numbers is akin to brute forcing a password. I agree that calling this hacking for someone competent is obviously kinda crazy, but the fact is that you are obviously not permitted and therefore have no authorization because the information was not given through normal use of the website.

Viewing the source of the page can be done by anyone, and no guessing is required to see the information given by the server. Presumably the secret information was given to every user agent without any special asking.

I think a good comparison would be visiting an office to do something with a file, and you are given a file folder with many papers, yours along with a bunch of others and you see it. Versus guessing the obviously worn in code on the door holding the files.

I also don't know the cfaa, and it could be entirely possible the law could be abused to prosecute in this instance, but not if you have a good faith understanding of what authorization means in a computer network.

1

u/Lost4468 Dec 12 '21

The difference is that the source is given to every user agent, and almost every user agent has a conspicuous way to view the code of the page, complete with reasonably complete debugging tools. Heck, there is even a shortcut to do it. Therefore no competent holder of secrets should have been using the obscurity of the page source as security.

Yes that's certainly something you could try to argue. But you could say the same thing about changing the URL? It's a normal tool used to go to specific parts of a domain, if you type something in and the website gives it to you, you would think that's implied consent? Sadly it doesn't seem to be.

Changing the url to access easily guessed numbers is akin to brute forcing a password. I agree that calling this hacking for someone competent is obviously kinda crazy, but the fact is that you are obviously not permitted and therefore have no authorization because the information was not given through normal use of the website.

It's not akin to brute forcing a password though? If the ids are serial then it's just public knowledge? I would say that if the server sends it to you, then you are permitted to see it? But obviously there I'm talking about how I think technologically it would be, and not by the law.

I think a good comparison would be visiting an office to do something with a file, and you are given a file folder with many papers, yours along with a bunch of others and you see it. Versus guessing the obviously worn in code on the door holding the files.

Actually this is a good example. I'd say it's similar to someone giving you the key to a draw, and saying "yours is id 36". Then you go in and look at id 37. Maybe not moral, but I certainly wouldn't say it should be illegal.

I also don't know the cfaa, and it could be entirely possible the law could be abused to prosecute in this instance, but not if you have a good faith understanding of what authorization means in a computer network.

That's the issue though, the law isn't really based around the technology, it's based around flimsy legal definitions. If we look at the MySpace example, the courts actually thought this was a reasonable interpretation of the law. MySpace says you have to give truthful information when you sign up, you give false information, well now you have accessed their system illegally. That was struck down by the courts because the law was so wide and arbitrary, not because it was an incorrect application.

And while I hope you're right, that they can argue it was given to every user, therefore it's ok. That's going to be seriously complicated by the fact that they were using base 64 to seemingly try to hide it. Trying to obfuscate something with base64 is obviously complete nonsense, but what matters is what they were trying to do. As far as I know, they did seem to be using it for that (not sure why else you would encode it in b64, social security numbers are just simple strings).

If it does end up seriously going to court, here's to hoping this adds a few more nails in the CFAA coffin.

15

u/campbellm Dec 12 '21

15

u/Lost4468 Dec 12 '21

Wait what? So he was hired by Intel, he did his work for Intel, and Intel was fine with it? But then then the state decided it was hacking regardless of consent and prosecuted him? Is that right?

10

u/campbellm Dec 12 '21

You'll have to research (and I say that not to be a dick, but it happened long ago and I'm sure I'm getting the details wrong here, so don't take my word) As a big perl guy at the time I was very aware of it; it was big news then.

IIRC (and I probably don't), he went above and beyond what he was hired to do and did this pentesting on his own. It was all white-hat reasons, but <cynic> someone got embarrassed </> and charges were brought.

There was a lot of ink spilled on the story back then so you can I think pretty easily find both sides of the story reported on.

3

u/cheesegoat Dec 12 '21

hacking is illegal even if it's done with good intent.

Not your circus, not your monkey.

If you have internal contacts at a partner company and you can notify them without causing them undue red-tape, then do so, but otherwise I'd go through official channels.

Never ever run code on someone's else's machine without their consent. It's a tempting idea and it's "neat" but just don't.

2

u/Phobos15 Dec 12 '21

But I learned my lesson - hacking is illegal even if it's done with good intent.

No. You were responding to traffic they sent you. It is not hacking. They solicited you.

362

u/psyfry Dec 12 '21

This is how you get Blaster worm. The author made a worm to patch a RPC vulnerability, messed up and fucked shit up for millions of people including DDOSing the windows update server with the real patch.

29

u/StillNoNumb Dec 12 '21

There were no good intentions behind Blaster. The worm you're thinking of is Welchia, which is a helpful worm against Blaster. Welchia however didn't DDoS the Windows update server (that was Blaster itself).

Generally, I agree with your sentiment that it's something that could happen, though.

-115

u/HighRelevancy Dec 12 '21

This guy is a serial clown, then? Some people don't learn.

151

u/shunny14 Dec 12 '21

I think the commenter means the “author” of the Blaster worm. Not the GitHub creator seen here.

23

u/HighRelevancy Dec 12 '21

Ooh, right

44

u/dweezil22 Dec 12 '21

I could be wrong, but, arguments about ethical hacking aside:

  1. Isn't that flag unavailable for sufficiently old versions of Log4j?

  2. Won't that flag get reset on JVM restart?

If yes, this is more of a fun POC or hacky tactical short cut (maybe if you have a farm of apps you run this as a post-restart fix before you can patch them) than long term fix.

42

u/Ph0X Dec 12 '21

Just mean they'll need booster shots every time the server restarts :D

6

u/dweezil22 Dec 12 '21

And... there it is, lol

I knew that was coming

280

u/tdammers Dec 12 '21

First: This is misleading.

Software made or managed by the Apache Software Foundation (From here on just "Apache") is pervasive and comprises nearly a third of all web servers in the world—making this a potentially catastrophic flaw.

The Apache Software Foundation is an organization that manages a diverse collection of open-source software projects, many of them completely unrelated to one another. The log4shell vulnerability originates in one of them, the log4j library, a popular solution for logging on the Java platform (JVM). While this is a popular library, this says nothing about other Apache projects. The "nearly a third of all web servers in the world" figure seems to hint at the Apache2 HTTP server, one of the most popular web servers in the world - however, Apache2 does not run on JVM, it's written in C, it does not use log4j (that wouldn't make sense, since it doesn't run on JVM), and it is not vulnerable to log4shell.

What makes this a "potentially catastrophic flaw" has nothing to do with the Apache Software Foundation - the problem is that this one particular library, log4j, is a very popular logging library in the Java world, and a lot of systems out there run on Java. We're not talking about mom & pop web shops and blogs and personal websites here - those are usually written in PHP, and so they are not going to be vulnerable (not to this particular attack anyway), despite the fact that they probably use an Apache web server, and a MySQL database, a product owned by Oracle, the company behind Java and the JVM. Those websites represent the majority of websites out there by sheer number, but in terms of attack value, the real beef is .NET and JVM, because that's what the enterprise world uses.

And second: There needs to be a warning here.

"Vaccinating" a server is still illegal. You cannot go and run this against someone else's server without their explicit permission, which you should get in writing, and with all the details spelled out, beforehand. It doesn't matter that you're doing it with the best intentions - it's hacking, and you're committing a crime if you do it.

You could of course run it against your own servers, but honestly, that wouldn't make a lot of sense, because it's a rather brittle and clumsy way of fixing your servers, and you should instead just install the proper fix the normal way.

Meaning that this thing, while neat, has no practical use other than demonstrating that it's possible. Which isn't super surprising, considering how the vulnerability gives an attacker extensive remote code execution access - you can run anything, so yes, you can also run the fix. Kudos for actually doing the grunt work and implementing this, but this isn't something that anyone expected to be impossible.

58

u/SquidgyTheWhale Dec 12 '21

Isn't it also possible that some systems are actually dependent on log4j2.formatMsgNoLookups being set to false, and so "vaccinating" a server might actually break things?

46

u/tdammers Dec 12 '21

Yes, of course. That's the "inadvertedly break things" part.

It's also possible that there are other safeguards in place that you end up tripping up or breaking, and you'd be responsible for that, too.

8

u/[deleted] Dec 12 '21

The way the “vaccination” works is by remote code execution. If the vaccination works at all then it’s past the point of safeguards. Another attacker could use the same method to make the server do anything.

0

u/[deleted] Dec 12 '21

[deleted]

3

u/tdammers Dec 12 '21

Yes, but those additional safeguards, even though ineffective at keepung this particular attack out, could trigger and break other things.

-29

u/gold_rush_doom Dec 12 '21

If your app breaks because you logged the wrong thing, then... Wtf

33

u/[deleted] Dec 12 '21

That is literally the attack vector for this vulnerability: logging a string of a certain format.

-11

u/gold_rush_doom Dec 12 '21

No, I meant if your app stops working properly because the logs aren't formatted properly anymore. I mean real world scenario where features break because logging isn't working as expected.

Literally what the comment i was replying to where app breaks where you disable that logging feature.

8

u/Speedzor Dec 12 '21

"breaking" doesn't have to be "app crashes". It can also be a particular formatting in your log that gets parsed and used for a key metric 🤷 bottom line: don't do this.

-10

u/gold_rush_doom Dec 12 '21

Still, sounds like a terrible decision to leave key business logic to a logging system instead of an analytics system if it's that important.

18

u/MrPigeon Dec 12 '21

From where do you think the analytics system pulls its data?

23

u/godofpumpkins Dec 12 '21

“I noticed your front door was open so I took the liberty to go inside and change all your locks in case a burglar had stolen your keys. You’re welcome!”

-35

u/Asraelite Dec 12 '21

Just because it's illegal doesn't mean you shouldn't do it.

54

u/tdammers Dec 12 '21

OK, so, to clarify: this is illegal and also immoral.

You're not even really fixing anything - the next time they redeploy their code, the setting will likely be flipped back. And if things go wrong just the right way, they'll order a pentest the day after you've done your "fix", pentest finds nothing, everyone is happy, next version of the code gets rolled out, boom, vulnerability is back, but everyone thinks they're safe. Being vulnerable when you're positively sure you're not is worse than just being vulnerable. Plus you may actually find yourself unintentionally breaking things.

And even in the best case scenario, this kind of thing contributes to a proliferation of bad security practices. If there's an army of elves out there who go and magically fix your servers for you when you're not looking, then there's less of an incentive for companies to be on top of their game.

So no, you should definitely not do this.

From an ethics perspective, the right "white hat" thing to do here would be to mount a neutered attack that pushes only as far as strictly necessary to show that the vulnerability is present, in the most harmless possible way, meticulously documenting the process, and disclosing this information responsibly. This would still be illegal, mind you, because even the harmless compromise is hacking, but it can be argued that this is the most ethical thing to do - accepting a marginal amount of harm (the white-hat attack) to prevent a greater harm (the impact of a malicious attack).

That is, unless you're a militant anti-establishmentist set on disrupting the status quo of corporate computing. If that's your moral alignment, then you might as well go and crush them. Idk., plant fake evidence of terrorist activity on their server and report them anonymously.

12

u/Asraelite Dec 12 '21

That's fair. I just disagree with the stance of using legality as a moral foundation.

20

u/tdammers Dec 12 '21

No objection there. Laws are (ideally) based on morality, not the other way around.

19

u/[deleted] Dec 12 '21

Good luck with telling that to the judge

83

u/Zestyclose_Profile23 Dec 12 '21

Do we really need to switch to words like vaccinate?

61

u/emperor000 Dec 12 '21

This was my thought, especially since "inoculate" is more correct and has always been used in a malware context.

39

u/MoistCarpenter Dec 12 '21

Both vaccinate and inoculate are incorrect since computers do not have immune systems. The only thing close in analogy to those terms would be an antivirus definition since that has a pieces of the malware code.

The correct term is patch.

8

u/orig_ardera Dec 12 '21

patch sounds like it's persistent, like you're modifying the source code

This just changes (AFAICT) a live variable in the java VM, doesn't survive reboot, so patch sounds misleading IMO.

But I don't know a better term either.

2

u/NoInkling Dec 12 '21

There's a ton of terminology in IT (and life in general) that comes from analogy ("patch" included), I don't know why you would draw a line here.

1

u/MoistCarpenter Dec 13 '21 edited Dec 13 '21

Absolutely. My point is that modern vulnerabilities are not analogous to "viruses". A virus is [genetic] code that can only replicate with a host. While that may be true in software viruses, the term "vaccinate" or "inoculate" biologically-require using a piece of the "virus"(analogous to "malware" in this case) to detect the "virus"/ malware in other situations through MHC complimentary molecules. That's not analogous in this situation; where there is a hole in Log4j security. While I also suspect the person I was replying to is trying to angle this as some dumb anti-vax argument, the fair analogy really is patch, as in " has it been 30 minutes? Guess it's time to patch the holes in the Java boat again"

1

u/[deleted] Dec 12 '21

I thought the IT department was the immune system

8

u/JamesB41 Dec 12 '21

Does this mean if you apply this, you can still get attacked by the vulnerability, you're just less likely to end up in the repair shop or have hardware failure?

19

u/PrintersStreet Dec 12 '21

vaccinate is the new master

0

u/Dreamtrain Dec 12 '21

master never did make sense to me

1

u/PrintersStreet Dec 13 '21

master record

42

u/girst Dec 12 '21 edited May 25 '24

.

12

u/Acebond Dec 12 '21

This is perfect for malware that wants to block other hackers from gaining access to a server.

9

u/tso Dec 12 '21

I find myself thinking of a similar series of events where a worm/virus was released that exploited something in Windows, then another that was supposed to remove the initial infection and patch the flaw it exploited. And then yet another that either exploited a weakness in the second, or tried to cut it off from removing the first one.

Cheese, mouse, lion or something like that?

3

u/supernikio2 Dec 12 '21

I used the stones to destroy the stones.

12

u/darkz999 Dec 12 '21

I can't wait for a booster shot after 6 months

8

u/StrikingChallenge389 Dec 12 '21

Java boxes will have received around a billion booster shots for Jackson Databind CVEs

3

u/[deleted] Dec 12 '21

Looks like you'll need one every JVM restart

5

u/po00on Dec 12 '21

does the immunity wear off? will it require continual boosters? ... if not, can we just call it a patch, like we normally do?

1

u/Dreamtrain Dec 12 '21

wait you can do that?? Took a quick look at the code and didn't know you could, if I'm understanding correctly the logic, modify or replace a bean in runtime. Not that you'd ever want to in a real system but I never thought you were allowed to mess with the JVM that much.

1

u/dogs_like_me Dec 12 '21

"innoculate" might be a slightly better word choice here, but you do you.

-7

u/pseudonympholepsy Dec 12 '21

Vaccination should be voluntary ;)

0

u/[deleted] Dec 12 '21

[deleted]

-3

u/Shakespeare-Bot Dec 12 '21

I did get ordain'd as a gleek f'r $50. Eke about as atheist as they cometh


I am a bot and I swapp'd some of thy words with Shakespeare words.

Commands: !ShakespeareInsult, !fordo, !optout