CVE-2022-24863
JSON

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 packageVersionsReported by
swaggo http-swagger< 1.2.6CVE List
github.com/swaggo/http-swagger (Go)before 1.2.6GitHub Advisory Database, Go Vulnerability Database
http-swagger_project http-swaggerbefore 1.2.6NVD

All scores

GitHub_M7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
GitHub6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
GitHub7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NVD7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NVD7.8high CVSS:2.0AV:N/AC:L/Au:N/C:N/I:N/A:C

Classification

CWE-79CWE-400CWE-755

SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.

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:

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

Related

Sources

SourceRecordLicence
CVE ListCVE-2022-24863 changed 2025-04-23CVE Terms of Use
GitHub Advisory DatabaseGHSA-49w7-5r33-jm9m changed 2025-01-16CC-BY-4.0
GitHub Advisory DatabaseGHSA-xg75-q3q5-cqmv changed 2024-03-04CC-BY-4.0
Go Vulnerability DatabaseGO-2022-0427 changed 2024-05-20CC-BY-4.0
NVDCVE-2022-24863 changed 2026-06-17Public domain