Summary
Spring MVC automatically binds incoming request parameters onto Java objects. CVE-2022-22965 exists because that binding can reach an object's class property and, from there, its class loader.
Under specific conditions (JDK 9+, deployed as a WAR on Tomcat) an attacker can rewrite the access log configuration and have the server write content of their choosing to disk — in practice, a JSP web shell.
Advisory details
Root cause: an unbounded property chain
The binder supports nested paths such as address.city alongside simple fields. Left unrestricted, that path can continue as class.module.classLoader... and reach the application's runtime internals.
Spring had previously blocked class.classLoader; the module property introduced in JDK 9 opened a new way around that block. The fix closes every route to the class loader rather than blacklisting individual names.
Non-destructive check
Start with the version, read from the dependency tree.
analyst@ubuntu:~/labs/spring$ unzip -p app.war 'WEB-INF/lib/spring-beans-*.jar' > /dev/null; ls WEB-INF/lib | grep -E 'spring-(beans|webmvc)' spring-beans-5.3.17.jar spring-webmvc-5.3.17.jar # below 5.3.18 — affected range
Figure 1 — Reading the Spring versions bundled in the WAR
Exposure can be confirmed without writing anything to the server: bind an existing but harmless property. A patched build rejects the request (400); an unpatched build accepts it silently (200).
analyst@ubuntu:~/labs/spring$ curl -s -o /dev/null -w 'status: %{http_code}\n' 'http://app.lab.local/form?class.module.classLoader.DefaultAssertionStatus=potrex' status: 200 # a patched build returns 400 # 200 = binding can walk into the class loader
Figure 2 — Checking exposure without writing a file
Remediation
The primary fix is upgrading Spring Framework to 5.3.18 / 5.2.20 or later. While the upgrade is pending, a controller-level disallowed field list limits the damage.
analyst@ubuntu:~/labs/spring$ mvn -q versions:use-dep-version -Dincludes=org.springframework:spring-beans -DdepVersion=5.3.18 && mvn -q package && curl -s -o /dev/null -w 'status: %{http_code}\n' 'http://app.lab.local/form?class.module.classLoader.DefaultAssertionStatus=potrex' status: 400 # the binder now rejects the request — patch verified
Figure 3 — The check returns 400 after the upgrade
- Review the Tomcat access log configuration for unexpected changes.
- Search the web root for new or modified
.jspfiles. - Add an
@InitBinderrule that disallowsclass.*fields.
Log hunting
analyst@ubuntu:/var/log/tomcat9$ grep -ohE 'class\.module\.classLoader[^& ]*' localhost_access_log.*.txt | sort | uniq -c | sort -rn | head 46 class.module.classLoader.resources.context.parent.pipeline.first.pattern 46 class.module.classLoader.resources.context.parent.pipeline.first.suffix 3 class.module.classLoader.DefaultAssertionStatus # pipeline parameters = an attempt to write a file
Figure 4 — Exploitation parameters in access logs
Conclusion
Spring4Shell is a reminder of how much authority “convenience” framework features carry by default. Data binding, deserialisation and template engines should all operate on an explicit allow list of fields.
Sources
Test it in your own environment
We test your Java and Spring applications across data binding, deserialisation and template injection chains.