Skip to content
RCE Write-up Advanced

Cloudflare's Log4j RCE 0-day mitigation – CVE-2021-44228

A zero-day in Apache Log4j allowed an attacker who could control log messages or log message parameters to execute arbitrary code loaded from LDAP servers when message lookup substitution was enabled. Cloudflare responded by deploying three WAF rules inspecting headers, body and URL.

blog.cloudflare.com

Published on blog.cloudflare.com

A zero-day exploit affecting the popular Apache Log4j utility (CVE-2021-44228) was made public on December 9, 2021, that results in remote code execution (RCE).

The author, on blog.cloudflare.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 JNDI lookup feature in Log4j message substitution processed attacker-controlled log content, allowing code to be loaded from an external LDAP server.

Impact

The vulnerability was actively being exploited and could result in remote code execution; Cloudflare's WAF rules were configured to block attempts in headers, body and URL.

What the attacker needed

Attacker controls log messages or parameters; message lookup substitution enabled; Log4j 2.0-beta9 to 2.14.1

The fix

Users should update to Log4j 2.15.0, or if that is not possible remove the JndiLookup class from the class path or set the format message no-lookups property or environment variable to true.

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 tool that many Java programs use to write down events. It had a feature that would look up and fetch extra information from another server when it saw a special pattern in a logged message. If an attacker could get their text into a log line, the program would fetch and run code from the attacker's server, which is remote code execution.

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.