Skip to content
RCE Write-up Intermediate

The Log4Shell Nightmare: How a Tiny Piece of Code Broke the Inter

Log4j, a widely used Java logging library, contained a flaw where a specially crafted string starting with ${...} could trigger a JNDI lookup to an attacker-controlled server, which would then return malicious code that Log4j would execute. An attacker could send such a string in any logged input, such as a username or search query, to gain full control of the server.

Krishna Kumar Follow

Published on xalgord.medium.com

Hey there! If you’ve been dipping your toes into cybersecurity, you’ve probably heard whispers of a digital monster called “Log4Shell.” It was a huge deal that sent shockwaves through the tech world in late 2021.

Krishna Kumar, on xalgord.medium.com

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

Impact

An attacker could gain full control of the server, steal data, install ransomware, or use the server to attack other systems.

What the attacker needed

Server uses vulnerable Log4j version; Attacker can send input that gets logged; Attacker controls a server for JNDI lookup

The fix

The Log4j developers released patches to fix the vulnerability; updating to a safe version is the primary defence, and for systems that cannot be updated immediately, disabling JNDI lookup or using a WAF can help.

How it was found

  1. An attacker sends a crafted string starting with ${jndi:ldap://...} in any input that gets logged.
  2. Log4j interprets the string as a JNDI lookup instruction and connects to the attacker's server.
  3. The attacker's server responds with malicious software.
  4. Log4j executes the malicious software on the server, giving the attacker control.

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 many programs use to write down events in a diary. The flaw meant that if someone sent a special message that got written in the diary, the program would follow instructions in that message and run harmful software. This let attackers take over the computer.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by Krishna Kumar

View all

10 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.