Spring Cloud Gateway is an API gateway in Spring. Versions 3.1.0 and 3.0.6 (inclusive) and prior contain a SpEL expression injection vulnerability. If an attacker can access the Actuator API, the vulnerability can be exploited to execute arbitrary commands.
Environment Setup
Run the following command to start a web service that uses Spring Cloud Gateway 3.1.0:
docker-compose up -d
After the service starts, access http://your-ip:8080 to see the demo page, and the upstream of this page is example.com.
Vulnerability Reproduction
Exploiting this vulnerability requires multiple steps.
First, send the following packet to add a route containing malicious SpEL expression: