有大神了解该漏洞,详细说明下原理吗,如果被利用大概会出现什么问题
在Spring框架的JDK9版本(及以上版本)中,远程攻击者可在满足特定条件的基础上,通过框架的参数绑定功能获取AccessLogValve对象并诸如恶意字段值,从而触发pipeline机制并 写入任意路径下的文件。
目前已知,触发该漏洞需要满足两个基本条件:
使用JDK9及以上版本的Spring MVC框架
Spring 框架以及衍生的框架spring-beans-*.jar 文件或者存在CachedIntrospectionResults.class
漏洞影响范围:
JDK9 <= Spring Cloud Function
执行“java-version”命令可查看JDK版本
临时缓解措施
在应用系统的项目包下新建以下全局类,并保证这个类被Spring 加载到(推荐在Controller 所在的包中添加).完成类添加后,需对项目进行重新编译打包和功能验证测试。并重新发布项目。
- import org.springframework.core.annotation.Order;
- import org.springframework.web.bind.WebDataBinder;
- import org.springframework.web.bind.annotation.ControllerAdvice;
- import org.springframework.web.bind.annotation.InitBinder;
- @ControllerAdvice
- @Order(10000)
- public class a{
- @InitBinder
- public void setAllowedFields(WebDataBinder dataBinder) {
- String[] abd = new String[]{"class.*", "Class.*", "*.class.*", "*.Class.*"};
- dataBinder.setDisallowedFields(abd);
- }
- }
复制代码
|