Supply Chain Attacks

Recently, there have been a lot of supply chain attacks in the news. This large volume of attacks caught my attention, so here I am, writing this article.

What is a Supply Chain Attack?

We're way past the point of writing our own code for everything. It would simply not be feasible to do so at the scale at which we operate today.

Almost all applications today rely on a large number of third-party libraries. Those libraries, in turn, depend on other libraries and so on. This creates a complex web of dependencies that is very difficult to reason about.

Some of those 3rd party libraries are maintained by large corporations. Others are maintained by foundations, while some are maintained by small teams or even single individuals.

A supply chain attack is an attack that targets one of these libraries.

Attackers need to compromise a single library in this complex chain in order to compromise entire applications.

A single well-placed line of code in a popular library can infect thousands of applications, so well-executed supply chain attacks are very dangerous.

What Happened Now?

What triggered me to write this article is the recent news about the LiteLLM incident.

In short, versions 1.82.7 and 1.82.8 of LiteLLM, a popular open-source library for working with LLMs, were compromised.

Perhaps the most famous supply chain attack is the SolarWinds attack, where attackers compromised the build process of SolarWinds' Orion platform. Through these malicious builds, they were able to gain access to the networks of a lot of SolarWinds' customers. There were some large names involved, including the US Department of the Treasury, the Department of Homeland Security, and Microsoft.

Why are these attacks so frequent? I believe this is a game of numbers: there are a lot of possible targets and a successful attack can have a huge impact.

Attack Vectors

1. Compromised Dependencies One of the most common vectors of supply chain attacks.

2. Typosquatting This entails publishing malicious packages with names that are similar to well-known packages. Think of something like spring-data-jpa vs spring-data-gpa.

3. Dependency Confusion An attack where an attacker publishes a malicious package with the same name as an internal package, but in a public registry.

4. Compromised Build Systems If attackers gain access to your build system, they can inject malicious code directly into the build artifacts. This is what happened in the SolarWinds attack.

What Can You Do About It?

There is little you can do to completely prevent a very well-executed supply chain attack. However, there are several things you can do to mitigate the risk.

Apply Security Best Practices

Scan Your Dependencies

Work With Reputable Vendors

Takeaways