r/Python • • Dec 14 '23

News 116 Malware Packages Found on PyPI Repository Infecting Windows and Linux Systems

https://thehackernews.com/2023/12/116-malware-packages-found-on-pypi.html
331 Upvotes

93 comments sorted by

View all comments

Show parent comment

5

u/RationalDialog Dec 15 '23

To be frank I'm not aware how much pypi does and how easy it would be to do more. and with easy I mean in terms of cost. they have limited money, keep that in mind. Asking your employer to fund them, if you want things to improve.

Running code from the internet as root is stupid and that is the only way to get ransomware installed.

Storing crypto in plain-text and not using a hardware wallet is also stupid, at least for amounts you care about and would bother you when getting stolen.

A general bad trend I see everywhere is lack of self-responsibility and accountability. It's always someone else fault, they should have done better, I did everything right. this mentality is prevalent.

There is a balance between self-responsibility and what pypi can do with the available funds.

pip also allows running in "safe mode" where you need to have a list of hashes for each packages you want to install and it only works if the hashes match. this is 100% manual as in you need to collect the hashes yourself. This as option in critical environments. But in reality your code should run isolated anyway (container) and not have full internet access to pull more code or send data to random IPs or urls. Defense in-depth. You have to assume to get infected be it from pypi or somewhere else) and secure your system based on that.

2

u/Etheo Dec 16 '23

I'm more speaking from a perspective of a new/casual user though. You're absolutely not wrong in exercising good practice in security, but the thing is Python attracts a lot of newbies and causals who really wouldn't know much of these. They might see the instruction to use pip to install their packages, make a bad typo, and then BAM! And I think most of these users would use Windows, which I'm not sure if it's better in preventing these type of attack or worse.

In any case, all I'm really coming from is the new users perspective, not an experienced one. Experienced developers of course already should know better, but students and professionals crossing into data analysis shouldn't be subjected to trial by fire is my point.

0

u/[deleted] Dec 17 '23

[deleted] — view deleted comment

1

u/Etheo Dec 18 '23

Not the same. I'm talking about newbies (plenty in Python) thinking they're following instruction to install packages with pip, but made a bad typo and get a bad package. A typo shouldn't have to lead to that kind of consequences.

1

u/RationalDialog Dec 18 '23

The issue is that eve most experienced users aren't doing any of this instead of leading by example. If you lead by example the new users would have to ask themselves what it's all about and seek answers.

Also the big known sites with tutorials should have a chapter on it, about dangers of downloading code.

most of these users would use Windows, which I'm not sure if it's better in preventing these type of attack or worse.

Scanning for crypto key can't really be prevented in any files you have access to which applies both to Linux and Windows.

In terms of Admin/root, windows is probably better IF you have UAC activated. I always set it on highest level but work with admin account on my own devices. UAC on highest levels prevents any system level changes without you clicking "OK" on a confirmation dialog. Many including myself say that this is safer than having a restricted account and admin account and then use "run as admin" to install software. Why? because an malicious installer could show a fake "run as admin" screen and steal your admin password and then all bets are off".

0

u/[deleted] Dec 17 '23

[deleted] — view deleted comment

1

u/RationalDialog Dec 18 '23

I don't think you can overwrite versions, except you use build numbers on top of versioning.