Live data from Hacker News

Dozens of malicious PyPI packages discovered targeting developers

blog.phylum.io

21–30 of 334 posts

Re: Dozens of malicious PyPI packages discovered targeting developers

#22
post #2

PyPi should warn when the package and developer are new.

Yeah a time/activity based trust system like thepiratebay uses could be helpful. Also devs should get into the habit of providing sha256 hashes on offical channels (i.e., github readme) so users can validate (if its possible to validate a pkg before executing malicious code in the python ecosystem, I'm not sure how that'd work).

> Also devs should get into the habit of providing sha256 hashes on offical channels (i.e., github readme) so users can validate (if its possible to validate a pkg before executing malicious code in the python ecosystem, I'm not sure how that'd work).

I would think the easy solution is to publish a public signing key per-person or per-project, and then sign individual files with that. So, GPG.

Re: Dozens of malicious PyPI packages discovered targeting developers

#23
post #7

It's using base64 encoded strings to deliver the initial stage. Can this be avoided/flagged more easily if by adding a scan of statements featuring base64 or import?

That'd catch a ton of valid packages. Right now on my random collection of packages in site-packages I have ~60 packages that have 'import base64' in them.

Re: Dozens of malicious PyPI packages discovered targeting developers

#24
post #2

PyPi should warn when the package and developer are new.

Yeah a time/activity based trust system like thepiratebay uses could be helpful. Also devs should get into the habit of providing sha256 hashes on offical channels (i.e., github readme) so users can validate (if its possible to validate a pkg before executing malicious code in the python ecosystem, I'm not sure how that'd work).

> Yeah a time/activity based trust system like thepiratebay uses could be helpful.

This is an excellent idea. Authors are something we are digging into heavily as part of an ongoing effort to improve trust in the open source ecosystem.

Re: Dozens of malicious PyPI packages discovered targeting developers

#25
post #9

I started to develop only inside VMs, with a full Desktop, IDE, browser etc. inside the virtual machine. There have been to many contaminations of major package repos lately. Only one typo in an import statement up the dependency chain and you’d be compromised.

Virtual is part of a solution but not the key: the key is to separate your dev env from your real life/business environment -- including all your personal and professional business data and web accounts that expose your financials and private data. If you log into your email from the virtual machine, you are at risk.

That protects me (the software developer/maintainer) to some degree, but does nothing to protect the users of the software I am maintaining.

Re: Dozens of malicious PyPI packages discovered targeting developers

#26
post #21

The article doesn't explain what exactly the "W4SP Stealer" does. Would someone be able to explain?

It downloads a script that, at least right now, will turn around and grab cookies and passwords from browsers and send the data off to an discord webhook.

Re: Dozens of malicious PyPI packages discovered targeting developers

#27
post #21

The article doesn't explain what exactly the "W4SP Stealer" does. Would someone be able to explain?

It's a slew of checks for passwords and other things on the developers machine. The data is extracted and sent to a remote endpoint controlled by the attacker.

Re: Dozens of malicious PyPI packages discovered targeting developers

#28

I started to develop only inside VMs, with a full Desktop, IDE, browser etc. inside the virtual machine. There have been to many contaminations of major package repos lately. Only one typo in an import statement up the dependency chain and you’d be compromised.

Full disclosure, I am a co-founder at Phylum.

We are actively working on a solution that will fully sandbox package installations for npm, yarn, poetry and others.

It's rolled up as part of our core CLI [1], but is totally open source [2]:

[1] https://github.com/phylum-dev/cli [2] https://github.com/phylum-dev/birdcage

Re: Dozens of malicious PyPI packages discovered targeting developers

#29
post #7

It's using base64 encoded strings to deliver the initial stage. Can this be avoided/flagged more easily if by adding a scan of statements featuring base64 or import?

Yes, this works really well. But as soon as you deploy it, the actors change tactics. We've had to build a defense in depth approach to discovering malicious packages as they are introduced into the system.

Re: Dozens of malicious PyPI packages discovered targeting developers

#30
post #14

Earlier quoted context omitted.

I've tried the same but the graphics performance was too slow (no GPU acceleration). The current setup is to use a virtual machine but connect to it via VS Code's Remote SSH extension from the host.

I hope you've turned off VS Code's "workspace trust" settings. https://code.visualstudio.com/docs/editor/workspace-trust

Sometimes but I wonder to what degree it actually matters. Tasks, debuggers, extensions etc. run in the context of the VM, not the host. The Remote SSH extension turns VS Code into a "thin" client which presents pretty much just the UI.

https://code.visualstudio.com/docs/remote/ssh

Post reply on HN