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.
SSH keys stolen by stream of malicious PyPI and npm packages
Submitted 11 months ago by mac@programming.dev to programming@programming.dev
Comments
ShaunaTheDead@kbin.social 11 months ago
lemann@lemmy.one 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 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?
CmdrKeen@lemmy.today 10 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 ofwget
orcurl
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.
mrwiggles@prime8s.xyz 11 months ago
And this is why you password protect your ssh keys
platypus_plumba@lemmy.world 10 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.
dudinax@programming.dev 11 months ago
What’s a stream of packages?
blargerer@kbin.social 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.
foobaz@lemmy.world 11 months ago
cat ~/.ssh/id_rsa
🤔Feature request: steal ed25519 keys too