Exploiting the Log4j Vulnerability (CVE-2021–44228) — Pro
The Log4j 2 library is vulnerable to remote code execution via JNDI lookups when user-controlled input is logged. An attacker can send a crafted string that causes the server to fetch and execute malicious code, leading to a reverse shell.
Published on medium.com
The Log4Shell vulnerability (CVE-2021–44228) is a critical remote code execution (RCE) vulnerability in the Apache Log4j 2 library. This vulnerability allows attackers to send a specially crafted JNDI (Java Naming and Directory Interface) lookup query that can lead to the execution of arbitrary code on a vulnerable…
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 execute arbitrary commands on the vulnerable server, leading to a reverse shell and full system compromise.
What the attacker needed
Vulnerable Log4j 2 version; attacker-controlled input logged; network access to LDAP server
The fix
The vulnerability was fixed in Log4j 2.16.0 by disabling JNDI lookups by default; other mitigations include setting log4j2.formatMsgNoLookups to true or removing JNDI lookup classes.
How it was found
- Clone the exploit repository from GitHub.
- Build and run the Docker container for the PoC.
- Install a vulnerable Java version (JDK 8u202).
- Modify the poc.py script to point to the Java installation.
- Start a Netcat listener on port 9001.
- Run the exploit script and inject the payload into a vulnerable input field.
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 used by many Java applications. It can process special strings that tell it to look up external resources. If an attacker can get such a string into a log message, the server may download and run the attacker's code, giving them control of the machine.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.