Skip to content
RCE Write-up Advanced

A Technical Analysis of How Spring4Shell (CVE-2022-22965) Works

Spring Core parameter binding allowed attackers to access the class variable and its child properties, bypassing a blocklist to reach the Tomcat AccessLogValve and write a web shell, leading to remote code execution.

extrahop.com

Published on extrahop.com

On March 29, 2022, ExtraHop's Threat Research team noticed social media chatter about a new remote code execution (RCE) vulnerability (a supply chain attack now officially confirmed as CVE-2022-22965) in the Spring Core Framework and began tracking the issue. Spring Core is a ubiquitous open-source framework for Java…

The author, on extrahop.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely, the blocklist that prevented access to child properties of the class variable was incomplete, allowing bypass via 'class.module.classLoader'.

Impact

An attacker could achieve remote code execution on affected Spring Core applications running on Apache Tomcat, potentially leading to full server compromise.

What the attacker needed

Spring Core application; Apache Tomcat server; Parameter binding to a POJO without @RequestBody

The fix

Spring Core was officially patched for this vulnerability on 31 March 2022.

How it was found

  1. Send a request with a parameter bound to a POJO (not annotated with @RequestBody) that includes the class variable.
  2. Use the selector class.module.classLoader to bypass the blocklist and access child properties.
  3. Follow the property chain to reach the AccessLogValve object in Tomcat.
  4. Manipulate AccessLogValve properties (pattern, suffix, directory, prefix) to write a web shell into the webroot.
  5. Access the web shell to execute commands on the server.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Spring Core is a tool that helps Java websites take data from web requests and put it into objects. A flaw let attackers sneak in a special field called 'class' to reach internal parts of the server, and on Tomcat they could change logging settings to write a malicious file (a web shell) that runs commands. This means an attacker could run their own code on the server.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.