Skip to main content
•3 min read

From Log4Shell to Java4Shell: How to Defend Against the Next CVE?

By

From Log4Shell to Java4Shell, apply SIP for Java with hardened images, SBOMs, signing, vulnerability scanning, and automated updates before the next CVE.

JavaSecurityContainer SecuritySupply ChainSBOMSIP

December 2021 arguably started the modern era of software supply-chain security. Log4Shell hit, and people were running across hallways, asking, "Are we using this version of Log4j?" The highly anticipated Java4Shell vulnerability arrived in November 2026, after 5 years of waiting; similar to GTA VI. We have gone a long way since then, let's do a recap.

History: Log4Shell, the Wake-up Call

After Log4Shell happened, people wanted to know if they were affected. Back then, it wasn't an easy question to answer. The catch was this: Even if you did not have the vulnerable Log4j library in your application, you could still be vulnerable if a dependency you used did. It's called a transitive dependency; because, mathematics. And, if you didn't have good tooling, it's not easy to scan the whole dependency tree.

On the 1st of December 2022, Docker hosted Docker Community All Hands #6 and announced their new CLI command:

$ docker sbom <image>

We had a watching party at Docker Meetup in Freiburg, and everyone was like, "What is this S-bomb thingy?"

As you know, SBOM, which stands for Software Bill of Materials, is a list of all the components in a software artifact, including their versions and licenses.

So with the introduction of this new command, you had a standard format document to check against the Log4j version you wanted to find. An SBOM more comprehensive than a list of dependencies, because it includes the OS package, language libraries including the transitive dependencies, and other metadata about these components.

Note that, 5 years later, this command is removed from the Docker CLI, and replaced by:

$ docker scout sbom <image>

How to Defend Against the Next Log4Shell?

The short answer is, you need to harden your supply chain. The longer answer is, do these four things as a baseline:

    1. Freeze your dependencies and have a 5-day quarantine for new releases.
    1. Use a hardened base Docker image for your Docker containers.
    1. Generate SBOMs attestations and ship then with your Docker images.
    1. Check the CVEs before going live.

So, I have given you the solutions before the problem, because I know our attention span is TikTok short. So, if you want more details, read on.

In this 4-step plan, each step is a control that precedes the next one. You should be careful about your dependencies, before they end up on the Docker image. Then you should have a hardened base image, so that fewer packages and in turn CVEs end up on them. Then, we need to have a list of those packages, and the best place to put them is alongside the Docker image. Finally, an SBOM attestation makes checking CVEs easier, as the CVE tool doesn't need to scan the image again to find what's on it.

And the list starts from 2, because the first step is having trust on your development machine:

    1. Sandbox your AI coding agents.

We will get to that part later.