Ultralytics Supply-Chain Attack
Last week, we saw a supply-chain attack against the Ultralytics AI library on GitHub. A quick summary:
On December 4, a malicious version 8.3.41 of the popular AI library ultralytics —which has almost 60 million downloads—was published to the Python Package Index (PyPI) package repository. The package contained downloader code that was downloading the XMRig coinminer. The compromise of the project’s build environment was achieved by exploiting a known and previously reported GitHub Actions script injection.
Lots more details at that link. Also here.
Seth Michael Larson—the security developer in residence with the Python Software Foundation, responsible for, among other things, securing PyPi—has a good summary of what should be done next:
From this story, we can see a few places where PyPI can help developers towards a secure configuration without infringing on existing use-cases.
- API tokens are allowed to go unused alongside Trusted Publishers. It’s valid for a project to use a mix of API tokens and Trusted Publishers because Trusted Publishers aren’t universally supported by all platforms. However, API tokens that are being unused over a period of time despite releases continuing to be published via Trusted Publishing is a strong indicator that the API token is no longer needed and can be revoked.
- GitHub Environments are optional, but recommended, when using a GitHub Trusted Publisher. However, PyPI doesn’t fail or warn users that are using a GitHub Environment that the corresponding Trusted Publisher isn’t configured to require the GitHub Environment. This fact didn’t end up mattering for this specific attack, but during the investigation it was noticed as something easy for project maintainers to miss.
There’s also a more general “What can you do as a publisher to the Python Package Index” list at the end of the blog post.
Clive Robinson • December 14, 2024 8:23 PM
@ Bruce, ALL,
If you think about it,
“If you make a wall of untested bricks from brickworks of unknown repute, do not be surprised if the edifice you build descends when least desired.”
Not being nasty to Open Source Development or nice to Closed Source development. At a basic level they are the same process and the outcome is dependent not on unfounded mantras but actual real tested and proven engineering. There is no place for artisanal craftsmanship using questionable “guild” patterns. I thought people had “seen the light” with regards to this as it is actually the reason “Software BOMs” are seen as a foundational activity.
On a more general note it is a well established engineering principle that the strength of a structure you build, rests in the mechanism by which load and stress is transmitted down through the structure and dissipated by being transmitted away.
This means that you really have to pay attention not just to the base foundations but what is both above and below them, they are integral to sound functioning. And like every link in a chain, it’s strength and weight within the whole is important if failure is to be avoided.
Those not just designing, but building systems, need to stop with the “Slap a bit of muck in” or “Just bolt/weld another bit on” almost “auto-reflex” behaviours.
Sure they can get things done quickly but by and large what they build up all to quickly is “Technical Debt”, “Complexity”, and really bad interfacing. Oh and a rather distinct lack of “Effective Error and Exception handling” and all the bad that results.
Just one bad of which is “Easy Supply Chain Vulnerabilities”, another is unwanted “Side Channels” hemorrhaging information that should not be disclosed. But “One that burns” is when “tools get abused” as all to often happens with tools these days.
Like much else that goes wrong in the Software Development Industry, all of these failings and most of what causes them are well known.
Thus you have to wonder why people are not questioning the processes that are quite obviously “Currently Failing Us?”…