Deep Dive: Supply Chain Attacks

When a company gets breached through its supply chain, the code that fails first usually isn't its own. In this deep dive, Rhythmic CEO Cristopher Daniluk unpacks how these attacks unfold, why the defenses most teams trust fall short, and what real protection takes. [9:09]

Key Takeaways

  • Supply chain breaches usually start in the build process, not your own code. Modern teams compile dozens of times a day and re-download dependencies every time.
  • A small app can have 500 dependencies, and about 90% of running code is packages nobody on the team chose or reviewed.
  • It only takes one compromised package. Attackers target volunteer open-source maintainers, and auto-update jobs that ship to production hand malicious code a path to AWS keys, database passwords, and API keys.
  • Version pinning and Dependabot are no longer enough. Attackers now replace older pinned versions, and constant auto-upgrades can make the problem worse.
  • The strongest defenses are simple but tedious: wait 72 hours before adopting new versions, download each package once into a trusted internal repo, generate a Software Bill of Materials with every build, and consider self-hosted CI/CD runners behind your firewall.

Deep Dive: Supply Chain Attack
===

~all right. ~[00:00:00] Cris when companies get breached from a supply chain standpoint, it’s usually not their own code that fails first.

Can you talk about how that type of breach unfolds?

~Yeah. It’s usually, ~It’s usually areas of the build process as an example and it can happen at any time. ~You know, ~One of the things that we do now that we didn’t do as much five years and certainly not 10 and 15 years ago is compile our code all the time. It’s not unusual to build code dozens of times a day.

And we develop these habits on how we pull in our dependencies when we were doing this once a week or where we might compile every day on our laptop, but we ~down those, ~download those dependencies once and then never again. Now we’re reliant on ephemeral build infrastructure, and it’s very common for a, say, a GitHub action, for example, to every time somebody checks in code, run a bunch of [00:01:00] checks.

And that requires downloading those checks, which themselves are dependencies, but then also compiling the code, and typically that then means downloading all of the packages and dependencies that your application has. Some of these languages have gotten so scattered and so dependent on their dependency ecosystem that it’s not unusual for a relatively small piece of software to have 500 dependencies.

And they’re not just ones that the developers are explicitly including. A lot of times developers are bringing in 30 to 40 dependencies, ~uh,~ with intention, but those dependencies have their own transitive dependencies, and so you get this spider web that grows. It’s funny hearing people talk about how developers are using AI to generate code and they’re not reading it anymore, and how dangerous is it that they’re not reading their code anymore.

Well, 90% of the running code is these dependencies that were downloaded that you didn’t even intentionally pick, but we’re gonna [00:02:00] gatekeep on the 10% that you wrote has to be read when you didn’t consider at all what you were pulling in. And so you can kind of imagine then how little intention and attention we were giving to the below the waterline iceberg monstrosity that our code is built on, our actual written code is built on, how that might create a problem.

And so all it takes is one of those packages that you didn’t even explicitly pick getting compromised. And how do they get compromised? A lot of times it’s their GitHub, the developers, the maintainers, these open source guys who are out there voluntarily supporting some obscure library that’s actually vital to millions of sites on the internet because they can and want to, and they’re willing to donate their time.

If one of those guys has a bad moment, clicks a bad link, leaks their GitHub key, and all of a sudden they’re [00:03:00] compromised. ~Their packages are compromised. ~A lot of companies are just pulling down whatever the latest version is. A lot of companies run jobs that explicitly just update every single night every dependency they use and run the unit tests on them to see if it passes or not, and some of them use that just as an information signal.

Some of them use that to ship directly to production. If the test passed, then it must work, let’s take it. And in either of those cases, you’re presenting opportunities for malicious code to run. If it’s in your GitHub action, it can go out and get the secrets that GitHub action was assigned, like your AWS access keys, and it can leak them to the internet.

Your keys to other internal systems that your build process requires can be leaked. The real dangerous thing is when it gets deployed to production automatically, and those deployments then have access to database passwords and API keys for third-party services. And so all it takes is one developer in that entire chain of trust that you ~didn’t even realize was– that you ~were trusting to have a bad [00:04:00] mistake that then immediately ~i-it~ enters your build process.

