123
top 10 comments
sorted by: hot top controversial new old
[-] foobaz@lemmy.world 25 points 11 months ago

cat ~/.ssh/id_rsa 🤔

Feature request: steal ed25519 keys too

[-] mrwiggles@prime8s.xyz 6 points 11 months ago

And this is why you password protect your ssh keys

[-] platypus_plumba@lemmy.world 1 points 11 months ago

It's honestly crazy that tools like npm don't force you to encrypt the tokens for the npm repos. They don't even support it. Any stupid read_file() with http.post() can screw 1000 people.

[-] ShaunaTheDead@kbin.social 5 points 11 months ago

This feels like a great application of AI to root around through the code of packages in these repos and find ones that access the ssh key directory at all to be looked at more thoroughly by a human.

[-] lemann@lemmy.one 9 points 11 months ago

I think they would start obfuscating the relevant code to get around it

Many ad networks and AABs do something similar (especially Admiral) in an attempt to evade ad blocking extensions

[-] ShaunaTheDead@kbin.social 4 points 11 months ago

Do you think using a custom ssh key directory would prevent these malicious apps from working correctly or is there some environment variable that always points to the ssh key folder or I guess they could just run a search on the system for any files like *.pub. Are there any safety procedures that one can take to circumvent these kinds of attacks?

[-] lemann@lemmy.one 3 points 11 months ago

I think so, assuming these malicious packages are all primitive enough to just look for the single file in a user's home folder lol. The only downside here is needing to provide the keyfile location to ssh every time you want to connect... Although a system search would pretty much defeat that instantly as you mention

SSH keyfiles can be encrypted, which requires a password entry each time you connect to a SSH server. Most linux distros that I've used automatically decrypt the SSH keyfile for you when you log in to a remote machine (using the user keyring db), or ask you for the keyfile password once and remember it for the next hour or so (using the ssh-agent program in the background).

On Windows you can do something similar with Cygwin and ssh-agent, however it is a little bit of a hassle to set up. If you use WSL i'd expect the auto keyfile decryption to work comparably to Linux, without needing to configure anything

[-] CmdrKeen@lemmy.today 4 points 11 months ago

IDK, virus scanners and malware detectors could do these things before AI.

You could search for stuff like directly accessing the ~.ssh directory, or any invocations of wget or curl to download external scripts and run them through an interpreter and flag those for closer inspection.

If you want to get fancier, automate installing packages in an isolated environment (like a container or VM) and keep track of every file system access and network request they make.

Sure, eventually they'll figure out ways to obfuscate those things, too, but it could at least prevent people from doing things in such blatantly obvious ways.

[-] dudinax@programming.dev 3 points 11 months ago

What's a stream of packages?

[-] blargerer@kbin.social 21 points 11 months ago

Its just a weird word choice for many/a group. If you read the article they are typo squatting legitimate packages with alternate versions that steal the ssh keys.

this post was submitted on 14 Dec 2023
123 points (99.2% liked)

Programming

17314 readers
97 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS