CVE-2024-25712
JSON

6.1medium

http-swagger XSS via PUT requests

Severity
6.1medium CVSS:3.1 by CISA-ADP
Exploit likelihood
0.56% (higher than 48% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
mitre
Also known as
GHSA-49w7-5r33-jm9mGHSA-xg75-q3q5-cqmvGO-2022-0427

Description

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.

Affected

Product or packageVersionsReported by
Unspecified productn/aCVE 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

CISA-ADP6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
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
NVD6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Classification

CWE-79CWE-400CWE-755

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

What each source says

CVE List

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 anterior a 1.2.6 permite XSS a través de solicitudes PUT, porque posteriormente se puede acceder a un archivo que se ha subido (a través de httpSwagger.WrapHandler y *webdav.memFile) a través de una solicitud GET. NOTA: esto se puede solucionar de forma independiente con respecto a CVE-2022-24863, porque (si una solución continuara permitiendo solicitudes PUT) los archivos grandes podrían haberse bloqueado sin bloquear JavaScript, o JavaScript podría haberse bloqueado sin bloquear archivos grandes.

References

Related

Sources

SourceRecordLicence
CVE ListCVE-2024-25712 changed 2025-06-16CVE 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-2024-25712 changed 2026-06-17Public domain