前天晚上在各大社交平台上看到一些安全大佬发的消息
但事实真的如此吗,就在今天,spring官宣了!让我们来看看官方的说明吧
概述
我想宣布在 CVE 发布之前泄露的 Spring 框架中的一个 RCE 漏洞。该问题首先由 AntGroup FG 的 codeplutos, meizjm3i 于周二晚间,接近格林威治标准时间午夜时分向 VMware 报告。周三,我们进行了调查、分析、确定修复、测试,同时瞄准周四的紧急发布。与此同时,同样在周三,详细信息已在网上全面泄露,这就是我们在发布和 CVE 报告之前提供此更新的原因。
漏洞
该漏洞影响在 JDK 9+ 上运行的 Spring MVC 和 Spring WebFlux 应用程序。具体的利用需要应用程序作为 WAR 部署在 Tomcat 上运行。如果应用程序被部署为 Spring Boot 可执行 jar,即默认值,则它不易受到漏洞利用。但是,该漏洞的性质更为普遍,可能还有其他方法可以利用它。
我受到影响了吗?
这些是报告中特定场景的要求:
但是,该漏洞的性质更为普遍,可能还有其他尚未报告的利用方法。
状态
建议的解决方法
注意:如果您能够升级到 Spring Framework 5.3.18和5.2.20,则不需要此部分。
泄露的报告建议disallowedFields通过WebDataBinder以下方式设置@ControllerAdvice:
@ControllerAdvice
@Order(Ordered.LOWEST_PRECEDENCE)
public class BinderControllerAdvice {
@InitBinder
public void setAllowedFields(WebDataBinder dataBinder) {
String[] denylist = new String[]{"class.*", "Class.*", "*.class.*", "*.Class.*"};
dataBinder.setDisallowedFields(denylist);
}
}
这通常有效,但作为集中应用的解决方法修复,可能会留下一些漏洞,特别是如果控制器disallowedFields通过其自己的方法在本地@InitBinder设置,这会覆盖全局设置。
为了以更安全的方式应用解决方法,应用程序可以扩展以在所有其他初始化之后RequestMappingHandlerAdapter更新最后。WebDataBinder为此,Spring Boot 应用程序可以声明一个WebMvcRegistrationsbean (Spring MVC) 或一个WebFluxRegistrationsbean (Spring WebFlux)。
例如在 Spring MVC 中(在 WebFlux 中类似):
package car.app;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.annotation.InitBinderDataBinderFactory;
import org.springframework.web.method.support.InvocableHandlerMethod;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
import org.springframework.web.servlet.mvc.method.annotation.ServletRequestDataBinderFactory;
@SpringBootApplication
public class MyApp {
public static void main(String[] args) {
SpringApplication.run(CarApp.class, args);
}
@Bean
public WebMvcRegistrations mvcRegistrations() {
return new WebMvcRegistrations() {
@Override
public RequestMappingHandlerAdapter getRequestMappingHandlerAdapter() {
return new ExtendedRequestMappingHandlerAdapter();
}
};
}
private static class ExtendedRequestMappingHandlerAdapter extends RequestMappingHandlerAdapter {
@Override
protected InitBinderDataBinderFactory createDataBinderFactory(List<InvocableHandlerMethod> methods) {
return new ServletRequestDataBinderFactory(methods, getWebBindingInitializer()) {
@Override
protected ServletRequestDataBinder createBinderInstance(
Object target, String name, NativeWebRequest request) throws Exception {
ServletRequestDataBinder binder = super.createBinderInstance(target, name, request);
String[] fields = binder.getDisallowedFields();
List<String> fieldList = new ArrayList<>(fields != null ? Arrays.asList(fields) : Collections.emptyList());
fieldList.addAll(Arrays.asList("class.*", "Class.*", "*.class.*", "*.Class.*"));
binder.setDisallowedFields(fieldList.toArray(new String[] {}));
return binder;
}
};
}
}
}
对于没有 Spring Boot 的 Spring MVC,应用程序可以从文档的高级配置部分中描述的直接@EnableWebMvc扩展,然后覆盖该方法。DelegatingWebMvcConfigurationcreateRequestMappingHandlerAdapter
误解围绕 deprecate 的承诺存在猜测SerializationUtils。此类在框架内只有一种用途,并且不暴露于外部输入。弃用与此漏洞无关。
在报告此漏洞之前发布的 Spring Cloud Function的 CVE 存在混淆。这也是无关的。
进一步更新当版本准备就绪时,我们将在此站点上发布另一个博客,以宣布它们的可用性。所以请继续关注https://spring.io/blog。如果有任何更正,我们也可能会更新此博客文章,在这种情况下,我们会在顶部明确指出这些内容。
官宣连接:点击查看
124 篇文章
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!