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 package | Versions | Reported by |
|---|---|---|
| Unspecified product | n/a | 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
| CISA-ADP | 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 | 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 | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
Classification
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:
- 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 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
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-25712 changed 2025-06-16 | 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-2024-25712 changed 2026-06-17 | Public domain |