7.5high
Denial of service in http-swagger
- Severity
- 7.5high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 2.44% (higher than 84% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-49w7-5r33-jm9mGHSA-xg75-q3q5-cqmvGO-2022-0427
Description
http-swagger is an open source wrapper to automatically generate RESTful API documentation with Swagger 2.0. In versions of http-swagger prior to 1.2.6 an attacker may perform a denial of service attack consisting of memory exhaustion on the host system. The cause of the memory exhaustion is down to improper handling of http methods. Users are advised to upgrade. Users unable to upgrade may to restrict the path prefix to the "GET" method as a workaround.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| swaggo http-swagger | < 1.2.6 | CVE List |
| github.com/swaggo/http-swagger (Go) | before 1.2.6 | GitHub Advisory Database, Go Vulnerability Database |
| http-swagger_project http-swagger | before 1.2.6 | NVD |
All scores
| GitHub_M | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| GitHub | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
| GitHub | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| NVD | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| NVD | 7.8high CVSS:2.0 | AV:N/AC:L/Au:N/C:N/I:N/A:C |
Classification
What each source says
CVE List
http-swagger is an open source wrapper to automatically generate RESTful API documentation with Swagger 2.0. In versions of http-swagger prior to 1.2.6 an attacker may perform a denial of service attack consisting of memory exhaustion on the host system. The cause of the memory exhaustion is down to improper handling of http methods. Users are advised to upgrade. Users unable to upgrade may to restrict the path prefix to the "GET" method as a workaround.
GitHub Advisory Database
http-swagger before 1.2.6 allows XSS via PUT requests, because a file that has been uploaded (via httpSwagger.WrapHandler and *webdav.memFile) can subsequently be accessed via a GET request. NOTE: this is independently fixable with respect to CVE-2022-24863, because (if a solution continued to allow PUT requests) large files could have been blocked without blocking JavaScript, or JavaScript could have been blocked without blocking large files.
GitHub Advisory Database
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
Go Vulnerability Database
The httpSwagger package's HTTP handler provides WebDAV read/write access to an in-memory filesystem. An attacker can exploit this to cause memory exhaustion by uploading many files, XSS attacks by uploading malicious files, or other unexpected behaviors.
NVD (es)
http-swagger es un wrapper de código abierto para generar automáticamente la documentación de la API RESTful con Swagger versión 2.0. En versiones de http-swagger anteriores a 1.2.6 un atacante puede llevar a cabo un ataque de denegación de servicio consistente en el agotamiento de la memoria del sistema anfitrión. La causa del agotamiento de la memoria es debido al manejo inapropiado de los métodos http. Es recomendado a usuarios actualizar. Los usuarios que no puedan actualizar pueden restringir el prefijo de la ruta al método "GET" como medida de mitigación
References
| https://github.com/swaggo/http-swagger/security/advisories/GHSA-xg75-q3q5-cqmv | third-party-advisory, web | |
| https://github.com/swaggo/http-swagger/pull/62 | fix, third-party-advisory, web | |
| https://github.com/swaggo/http-swagger/commit/b7d83e8fba85a7a51aa7e45e8244b4173f15049e | patch, third-party-advisory, web | |
| https://github.com/swaggo/http-swagger/releases/tag/v1.2.6 | release-notes, third-party-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2024-25712 | advisory | |
| https://cosmosofcyberspace.github.io/improper_http_method_leads_to_xss/poc.html | web | |
| https://github.com/swaggo/http-swagger | package | |
| https://nvd.nist.gov/vuln/detail/CVE-2022-24863 | advisory | |
| https://github.com/swaggo/http-swagger/issues/61 | report | |
Related
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2022-24863 changed 2025-04-23 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-49w7-5r33-jm9m changed 2025-01-16 | CC-BY-4.0 |
| GitHub Advisory Database | GHSA-xg75-q3q5-cqmv changed 2024-03-04 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2022-0427 changed 2024-05-20 | CC-BY-4.0 |
| NVD | CVE-2022-24863 changed 2026-06-17 | Public domain |