|
|
Log in / Subscribe / Register

The malicious "rustdecimal" crate

The malicious "rustdecimal" crate

Posted May 11, 2022 18:59 UTC (Wed) by ballombe (subscriber, #9523)
Parent article: The malicious "rustdecimal" crate

Note that there is no mention of steps taken to prevent this to happen again, or to make sure there are no other similar crates.


to post comments

The malicious "rustdecimal" crate

Posted May 11, 2022 19:03 UTC (Wed) by magfr (subscriber, #16052) [Link]

They did write:

An analysis of all the crates on crates.io was also performed, and no other crate with similar code patterns was found.

but it could stand out more.

The malicious "rustdecimal" crate

Posted May 12, 2022 8:09 UTC (Thu) by ddevault (subscriber, #99589) [Link] (20 responses)

This is a fundamentally unsolvable problem with the (bloody stupid) approach to package management endorsed by Cargo, PyPI, npm, etc. Vendors cannot be trusted to publish their own packages. The distribution model, with a dispassionate third-party reviewing, packaging, and signing the software, is much better for security.

The malicious "rustdecimal" crate

Posted May 12, 2022 12:10 UTC (Thu) by tchernobog (subscriber, #73595) [Link] (19 responses)

In a perfect world where every package maintainer had infinite time and would be paid to read and audit every single package you would be right. Unfortunately, history shows that malicious code has landed and will continue to land also in mainstream distributions.

There is also a problem of freshness of packages, with patches taking time and effort in percolating from upstream to downstream. I've seen several packages with known vulnerabilities remaining outdated for far more time in distros rather than when following the upstream releases directly.

The complexity of the current software ecosystem on a typical installation necessarily puts the burden of proof on developers who are including certain dependencies in their projects. Rather than on distro maintainers, I would expect library users (developers) to have some form of sandboxing in place on their CI systems, and static analysis of their code and its dependencies.

A CI system should also not be allowed to connect to the Internet by default, rather going through a proxy such as Artifactory for downloading of packages. Hopefully, something like sigstore (https://www.sigstore.dev/) might take traction and help in ameliorating the issue.

Putting the blame on cargo, pypi, npm, etc. misses the mark in my opinion. Except that they should be enforcing verified author-signing of packages.

For a certain class of applications (e.g. GUIs) flatpak and its sandboxing approach offer a good improvement on security, provided it's properly set up. For the rest... I can assure you I've seen developers bundling a lot of outdated and vulnerable dependencies without thinking, no matter how easy or hard a certain tool makes it.

The malicious "rustdecimal" crate

Posted May 12, 2022 13:26 UTC (Thu) by sionescu (subscriber, #59410) [Link] (13 responses)

> Unfortunately, history shows that malicious code has landed and will continue to land also in mainstream distributions.

Do you have examples ?

The malicious "rustdecimal" crate

Posted May 12, 2022 14:13 UTC (Thu) by tchernobog (subscriber, #73595) [Link] (3 responses)

Well, log4j has been packaged and distributed for quite a while despite allowing remote execution, has it not? Not to mention a long list of CVEs in packages more (e.g. openssl) or less critical.

Humans are imperfect, no human review process is 100% safe.

A survey conducted through GitHub claims that about one in five bugs are planted with malicious intent.

https://www.zdnet.com/article/open-source-software-how-ma...

Considering the thousands of CVEs that have been open against a distro like Debian over the years, there is a good and fair chance that several bugs we have seen (and many we haven't yet) were indeed intentionally planted.

The malicious "rustdecimal" crate

Posted May 13, 2022 11:03 UTC (Fri) by mkj (subscriber, #85885) [Link] (1 responses)

That zdnet article is off by a factor of 100. It has mistaken 0.2% for 20%.

The malicious "rustdecimal" crate

Posted May 13, 2022 11:43 UTC (Fri) by excors (subscriber, #95769) [Link]

I think they got the right numbers but the wrong context. The original report (https://octoverse.github.com/static/github-octoverse-2020...) says:

> Most software vulnerabilities are mistakes, not malicious attacks. Analysis on a random sample of 521 advisories from across our six ecosystems [Composer, Maven, npm, NuGet, PyPI, RubyGems] found that 17% of the advisories were related to explicitly malicious behavior such as backdoor attempts. These malicious vulnerabilities were generally in seldom-used packages, but triggered just 0.2% of alerts. While malicious attacks are more likely to get attention in security circles, most vulnerabilities are caused by mistakes.

and:

> Analysis on a random sample of 521 advisories from across our six ecosystems finds that 17% of the advisories are related to explicitly malicious behavior such as backdoor attempts. Of those 17%, the vast majority come from the npm ecosystem. While 17% of malicious attacks will steal the spotlight in security circles, vulnerabilities introduced by mistake can be just as disruptive and are much more likely to impact popular projects. Out of all the alerts GitHub sent developers notifying them of vulnerabilities in their dependencies, only 0.2% were related to explicitly malicious activity. That is, most vulnerabilities were simply those caused by mistakes.

To be honest, I can't actually understand what that's trying to say. But I don't believe it's saying that 17% (nor 0.2%) of vulnerabilities were maliciously inserted: it's about advisories not vulnerabilities (and most projects won't bother with advisories for regular boring vulnerabilities found through code review), and "advisories related to explicitly malicious behaviour/activity" sounds like it's talking about active exploitation of a possibly-accidental vulnerability (vs an unexploited vulnerability found through code review), probably? Without more detail on the methodology (which I haven't been able to find) the numbers seem largely meaningless.

The malicious "rustdecimal" crate

Posted May 13, 2022 13:15 UTC (Fri) by mathstuf (subscriber, #69389) [Link]

> one in five bugs are planted with malicious intent

This doesn't pass my smell test. The article says "vulnerabilities" without defining what they mean. I presume they actually mean "CVEs on GitHub-hosted projects" here, but it's really hard to tell. There are plenty of vulnerabilities that never get a CVE. There are also plenty not on GitHub. So without some metric of what they're talking about, I have no idea how useful such a statistic is. But "bugs" is almost certainly not what you mean here (at least as I understand the term).

The malicious "rustdecimal" crate

Posted May 12, 2022 14:50 UTC (Thu) by zdzichu (subscriber, #17118) [Link] (7 responses)

mjg59 provided a link recently: https://lists.debian.org/debian-devel/2003/02/msg00771.html

Upstream included code targeting Debian specifically. Maintainer did not spot this. (I don't blame him. I wouldn't spot it either. Life is too short to read diffs between versions).

The malicious "rustdecimal" crate

Posted May 12, 2022 16:49 UTC (Thu) by ballombe (subscriber, #9523) [Link] (6 responses)

This a nearly 20 year-old example, and it was done by the upstream maintainer.
If you have nothing better, that rather prove that Linux distributions are quite safe
against malicious code injection.

The malicious "rustdecimal" crate

Posted May 13, 2022 9:27 UTC (Fri) by wtarreau (subscriber, #51152) [Link] (5 responses)

> This a nearly 20 year-old example, and it was done by the upstream maintainer.

In fact it's the perfect counter-example: all that could be found dates 20 years because the distro model works very well!

The malicious "rustdecimal" crate

Posted May 13, 2022 13:50 UTC (Fri) by zdzichu (subscriber, #17118) [Link] (4 responses)

The question was for ANY example of malicious code going into the distro. The example was provided. Nitpicking about the date is just moving the goalposts.

The malicious "rustdecimal" crate

Posted May 15, 2022 3:46 UTC (Sun) by wtarreau (subscriber, #51152) [Link] (3 responses)

"nitpicking" :-)

Selecting an issue that happened more than 10 years before the ecosystem subject of this article was even imagined is hardly relevant to this discussion, I'm sorry. It's presenting a process that's supposed to be better than another one without looking at what was done since in order to make sure this issue doesn't happen anymore. Yet the current situation is presented as having that limitation while it may very well be what made this issue not happen anymore. That's precisely a swap of cause and consequence.

The malicious "rustdecimal" crate

Posted May 15, 2022 3:53 UTC (Sun) by mjg59 (subscriber, #23239) [Link] (2 responses)

> without looking at what was done since in order to make sure this issue doesn't happen anymore

Nothing was done. There's no process in Debian to prevent something like this happening again - the reason it hasn't is that upstreams are generally not malicious.

The malicious "rustdecimal" crate

Posted May 20, 2022 2:21 UTC (Fri) by dilinger (subscriber, #2867) [Link]

And there's the fact that such a malicious bug would only affect a certain subset of debian users (those running unstable) rather than stable users. An upstream could plant something debian-specific that waited several years before triggering so that it happened on debian stable systems, but that's quite the long game. Or stable could be targeted by a fast-changing package in stable, like firefox/chromium.

The malicious "rustdecimal" crate

Posted Jun 12, 2022 6:45 UTC (Sun) by marcH (subscriber, #57642) [Link]

> the reason it hasn't is that upstreams are generally not malicious.

"Generally" is good enough except for security or safety issues. My smartphone "generally" does not crash: good enough. My bank account is "generally" safe from hackers: not good enough.

But of course security bugs are also "just bugs". So it's funny to see some $BIGCORPS suddenly very obsessed about preventing security bugs and wondering "how did that happen?" when the answer is often just:
because crashing from time to time was considered good enough... until hackers look at our products.

The malicious "rustdecimal" crate

Posted May 13, 2022 20:24 UTC (Fri) by jwilk (subscriber, #63328) [Link]

The malicious "rustdecimal" crate

Posted May 12, 2022 23:40 UTC (Thu) by pabs (subscriber, #43278) [Link] (2 responses)

The review problem is potentially solvable through distributed review and a web of "review trust". The CREV folks are working on something like that.

https://github.com/crev-dev/

The malicious "rustdecimal" crate

Posted May 13, 2022 9:29 UTC (Fri) by wtarreau (subscriber, #51152) [Link] (1 responses)

Review is not so much important as having a 3rd party accept to take some responsibility for it (which is what happens in a distro). That does help, obviously, but asking someone you don't know to accept to maintain your crap over the long term is not an easy task, and doing that with purposely malicious software is even harder.

The malicious "rustdecimal" crate

Posted May 14, 2022 4:11 UTC (Sat) by pabs (subscriber, #43278) [Link]

Distros do very little review, so them taking responsibility for something doesn't really help the code quality/trust problem, you still need review even with a distro.

The malicious "rustdecimal" crate

Posted May 13, 2022 9:26 UTC (Fri) by wtarreau (subscriber, #51152) [Link]

Distros have good virtues for packaging, they impose some deadlines and some stability. That prevents one from appearing in the middle of nowhere and becoming the new standard thing of the month then disappearing and leaving everyone in the dust. You also have to convince a package maintainer to adopt and maintain your package, so that usually comes with some compelling arguments about popularity and proofs of understanding of cycles of development and what long-term maintenance means.

I'd say that software that are distributed a bit too directly to users tend to evade such controls and by losing some of these constraints they also lose many of the guarantees they used to offer to their users. I do have absolutely zero trust in such software distributed on such channels that are nothing but a market place where fame replaces money, and where engagement can be zero without anyone noticing.

The malicious "rustdecimal" crate

Posted May 13, 2022 19:53 UTC (Fri) by Chousuke (subscriber, #54562) [Link]

What distros have that upstream authors don't are enforced policies and best practices for packaging software. If you get a package signed with a distribution's packaging key, you know there's at least some level of quality guaranteed (depending on distribution).

In Fedora, any packaged software is required to build offline (without any network access), and *only* from the sources provided; that means you at least have some hope of knowing what sources the binary was built from and rebuilding the software yourself.

As an example of the frankly incompetent crap vendors sometimes do that wouldn't fly in a serious distro, AWS's package for OpenDistro for Elasticsearch at one point used a pre-install script to download a binary from the internet upon installation and dump it in /usr/lib. This was done in a noarch package that's supposed to be architecture-independent! I remember it well because I had to spend time untangling a surprise broken upgrade in an ES cluster that had no internet access...


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds