Skip to content
RCE Write-up Advanced

I Found 7 Log4j (RCE) in a Single Program!

Several subdomains ran a Java application that logged user-controlled HTTP header values through Log4j, so a crafted header triggered a JNDI lookup to an attacker-controlled server. The author confirmed out-of-band callbacks and eventually achieved remote code execution on seven subdomains.

medium.com

Published on medium.com

Hey folks! Okay, okay, calm down — I’m not an alien, btw.

Abu Hurayra, on 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

Root cause

Likely the application passed attacker-controlled HTTP header values into Log4j without sanitising the JNDI lookup syntax, on a vulnerable Log4j version.

What the attacker needed

Vulnerable Log4j version; attacker-controlled header is logged; attacker-hosted LDAP/HTTP server

The fix

The application should be updated to a patched Log4j version and should not log unsanitised user-controlled header values.

How it was found

  1. Run the official Nuclei template against the target and see the CVE-2021-44228 match.
  2. Replace the template's Interactsh URL with your own out-of-band server and confirm a callback arrives.
  3. Set up an LDAP server, an HTTP server and a Netcat listener to deliver a Java payload.
  4. Send a request with a JNDI lookup in a header pointing at your LDAP server.
  5. Identify the shared server name and version across the vulnerable subdomains and scan all subdomains using it.

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 logging library for Java programs: it writes down things like request details. If it writes down text that an attacker controls, such as a header value, and that text contains a special lookup instruction, the library will go and fetch something from a server the attacker chose. That can lead to the attacker running their own commands 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.

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.