Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1020 CNY

100%

CVE-2021-44228 PoC — Apache Log4j2 JNDI features do not protect against attacker controlled LDAP and other JNDI related endpoints

Source
Associated Vulnerability
Title:Apache Log4j2 JNDI features do not protect against attacker controlled LDAP and other JNDI related endpoints (CVE-2021-44228)
Description:Apache Log4j2 2.0-beta9 through 2.15.0 (excluding security releases 2.12.2, 2.12.3, and 2.3.1) JNDI features used in configuration, log messages, and parameters do not protect against attacker controlled LDAP and other JNDI related endpoints. An attacker who can control log messages or log message parameters can execute arbitrary code loaded from LDAP servers when message lookup substitution is enabled. From log4j 2.15.0, this behavior has been disabled by default. From version 2.16.0 (along with 2.12.2, 2.12.3, and 2.3.1), this functionality has been completely removed. Note that this vulnerability is specific to log4j-core and does not affect log4net, log4cxx, or other Apache Logging Services projects.
Description
fail2ban filter that catches attacks againts log4j CVE-2021-44228
Readme
# fail2ban-log4j
fail2ban filter that catches attacks against log4j CVE-2021-44228

## Installation
Copy this file to your fail2ban filter.d directory, which is usually something like  
/etc/fail2ban/filter.d  
or similar.  

Add an apache-jndi section to your jail.local or jail.conf:  

```
[apache-jndi]
enabled = true
filter = apache-jndi
port = http,https
logpath = /var/log/apache2/access.log
bantime = 86400
maxretry = 1
```

In case you need to monitor multiple sites, wildcards may help:  

```
[apache-jndi]
enabled = true
filter = apache-jndi
port = http,https
logpath = /var/www/*/logs/access.log
bantime = 86400
maxretry = 1
```

Logpath for LAMP servers managed by ispConfig:

```
logpath = /var/www/clients/client*/web*/log/access.log
```

These are examples assuming
- A single try reveals that they're a bad guy
- You only want to block further http(s) traffic. Of course, you might as well block any other ports, too.


### Effectiveness  

As of now, this regex catches jndi:ldap requests that contain "jndi:ldap" and one obfuscated version using "lower".  
I'll add more as soon as I find them, but feel free to submit suggestions. 

#### Does it work?

Yes and no. From a technical point of view, it does what it is supposed to to. It detects known formats of log4shell attempts and should at least keep those who don't put too much effort in their scans blocked from your machines. Unfortunately, the possibilities of masking / obfuscating these requests are unlimited, so keeping up with all possible RegEx variants might appear like a cat-and-mouse game.

#### Like this?

If this saved you some time, why not [Buy me a coffee](https://www.buymeacoffee.com/atnetws)? ;)

File Snapshot

[4.0K] /data/pocs/1dec0ec645b869cc0701d50e55c727b80a7ce7e5 ├── [ 465] apache-jndi.conf ├── [ 654] Changelog ├── [ 266] fail2ban-sample.conf ├── [ 202] iplist.txt ├── [ 34K] LICENSE └── [1.7K] README.md 0 directories, 6 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →