swaggo/http-swagger · Security
Denial of Service in http-swagger
- GHSA ID
- GHSA-xg75-q3q5-cqmv
- CVE ID
- CVE-2022-24863
- Severity
- high
- Published
- Updated
- CVSS
- 7.5 · CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- CVSS v3
- 7.5 · CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Description
Impact
Allows an attacker to perform a DOS attack consisting of memory exhaustion on the host system.
Patches
Yes. Please upgrade to v1.2.6.
Workarounds
A workaround is to restrict the path prefix to the "GET" method. As shown below
func main() {
r := mux.NewRouter()
r.PathPrefix("/swagger/").Handler(httpSwagger.Handler(
httpSwagger.URL("http://localhost:1323/swagger/doc.json"), //The url pointing to API definition
httpSwagger.DeepLinking(true),
httpSwagger.DocExpansion("none"),
httpSwagger.DomID("#swagger-ui"),
)).Methods(http.MethodGet)
References
Reporter dongguangli from https://www.huoxian.cn/ company
For more information
If you have any questions or comments about this advisory:
- Open an issue in http-swagger
CWEs
- CWE-400 · Uncontrolled Resource Consumption
- CWE-755 · Improper Handling of Exceptional Conditions
References
- https://github.com/swaggo/http-swagger/security/advisories/GHSA-xg75-q3q5-cqmv ↗
- https://nvd.nist.gov/vuln/detail/CVE-2022-24863 ↗
- https://github.com/swaggo/http-swagger/pull/62 ↗
- https://github.com/swaggo/http-swagger/commit/b7d83e8fba85a7a51aa7e45e8244b4173f15049e ↗
- https://github.com/swaggo/http-swagger/releases/tag/v1.2.6 ↗
- https://cosmosofcyberspace.github.io/improper_http_method_leads_to_xss/poc.html ↗
- https://github.com/advisories/GHSA-xg75-q3q5-cqmv ↗