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

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2021-44228 PoC — Apache Log4j 代码问题漏洞

Source
Associated Vulnerability
Title:Apache Log4j 代码问题漏洞 (CVE-2021-44228)
Description:Apache Log4j是美国阿帕奇(Apache)基金会的一款基于Java的开源日志记录工具。 Apache Log4J 存在代码问题漏洞,攻击者可设计一个数据请求发送给使用 Apache Log4j工具的服务器,当该请求被打印成日志时就会触发远程代码执行。
Description
CVE-2021-44228 server-side fix for minecraft servers.
Readme
# mc-log4j-patcher

Replaces old (vulnerable - CVE-2021-44228) Log4j2 version with the latest one (2.15.0) that contains the JNDI RCE fix.\
Tested on Spigot 1.12.2, PaperSpigot 1.8.8, PaperSpigot 1.17.1

This is intended to fix servers that are currently unsupported, such as PaperSpigot 1.8.8\
Please check if your current server software has an official release fixing the vulnerability before using this tool.

Usage:\
`java -jar patcher.jar <old-server.jar> <fixed-server.jar>`

[Download patcher.jar](https://github.com/OopsieWoopsie/mc-log4j-patcher/raw/main/patcher.jar)

If you use PaperSpigot, then the "old-server.jar" file should be the one located at "cache/patched.jar" and not the paperclip.jar wrapper.\
After the process finishes, you need to replace your old server jar with the "fixed-server.jar" one.

### Example usage with PaperSpigot 1.17.1
```
server$ java -jar patcher.jar cache/patched_1.17.1.jar server.jar
Input file  : cache/patched_1.17.1.jar
Output file : server.jar
Processing original Jar file...
Adding nolookups to log4j2.xml ... Done
Adding Log4j2 2.15.0 (core+api+iostreams)... 
(You can likely ignore this) : duplicate entry: META-INF/MANIFEST.MF
(You can likely ignore this) : duplicate entry: META-INF/NOTICE
(You can likely ignore this) : duplicate entry: META-INF/maven/org.apache.logging.log4j/log4j-core/pom.xml
(You can likely ignore this) : duplicate entry: META-INF/services/javax.annotation.processing.Processor
(You can likely ignore this) : duplicate entry: META-INF/LICENSE
(You can likely ignore this) : duplicate entry: META-INF/DEPENDENCIES
(You can likely ignore this) : duplicate entry: META-INF/maven/org.apache.logging.log4j/log4j-core/pom.properties
(You can likely ignore this) : duplicate entry: META-INF/maven/org.apache.logging.log4j/log4j-api/pom.properties
(You can likely ignore this) : duplicate entry: META-INF/maven/org.apache.logging.log4j/log4j-api/pom.xml
Finished
```

And then to run the server:
```
server$ java -jar server.jar nogui
System Info: Java 16 (Eclipse OpenJ9 VM openj9-0.27.0) Host: Linux 5.4.0-81-generic (amd64)
Loading libraries, please wait...

...(server loading log)...
```
File Snapshot

[4.0K] /data/pocs/cfcbd2313e3139b2c1f4ab0cdab811f991313d9f ├── [ 34K] LICENSE ├── [1.8M] patcher.jar ├── [1.1K] pom.xml ├── [2.1K] README.md └── [4.0K] src └── [4.0K] main ├── [4.0K] java │   └── [4.0K] me │   └── [4.0K] sheidy │   └── [4.7K] Patcher.java └── [4.0K] resources └── [2.0M] log4j-2.15.0-all.jar 6 directories, 6 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. If the original source is unavailable, please email f.jinxu#gmail.com for a local snapshot (replace # with @).
    3. Shenlong has snapshotted the POC code for you. To support long-term maintenance, please consider donating. Thank you for your support.