← Java / Spring · Contents

JAVA-015 / Advanced

Spring4Shell (CVE-2022-22965): data binding and class-loader manipulation

A03:2021 Injection · CWE-94 Code Injection / A06:2021

Why is this a problem?

Logging settings can be altered through class.module.classLoader, leading to creation of a web shell.

How to fix it

java
@InitBinder void init(WebDataBinder b) { b.setDisallowedFields("class.*", "*.class.*"); }
// Upgrade to Spring 5.3.18 / 5.2.20 or later and Spring Boot 2.6.6 or later

Further reading