Blog / Tech, New & Old /

The Log4j vulnerability explained

In December 2021, a lot of people in IT had a very bad weekend. The cause was a tiny piece of software that most of the world had never heard of: Log4j.

The Log4j vulnerability, nicknamed Log4Shell, was a serious security flaw in a widely used Java logging library. It let an attacker make a vulnerable server run code of their choosing just by getting a certain piece of text written into the server’s logs. It’s tracked as CVE-2021-44228 and was rated the maximum severity score of 10.

Let me explain what that means in normal words.

What is Log4j?

Almost every piece of software keeps a diary. When something happens, such as a user logging in, an error appearing or a page being loaded, the software writes a line into a log. That log helps developers work out what went wrong later.

Log4j is a popular free library, made and maintained by the Apache Software Foundation, that Java programs use to write those diary entries. Because it’s free, reliable and easy to add, it ended up inside an enormous number of products: business software, cloud services, games, appliances and more.

The analogy is a standard bolt. Thousands of manufacturers use the same bolt. If someone discovers that this bolt can be undone with a particular trick, then every machine that uses it is suddenly at risk, and none of the makers can easily say how many machines contain one.

What went wrong?

Log4j had a feature that let text in a log message trigger a “lookup”, essentially a request to fetch something from somewhere else. One kind of lookup could contact a remote server and load instructions from it.

So an attacker didn’t need to break in. They could send a specially written string, say in a username field, a web address or even something as ordinary as a browser’s identifying text. If the vulnerable application wrote that string to its log, Log4j would act on it and reach out to the attacker’s server. That could end with the attacker running their own code on the victim’s machine.

Two things made it so serious:

  • It was easy. A single line of text could be enough.
  • It was everywhere. Many organisations didn’t know Log4j was inside the software they used, because it was buried inside other products.

How the world reacted

The flaw was publicly disclosed in the second week of December 2021. Security teams scrambled to find out where Log4j lived in their systems. The Apache team released fixes quickly, and then further updates as related weaknesses were found.

Attackers moved fast too. Scans for vulnerable systems began almost immediately, and criminals tried everything from crypto mining to broader intrusions. Governments and agencies issued warnings. For many companies, the real difficulty wasn’t installing the fix; it was working out which of their systems needed it.

What it taught the industry

You can’t protect what you can’t list. A software bill of materials (a list of every component in your software) went from a nice idea to something people seriously wanted.

Open source needs support. A critical library used by half the internet was maintained largely by volunteers. After this, there was a louder conversation about funding and securing open-source projects.

Defence in depth matters. Network controls, limits on what servers can reach outwards, and quick patching all reduce the damage when a single component fails.

What it means for you

If you’re a normal user, there was little you could do directly. The advice was to keep apps and devices updated, and to watch for notices from the companies you use. Reuse of passwords across sites made any resulting breach worse, which is a good reason to use a password manager.

If you run a website, it’s worth knowing that most WordPress sites aren’t Java applications, so Log4j wasn’t a WordPress issue as such. But the lesson transfers perfectly to plugins and themes. The same pattern, a small shared component that many sites depend on, shows up in the PHP and JavaScript world too. A few habits help:

  • Keep an inventory of what runs on your site: plugins, themes, libraries, services.
  • Update promptly, and remove what you don’t use.
  • Know who to ask: your host or developer should tell you quickly if something you depend on is affected.

I wrote about running that kind of inventory in managing several client websites at once, and the habit pays off long before any big security event.

A quick way to think about patching

When a flaw like this appears, the order of work is usually the same. First, find out whether you use the affected component at all. Second, apply the vendor’s fix or a recommended workaround. Third, check logs for signs that someone tried to exploit it before you patched. Fourth, write down what you learned so the next alert is faster. It’s not glamorous, but it’s the difference between an annoying week and a long one.

Common myths

“It only affected big companies.” Any organisation running vulnerable Java software was exposed, including small ones using products that contained it.

“Updating once fixed it forever.” Several follow-up fixes were issued, so the first update wasn’t the last.

“It was a hack of Apache.” No. It was a flaw in a feature of the software, found by researchers.

Key takeaways

  • Log4j is a common Java logging library; Log4Shell (CVE-2021-44228) let attackers run code through crafted log text.
  • It was severe because it was easy to exploit and buried in countless products.
  • The biggest challenge was finding where the library was used.
  • Keep an inventory of your components and update promptly.

FAQ

Is Log4j still a risk? Fixed versions exist, but old unpatched systems can still be vulnerable.

Do I need to do anything as a user? Mostly, keep software updated and use unique passwords.

What does CVE mean? A public ID number for a known security flaw.

Do you actually know every component your own site or business relies on? If not, that list is your next job.