Setting the internet on fire — Log4j vulnerability
The Log4j2 library performs JNDI lookups on logged messages, so an attacker who can get a crafted string into a log entry can cause the server to fetch and execute remote code. This affects many Java applications that log user-controlled input such as HTTP headers.
Published on systemweakness.com
A lot of the applications that are powering the internet today are running using the Log4j library for java applications.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Log4j2 enables JNDI lookups by default and does not treat logged message data as untrusted, so special strings in log messages are interpreted and can trigger remote class loading.
Impact
An attacker could execute arbitrary code on the server, but the LDAP attack vector is blocked in newer JDK versions where remote codebase loading is disabled by default.
What the attacker needed
Application uses vulnerable Log4j2 version; Attacker can control a logged value; Outbound network access from server; JDK version that allows remote codebase loading
The fix
Upgrade to Log4j 2.15.0, or as a temporary measure disable lookups, remove the JndiLookup class, or block JNDI strings at a WAF.
How it was found
- Send an HTTP request to a Java application that uses Log4j2, placing a JNDI lookup string in a header or parameter that gets logged.
- The application logs the request, and Log4j2 processes the JNDI lookup.
- The JNDI lookup contacts an attacker-controlled server and downloads a malicious file.
- The downloaded code executes on the server.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Log4j is a tool that Java programs use to write down what happens while they run. If a program writes down something a user sent, like a browser header, and that text contains a special instruction, Log4j may follow it and download code from the internet. That lets an attacker run their own code on the server.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.