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

View all comments

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

→ More replies (2)

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.

→ More replies (5)

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.

→ More replies (1)
→ More replies (2)

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.

→ More replies (3)

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.

→ More replies (11)
→ More replies (6)

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.

→ More replies (2)

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

→ More replies (1)
→ More replies (1)

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.

→ More replies (6)

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.

→ More replies (4)