Fastjson提供autotype功能,允许用户在反序列化数据中通过 @type 指定反序列化的类型,其次Fastjson自定义的反序列化会调用指定类中的setter方法和部分getter方法。
当组件开启autotype并且反序列化不可信的数据时,攻击者构造的数据(恶意代码)会进入特定类的setter或getter方法中,可能会被恶意利用。
影响版本
Fastjson1.2.47以及之前的版本
复现
1.1 环境准备
攻击机1
用于接受反弹shell
系统:Win10 x64
安装nc,burpsuite
win10中需安装nc,用于监听反弹的shell。
在win10下,在nc官网(https://eternallybored.org/misc/netcat/)下载会报毒被拦截。
可以使用nmap中重置的ncat(https://github.com/andrew-d/static-binaries/blob/master/binaries/windows/x86/ncat.exe),与nc使用无区别。
下载后进入,ncat所在目录,执行ncat,出现如下输出则安装成功
攻击机2
提供一些必要服务
系统:Ubuntu
需安装:marshlsec ( https://github.com/mbechler/marshalse