在 FastJson 1.2.83 版本中存在通过 DNSLog 回显的漏洞,风险影响较大。
解决方法:
在 Maven 项目的 pom.xml 文件中如果之前FastJson是用的1.X版本,修改 FastJson 的版本号为 1.2.83,maven更新
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.83</version>
</dependency>
在 SpringBoot 启动类上添加安全模式进行加固。添加代码如下:
public static void main(String[] args) {
//在 SpringBoot 启动类上添加安全模式进行加固
ParserConfig.getGlobalInstance().setSafeMode(true);
SpringApplication.run(TestApplication.class, args);
}
也可以启动时增加:nohup java -Dfastjson.parser.safeMode=true -jar ......