Log4j RCE When Remote Class File Won’t Load (Newer Java Versions)
A Log4j vulnerability allowed JNDI injection, but remote class loading was disabled on the target's Java version, so the attacker used a serialized payload served via LDAP to achieve deserialization and remote code execution.
n0ur5sec.medium.com
Published on n0ur5sec.medium.com
So you might have heard of the log4j vulnerability (lol). If you’ve read the initial proof of concepts/general information that rushed out at first - in most cases it all point you in the same direction…
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 Log4j library performed JNDI lookups on user-controlled input without proper validation, and the target deserialized untrusted data from the LDAP response.
Impact
The attacker could execute arbitrary commands on the target, leading to a reverse shell and potential further compromise.
What the attacker needed
Vulnerable Log4j instance; attacker-controlled LDAP server; target Java version allows deserialization
How it was found
- Identify a vulnerable Log4j instance via a Burp plugin and confirm JNDI injection with a DNS lookup.
- Determine the Java version using JNDI payloads that leak system properties via DNS.
- Generate a serialized payload with ysoserial that runs a blind command (nslookup) to a Burp Collaborator URL.
- Serve the serialized payload using JNDI-Exploit-Kit as an LDAP serialized payload.
- Send a request with a JNDI payload pointing to the malicious LDAP server to trigger deserialization.
- Observe the DNS lookup to confirm command execution, then escalate to a reverse shell.
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 that can be tricked into fetching data from an attacker's server. Normally this lets an attacker run code, but newer Java versions block one way of doing that. The author instead sent a special serialized object that the target deserialized, which ran commands.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.