News for hackers. Stuff that matters.
Re:Dozens of malicious PyPI packages discovered targeting de... by coffeeblack on Wednesday November 02, 2022 @01:12PM (#33439367)
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.

Re:Dozens of malicious PyPI packages discovered targeting de... by jiripospisil on Wednesday November 02, 2022 @01:39PM (#33439856)
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.
Re:Dozens of malicious PyPI packages discovered targeting de... by inetknght on Wednesday November 02, 2022 @01:43PM (#33439929)
I hope you've turned off VS Code's "workspace trust" settings.

https://code.visualstudio.com/docs/editor/workspace-trust

Re:Dozens of malicious PyPI packages discovered targeting de... by jiripospisil on Wednesday November 02, 2022 @01:56PM (#33440176)
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

Re:Dozens of malicious PyPI packages discovered targeting de... by suchar on Wednesday November 02, 2022 @02:04PM (#33440314)
Readme says: https://marketplace.visualstudio.com/items?itemName=ms-vscod...

> A compromised remote could use the VS Code Remote connection to execute code on your local machine.

So I would say that it might be a bit harder for an attacker to gain access to your local machine, but you should not rely on it, because it's more like security by obscurity.

Re:Dozens of malicious PyPI packages discovered targeting de... by jiripospisil on Wednesday November 02, 2022 @02:16PM (#33440486)
Well damn. I was under the impression that the communication channel uses/accepts only well defined VSCode specific messages related to the UI...
Re:Dozens of malicious PyPI packages discovered targeting de... by collinmanderson on Thursday November 03, 2022 @11:30AM (#33452557)
Darn. Maybe the solution is to use vs-code client in the browser? Like vscode.dev or https://github.com/coder/code-server ? It limits what keyboard shortcuts and extensions are available, but at least it's in a secure sandbox on the client side.
Re:Dozens of malicious PyPI packages discovered targeting de... by fsflover on Wednesday November 02, 2022 @01:58PM (#33440210)
Re:Dozens of malicious PyPI packages discovered targeting de... by lupire on Wednesday November 02, 2022 @01:32PM (#33439740)
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.

Re:Dozens of malicious PyPI packages discovered targeting de... by orblivion on Wednesday November 02, 2022 @01:45PM (#33439960)
I think that separation is the point of the VM. Do the dev work in the VM, don't give it sensitive info about yourself.
Re:Dozens of malicious PyPI packages discovered targeting de... by hollerith on Wednesday November 02, 2022 @01:49PM (#33440045)
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 de... by suchar on Wednesday November 02, 2022 @01:59PM (#33440232)
As long as your are creating web applications then browsers are pretty good at limiting blast radius of a single attacked website. Well, at least until attacker discovers that he can inject some fancy phishing into trusted site.

With local development environment it is a bit different, because unless you are running build/test etc. in a container/vm/sandbox, then attacker has access to all of your files, especially web browser data.

Re:Dozens of malicious PyPI packages discovered targeting de... by chromakode on Wednesday November 02, 2022 @02:57PM (#33441166)
Development should be more exploratory and experimental than prod. For the past decade I've had a similar strategy: I freely install and demo new dependencies on separate dev hardware (or a VM when I'm on the road). Then I code review (incl. locked dependencies) and deploy from a trusted environment with reduced supply chain exposure.
Re:Dozens of malicious PyPI packages discovered targeting de... by coffeeblack on Wednesday November 02, 2022 @04:03PM (#33442152)
The only place I log into from the VM is Github, protected by 2FA in case any malware gets my password.
Re:Dozens of malicious PyPI packages discovered targeting de... by ylk on Wednesday November 02, 2022 @04:10PM (#33442266)
The malware will just take the session cookie. Some actions still require 2FA approval, but it’s not many, iirc.
Re:Dozens of malicious PyPI packages discovered targeting de... by remram on Wednesday November 02, 2022 @04:19PM (#33442390)
So the malware can delete all your projects or inject malware into them, but thankfully it won't be able to log in again later?
Re:Dozens of malicious PyPI packages discovered targeting de... by fsflover on Wednesday November 02, 2022 @01:15PM (#33439416)
Then you might be interested in Qubes OS: https://qubes-os.org.
Re:Dozens of malicious PyPI packages discovered targeting de... by orblivion on Wednesday November 02, 2022 @01:43PM (#33439936)
That's why I chose it. A lot of peace of mind there.
Re:Dozens of malicious PyPI packages discovered targeting de... by louislang on Wednesday November 02, 2022 @01:54PM (#33440135)
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 de... by coffeeblack on Wednesday November 02, 2022 @04:00PM (#33442110)
Sounds awesome.

Though I’m not sure of the solution really is / should be increased sandboxing.

The alternative may be a rethinking of the increasingly smaller packages. Maybe it’s better to have few large packages maintained by reputable organisations or personalities?

Re:Dozens of malicious PyPI packages discovered targeting de... by louislang on Wednesday November 02, 2022 @04:43PM (#33442652)
The problem is large, sprawling and complex. In an ideal case, we'd have high quality packages maintained by reputable people/organizations. But today this just isn't true. Open source takes contributions from a large number of unknown authors/contributors with motivations that may or might night align with your own.

We really need a defense in depth approach here. Sandbox where it makes sense, perform analysis of code being published, consider author reputation, etc.

Re:Dozens of malicious PyPI packages discovered targeting de... by comboy on Wednesday November 02, 2022 @04:11PM (#33442275)
Why is there so much discussion about sandboxing? Why wouldn't I put some malicious code in the package itself limiting myself to installation only?
Re:Dozens of malicious PyPI packages discovered targeting de... by louislang on Wednesday November 02, 2022 @04:30PM (#33442523)
A lot of the malware targeting developers is leveraging the installation hooks as the execution mechanism. So sandboxing the install helps stop this particular attack vector - which is why it gets talked about so much.

If you put code in the package itself, this would side step the "installation" sandbox. However we're also doing analysis of all packages introduced to the ecosystem to uncover things that are hiding in the packages themselves.

So you're right, we need a defense in depth approach here.

Re:Dozens of malicious PyPI packages discovered targeting de... by jasfi on Thursday November 03, 2022 @03:07AM (#33447944)
I think this is a very good idea. It should actually be built into the OS. I know of BSD jails, but not sure what else there is for Linux/Windows/MacOS.
Re:Dozens of malicious PyPI packages discovered targeting de... by koolba on Wednesday November 02, 2022 @02:11PM (#33440417)
> Only one typo in an import statement up the dependency chain and you’d be compromised.

Doesn’t even have to be a typo if the actual project is compromised. Like one of the 100s of NPM modules without 2FA for publishing.

Re:Dozens of malicious PyPI packages discovered targeting de... by kibwen on Wednesday November 02, 2022 @02:31PM (#33440730)
This is a good approach, though presumably the VM still has access to your Github credentials (via the browser) and your SSH keys? It'll limit the fallout of getting owned to anything reachable from Github (is it against Github's TOS to have multiple accounts?), less if you have 2FA (does there exist 2FA for SSH keys (I don't mean passphrases)?), but I think it would be better for just my build/run/test cycles to be cordoned off into their own universe, with a way for just the source code itself to cross the boundary.
Re:Dozens of malicious PyPI packages discovered targeting de... by namaria on Wednesday November 02, 2022 @02:51PM (#33441059)
It might be too cumbersome for most, and I might be more paranoid than average, but each project for me means a fresh VM, a new Keepass database and dedicated accounts. Then again I work mostly in ops, and I've seen first hand how badly things can go wrong so isolation and limiting blast radius takes precedence over daily convenience for me.
Re:Dozens of malicious PyPI packages discovered targeting de... by bt1a on Wednesday November 02, 2022 @03:23PM (#33441554)
Could you please share some resources/tactics for protecting your host machine from these development VMs? If I were to do this, I would want some assurances (never 100%) that my host is protected from the VM to the best of my ability.

(If it makes any difference, I would probably be using VMWare Workstation Pro)

Re:Dozens of malicious PyPI packages discovered targeting de... by namaria on Wednesday November 02, 2022 @06:52PM (#33443973)
I can't give you what you're looking for. You need to decide on the trade offs for yourself. There will always be a risk. Directed attacks can get out of VMs. You could slip up and log into a personal account inside the VM.
Re:Dozens of malicious PyPI packages discovered targeting de... by bt1a on Wednesday November 02, 2022 @09:53PM (#33445796)
I tried to make it clear in my reply that I understood there are no guarantees. What I’m asking is if you have any guidance on reducing the likelihood of these attacks succeeding
Re:Dozens of malicious PyPI packages discovered targeting de... by 0cf8612b2e1e on Wednesday November 02, 2022 @04:44PM (#33442668)
That does sound incredibly cumbersome. I suppose that means you are an ace at provisioning machines.

How do you move data in/out of the guests? I always found that part of interacting with VMs to be annoyingly painful.

Re:Dozens of malicious PyPI packages discovered targeting de... by namaria on Wednesday November 02, 2022 @06:54PM (#33444001)
There are always trade offs. You do get better at things you do a lot. My mother won't use a password vault because copying and pasting is too much work for her. I'd just rather pay with my time and inconvenience than one day find out some python package I fiddled with for a late night project once means I need to call my bank.
Re:Dozens of malicious PyPI packages discovered targeting de... by fbhabbed on Wednesday November 02, 2022 @07:05PM (#33444096)
SSH.

Doesn't even need to be command line, you can just open remote addresses in your favourite graphical file browser, at least under Linux.

Re:Dozens of malicious PyPI packages discovered targeting de... by fsflover on Thursday November 03, 2022 @04:49AM (#33448520)
Why wouldn't you use disposable VMs [0] and secure inter-VM copy [1] on Qubes OS instead? It's much less cumbersome and more secure.

[0] https://www.qubes-os.org/doc/how-to-use-disposables/

[1] https://www.qubes-os.org/doc/how-to-copy-and-move-files/

Re:Dozens of malicious PyPI packages discovered targeting de... by AlexAndScripts on Friday November 04, 2022 @03:44PM (#33472687)
That sounds like precisely QubeOS's use case.
Re:Dozens of malicious PyPI packages discovered targeting de... by fsflover on Wednesday November 02, 2022 @04:30PM (#33442528)
> though presumably the VM still has access to your Github credentials (via the browser) and your SSH keys?

Not in Qubes OS:

https://github.com/Qubes-Community/Contents/blob/master/docs...

https://www.qubes-os.org/doc/split-gpg/

Re:Dozens of malicious PyPI packages discovered targeting de... by jve on Wednesday November 02, 2022 @06:29PM (#33443779)
> does there exist 2FA for SSH keys (I don't mean passphrases

Yes. Yubikey. ecdsa-sk key requires you to tap yubikey to have a working key. It consists of 2 parts - a private key file, but which is useless without yubikey. https://developers.yubico.com/SSH/

https://developers.yubico.com/SSH/Securing_SSH_with_FIDO2.ht...

Re:Dozens of malicious PyPI packages discovered targeting de... by jve on Wednesday November 02, 2022 @06:32PM (#33443802)
Github offers fine grained personal access tokens. https://docs.github.com/en/authentication/keeping-your-accou...

Azure DevOps does it too

Re:Dozens of malicious PyPI packages discovered targeting de... by Riverheart on Friday November 04, 2022 @08:29AM (#33465478)
Far as I know, in AzDO you can't even limit a PAT to a single project/repository. Not good for limiting access cause even a read only can see private stuff in other projects. You might create a specific account and assign to only that project but what a pain.
Re:Dozens of malicious PyPI packages discovered targeting de... by secondcoming on Wednesday November 02, 2022 @03:27PM (#33441608)
This is the way.
Re:Dozens of malicious PyPI packages discovered targeting de... by ashishbijlani on Wednesday November 02, 2022 @04:16PM (#33442339)
Packj sandbox [1] offers "safe installation" of PyPI/NPM/Rubygems packages. It shows you a preview of file system changes that installation will make and can also block arbitrary network communication during installation (uses an allow-list). Disclaimer: I've been building Packj for over an year now.

1. https://github.com/ossillate-inc/packj/blob/main/packj/sandb...

Re:Dozens of malicious PyPI packages discovered targeting de... by collinmanderson on Thursday November 03, 2022 @11:36AM (#33452656)
Only secures installation, not runtime, but still helpful. I'm not a package maintainer, but I do wish that packages were not allowed to run any code at install-time.
Re:Dozens of malicious PyPI packages discovered targeting de... by weinzierl on Wednesday November 02, 2022 @05:25PM (#33443130)
This is goid defense in depth measure but doesn't solve one fundamental issue. You might be protected during developement by the sandbox but your users are not necessarily. I think we as developers should not give any sotware we do not trust to our users.
Re:Dozens of malicious PyPI packages discovered targeting de... by Bright_Machine on Wednesday November 02, 2022 @11:32PM (#33446648)
I'm following the same workflow. I use a Linux host and then a Linux guest with OpenGL acceleration on virt-manager. I do all my development and browsing inside the VM. I do not trust any of the npm packages or PIP packages. Any personal stuff like banking, password manager, Nextcloud goes on the host.

With modern virtio interfaces for network, disk and graphics practically giving near metal performance, there's no reason to not utilize VMs for development.

Re:Dozens of malicious PyPI packages discovered targeting de... by throwaway290 on Thursday November 03, 2022 @02:15AM (#33447664)
Similar. I run text editor on the main OS but run language server in the requisite environment with all the requirements in a container.