That’s really hard to solve for. It’s solvable, but it requires doing a lot of things that developers would rather not have to deal with because they wanna deploy as fast as possible. ~They don’t– ~And they wanna build as fast as possible. One of the things that you can do is not upgrade your versions automatically, upgrade them with intention. Another thing you can do is pin to not the version, which itself is subject to be replaced, but to the signature of the release that you were intending to use.

And that requires adjusting your tactics. Teams don’t wanna do that.

The blast radius of a supply chain attack is really a matter of timing and what decisions did a company make to protect themselves. So as an example, the vast majority of supply chain attacks release a new version. They don’t manipulate older versions.

But some of the more sophisticated attackers are getting good at strategies to [00:05:00] replace older versions that you might have pinned to ~with, excuse me, ~with a compromised version. So even if you did pin, you would still get stuck with malicious code the next time you built. Other companies are doing things like, “I won’t take a version of a package unless it’s been out for 72 hours.”

Usually, we find these supply chain attacks at about four hours, sometimes faster sometimes it takes a little longer, but there are a couple of companies out there that are doing a really good job of looking for detecting and then blocking and publicizing these attacks. ~Um,~ And so that’s a protection.

Other companies are saying, “Download once to my entire environment. Do not download this package ever again. I’ve validated it once. I can trust it, and now everybody will just download that package, and all of my ephemeral builds, instead of sourcing from the internet, will source from that one trusted repo.”

That’s about the highest level of protection you can get and [00:06:00] coupling that with a good scanning software like Socket gives you ~some, a, ~a really good set of protection, and it doesn’t cost you a ton of money to operate. But it’s tedious to set up, and it interrupts your build process. So companies need to decide how much impact they are willing to have on their build process to get protection from it, and the damage caused by a supply chain attack will depend on ~where,~ where they are in that sort of spectrum of defense from it.

Do you recommend that companies map these dependencies out? It sounds like they don’t really know about them until it’s too late.

~Yeah. A- and you don’t even need to~ You don’t even need to buy expensive software to do this. Most, like NPM~ and,~ and Python they have tools that will produce what’s called a Software Bill of Materials, which is a map of all of the different dependencies that you have. And there are strategies where you can protect yourself against those transitive dependencies, ~um, y-~ where you can say, “I’m not intentionally bringing this into [00:07:00] my environment, but because it’s being brought into my environment, these are the terms in which I will accept it.”

Again, that’s work to do, and companies have to make the decision to do it, but a Software Bill of Material is a really good starting point. And it gives you a lot of protection down the road if you do have a problem, but every time you built your software, you made an SBOM, you can figure out where you were exposed, and if you were actually exposed or if you just were at risk but didn’t actually set off the trigger.

Do you think there are steps in the process that are kind of false sense of security? Like you mentioned scanners earlier, the people run a scan, they’re clean, they think they’re all good to go There definitely is a lot of false sense of security. Version pinning is one thing that people do that they think that’s the end game. And that might have worked pretty effectively a year or two ago, but it’s not sufficient for the sophistication of the attacks that are happening right now.

A lot of people think that just the simple act of running [00:08:00] a constant Dependabot that looks for and upgrades vulnerable packages is a virtuous process. It’s actually a very dangerous process for exactly this reason. And so a lot of the fixes that people are taking on for their perceived supply chain risk are actually making the problem worse.

I think that ~cloud-hosted,~ in particular cloud-hosted CI/CD runners like GitHub Actions are actually one of the most dangerous attack vectors because you have the least control ~orgas-~ organizationally of what those little bots do for you on your behalf out in GitHub’s infrastructure. Self-hosted runners mean you can put them behind your firewall, know what they did at least so that if something happens, if you found out there was an attack, you could go look at network firewall logs and see, “What did my runners access?”

You can’t do that with cloud-hosted runners. And a lot of people did ~cloud hunter- ~cloud-hosted runners explicitly because they believed they were more secure. So I think people need to, let me say this gently, talk to [00:09:00] people who know what they’re talking about instead of thinking that because they’re developers, they know how security works.

Be open-minded and be willing to make changes.

Scroll to Top