Live data from Hacker News

Two malicious Python libraries caught stealing SSH and GPG keys

zdnet.com

291–300 of 323 posts

Re: Two malicious Python libraries caught stealing SSH and GPG keys

#291
post #179

Earlier quoted context omitted.

you could use some lightweight rootless containers: I wrapped bubblewrap in a small python-program parsing a YAML-configuration (which mirrors my hosts rootfs and provides "topical" homes: node, python, scientific stuff), but there is also something like toolbox: https://github.com/containers/toolbox/blob/master/README.md Note that you need to secure your X-Server also, especially when sharing your network-namespace.…

Containers (and virtualisation) are helpful but. not bulletproof. If your threat model is already malicious code with ill intent, you probably want higher grades of privsep / sandboxing. E.g., https://www.twistlock.com/labs-blog/escaping-docker-containe... https://www.exploit-db.com/exploits/46978 Full virtualisation does far better, though I believe there've been exploits there as well. Yes, from 2015: https://threa…

Some effort towards more secure containers: https://gvisor.dev/

Re: Two malicious Python libraries caught stealing SSH and GPG keys

#293
post #281

Earlier quoted context omitted.

I agree with this. They don’t mention this explicitly in the article, but it has a capability-based security model, which is something I think we desperately need in our OSes. (They do link to a paper about it that mentions this.) There are a few other such systems that look interesting; Agoric is working on one for JavaScript, Google has a kernel patch set that adds capability support to Linux, and Christopher Lemme…

Hear, hear on capability systems, but they seem of limited use confined to specific language implementations, as opposed to the whole system. I wonder what's the Google kernel patch, and how it compares with Capsicum. It's rather tragic to gain public awareness so long after KeyKOS et al...

The kernel patchset I was referring to is https://github.com/google/capsicum-linux - it's a Linux version of Capsicum. Though now that I look at it more closely, it appears to no longer be maintained. :(

That said, the Bytecode Alliance stuff appears to be multi-language, so that's neat! I could see that making WASM runtimes pretty useful even outside the web.

Re: Two malicious Python libraries caught stealing SSH and GPG keys

#294
I don't see a solution other than every application being launched in a separate container, exposing only what the user explicitly gives access to, similar to how mobiles applications require permissions. We have the technology, eg. cgroups & unshare on Linux; what's missing is something that plumbs all these brittle pieces into a secure application launcher made for desktop (rather than server/cloud) usage.

Re: Two malicious Python libraries caught stealing SSH and GPG keys

#295

So they caught the guy using a cliched I-vs-l typosquatting scheme and lazily writing the malicious code in Python; we can presume they haven't caught the guy who took the trouble to put their malicious code in a pre-compiled C extension. Reminds me of the fraudulent scientific papers that get caught using really dumb fakes (e.g., microscopy pictures that are copies of one another re-zoomed and rotated); we catch the…

> For that matter, isn't there a reasonable systematic way to catch out typosquatters simply based on text analysis? You could probably write one using Python & jellyfish.

From jellyfish’s pypi page: “ a library for doing approximate and phonetic matching of strings.”

Huh! Hadn’t realized. That adds an ironic spin to the whole thing.

Re: Two malicious Python libraries caught stealing SSH and GPG keys

#296
post #254

Earlier quoted context omitted.

Why is it that we accept that any piece of code can just randomly reach into the file system and connect to any server? Why isn't the file system an object you pass around instead?

The phrase you're looking for to poke into a search engine is "capability-based security": https://en.wikipedia.org/wiki/Capability-based_security It's a long, kinda story, which I'm not intimately familiar with, but seems to boil down to, it's more effort than we're willing to spend on rebooting our entire computing infrastructure. (Lots of things that could improve computing have that problem. "Rebooting our entire…

Getting it into a mainstream OS is a huge undertaking - but doing it within the confines of a new programming language is straightforward. Haskell mostly does it, at least with the Safe Haskell implementation.

In an object oriented setting, it's simply a matter of not exposing the filesystem (etc.) as globals, but instead as an object that is passed around explicitly, starting from main(). There are a few upcoming languages that do this.

Re: Two malicious Python libraries caught stealing SSH and GPG keys

#297
post #76
post #4

> The first is "python3-dateutil," which imitated the popular "dateutil" library. The second is "jeIlyfish" (the first L is an I), which mimicked the "jellyfish" library.

I don't get it. Who would type "pip install jeilyfish" by mistake?

These people did:

Downloads last day: 13 Downloads last week: 103 Downloads last month: 119

Check https://pypistats.org/packages/jeilyfish you won't believe your own eyes.

Re: Two malicious Python libraries caught stealing SSH and GPG keys

#298
post #152

Earlier quoted context omitted.

Windows and macOS have been pushing for sandboxes for quite a while as well, exactly to prevent this kind of behavior. Currently macOS is more agressive than Windows on this area, with Apple now requiring notarization for all software, which you can still bypass, but need to explicitly allow it.

Apple does not require notarization for all software; it's just enabled by default and checked on all applications downloaded from the internet and opened through Launch Services.

Which is already more than any other FOSS UNIX.

As for macOS, I am sure that it will come, as these features have been slowly being added release after release.

Re: Two malicious Python libraries caught stealing SSH and GPG keys

#299
Ideally programming languages should include capability-based access control, so that a random library that is supposed to do X, can't do Y.

Until then, we need to vet our dependencies. Check out https://github.com/crev-dev/cargo-crev/tree/master/cargo-cre... for a distributed review system we're working on.

Re: Two malicious Python libraries caught stealing SSH and GPG keys

#300
post #50
post #12

Anyone here not encrypting their private keys? Also known_hosts file is a double edged sword. It's pretty sensitive in combination with a private key.

Modern SSH versions only store hashes of domain names in the known_hosts file exactly for this reason.

[deleted]
Post reply on HN