type
status
date
slug
summary
tags
category
icon
password
漏洞简介:
log4j是Apache公司的一款JAVA日志框架,基本上只要是java的框架都会用到这个log4j框架,所以上周不管是不是IT圈的都几乎被刷屏了,可见这个洞的危害之大,波及范围之广。所以复现一下。
影响版本:
Apache Log4j 2.x >=2.0-beta9 且 < 2.15.0
复现环境1:
1.log4shell-vulnerable-app环境:

2.下载JNDIExploit工具,监听8888端口开启LADP服务:

3.poc就是在http请求头中加入:


Command/Base64是指把命令先经过base64编码
4.这里一定要注意靶机的ip地址:

5.命令执行成功,已经创建了/tmp/pwned文件:


JNDIExploit支持多种的注入方式包括命令,dnslog,shell和reverseShell等方式
反弹nc:
由于靶机环境没有bash,所以用nc反弹/bin/sh


命令已经成功被解析,反弹成功。

如果base64编码出现+号的话,要经过url编码(如果使用hackbar或burp)
复现环境2:
1.运行vulfocus/log4j2-rce-2021-12-09靶机环境:

2.使用JNDI-Injection-Exploit一键注入:


😅这两个靶机的页面好像啊。。。

这个靶机的poc是使用rmi的,其他大部分用的是LDAP


反弹nc:




反弹成功。
复现环境3:
1.使用python复现环境,安装依赖包:
浏览器输入ip+8080端口:

在网页输入框中输入payload,就是运行poc之后输出的jndi注入链接


如果是window环境,需要更换一下poc.py中的/bin下的jdk目录。

需要jdk1.8的环境
复现环境4:
1.下载window上的靶场环境:

2.打开浏览器ip+8888端口,配合JNDI-Injection-Exploit就可以弹出计算器了。


安全建议:
1.升级log4框架。
2.禁止日志服务器外连。
3.添加jvm启动参数:-Dlog4j2.formatMsgNoLookups=true
4.使用高版本JDK
- 作者:lion
- 链接:https://blog-flame-tau.vercel.app/article/log4j2%E6%BC%8F%E6%B4%9E%E5%A4%8D%E7%8E%B0
- 声明:本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。