5.8medium
Stored Cross-site Scripting in directory listings via file names in static-web-server
- Severity
- 5.8medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.37% (higher than 32% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-rwfq-v4hq-h7fg
Description
Static Web Server (SWS) is a tiny and fast production-ready web server suitable to serve static web files or assets. In affected versions if directory listings are enabled for a directory that an untrusted user has upload privileges for, a malicious file name like `<img src=x onerror=alert(1)>.txt` will allow JavaScript code execution in the context of the web server’s domain. SWS generally does not perform escaping of HTML entities on any values inserted in the directory listing. At the very least `file_name` and `current_path` could contain malicious data however. `file_uri` could also be malicious but the relevant scenarios seem to be all caught by hyper. For any web server that allow users to upload files or create directories under a name of their choosing this becomes a stored Cross-site Scripting vulnerability. Users are advised to upgrade. There are no known workarounds for this vulnerability.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| static-web-server static-web-server | < 2.30.0, before 2.30.0 | CVE List |
| static-web-server (crates.io) | before 2.30.0 | GitHub Advisory Database |
All scores
| GitHub_M | 5.8medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:L |
| GitHub | 5.8medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:L |
Classification
What each source says
CVE List
Static Web Server (SWS) is a tiny and fast production-ready web server suitable to serve static web files or assets. In affected versions if directory listings are enabled for a directory that an untrusted user has upload privileges for, a malicious file name like `<img src=x onerror=alert(1)>.txt` will allow JavaScript code execution in the context of the web server’s domain. SWS generally does not perform escaping of HTML entities on any values inserted in the directory listing. At the very least `file_name` and `current_path` could contain malicious data however. `file_uri` could also be malicious but the relevant scenarios seem to be all caught by hyper. For any web server that allow users to upload files or create directories under a name of their choosing this becomes a stored Cross-site Scripting vulnerability. Users are advised to upgrade. There are no known workarounds for this vulnerability.
GitHub Advisory Database
Summary
If directory listings are enabled for a directory that an untrusted user has upload privileges for, a malicious file name like <img src=x onerror=alert(1)>.txt will allow JavaScript code execution in the context of the web server’s domain.
Details
SWS generally does not perform escaping of HTML entities on any values inserted in the directory listing. At the very least file_name and current_path could contain malicious data however. file_uri could also be malicious but the relevant scenarios seem to be all caught by hyper.
Impact
For any web server that allow users to upload files or create directories under a name of their choosing this becomes a stored XSS vulnerability.
NVD (es)
Static Web Server (SWS) es un pequeño y rápido servidor web listo para producción, adecuado para servir archivos o activos web estáticos. En las versiones afectadas, si los listados de directorios están habilitados para un directorio para el que un usuario que no es de confianza tiene privilegios de carga, un nombre de archivo malicioso como `.txt` permitirá la ejecución de código JavaScript en el contexto de el dominio del servidor web. SWS generalmente no realiza escapes de entidades HTML en ningún valor insertado en la lista del directorio. Sin embargo, al menos `file_name` y `current_path` podrían contener datos maliciosos. `file_uri` también podría ser malicioso, pero todos los escenarios relevantes parecen ser detectados por hyper. Para cualquier servidor web que permita a los usuarios cargar archivos o crear directorios con el nombre de su elección, esto se convierte en una vulnerabilidad de Cross Site Scripting almacenada. Se recomienda a los usuarios que actualicen. No se conocen workarounds para esta vulnerabilidad.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-32966 changed 2024-08-02 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-rwfq-v4hq-h7fg changed 2024-05-01 | CC-BY-4.0 |
| NVD | CVE-2024-32966 changed 2026-06-17 | Public domain |