5.8medium
StaticFile.fromUrl can leak presence of a directory
- Severity
- 5.8medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 1.40% (higher than 73% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-6h7w-fc84-x7p6
Description
Http4s is a Scala interface for HTTP services. `StaticFile.fromUrl` can leak the presence of a directory on a server when the `URL` scheme is not `file://`, and the URL points to a fetchable resource under its scheme and authority. The function returns `F[None]`, indicating no resource, if `url.getFile` is a directory, without first checking the scheme or authority of the URL. If a URL connection to the scheme and URL would return a stream, and the path in the URL exists as a directory on the server, the presence of the directory on the server could be inferred from the 404 response. The contents and other metadata about the directory are not exposed. This affects http4s versions: 0.21.7 through 0.21.23, 0.22.0-M1 through 0.22.0-M8, 0.23.0-M1, and 1.0.0-M1 through 1.0.0-M22. The [patch](https://github.com/http4s/http4s/commit/52e1890665410b4385e37b96bc49c5e3c708e4e9) is available in the following versions: v0.21.24, v0.22.0-M9, v0.23.0-M2, v1.0.0-M23. As a workaround users can avoid calling `StaticFile.fromUrl` with non-file URLs.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| http4s http4s | >= 0.21.7, < 0.21.24, >= 0.22.0-M1, <= 0.22.0-M8, = 0.23.0-M1, >= 1.0.0-M1, < 1.0.0-M23 | CVE List |
| org.http4s:http4s-core (Maven) | from 0.21.7 before 0.21.24, from 0.22.0-M1 before 0.22.0-RC1, from 0.23.0-M1 before 0.23.0-RC1, from 1.0.0-M1 before 1.0.0-M23 | GitHub Advisory Database |
| typelevel http4s | from 0.21.7 before 0.21.24, 0.22.0, 0.23.0, 1.0.0 | NVD |
All scores
| GitHub_M | 5.8medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N |
| GitHub | 5.8medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N |
| NVD | 5.8medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N |
| NVD | 5.0medium CVSS:2.0 | AV:N/AC:L/Au:N/C:P/I:N/A:N |
Classification
What each source says
CVE List
Http4s is a Scala interface for HTTP services. `StaticFile.fromUrl` can leak the presence of a directory on a server when the `URL` scheme is not `file://`, and the URL points to a fetchable resource under its scheme and authority. The function returns `F[None]`, indicating no resource, if `url.getFile` is a directory, without first checking the scheme or authority of the URL. If a URL connection to the scheme and URL would return a stream, and the path in the URL exists as a directory on the server, the presence of the directory on the server could be inferred from the 404 response. The contents and other metadata about the directory are not exposed. This affects http4s versions: 0.21.7 through 0.21.23, 0.22.0-M1 through 0.22.0-M8, 0.23.0-M1, and 1.0.0-M1 through 1.0.0-M22. The [patch](https://github.com/http4s/http4s/commit/52e1890665410b4385e37b96bc49c5e3c708e4e9) is available in the following versions: v0.21.24, v0.22.0-M9, v0.23.0-M2, v1.0.0-M23. As a workaround users can avoid calling `StaticFile.fromUrl` with non-file URLs.
GitHub Advisory Database
Impact
StaticFile.fromUrl can leak the presence of a directory on a server when the URL scheme is not file://, and the URL points to a fetchable resource under its scheme and authority. The function returns F[None], indicating no resource, if url.getFile is a directory, without first checking the scheme or authority of the URL. If a URL connection to the scheme and URL would return a stream, and the path in the URL exists as a directory on the server, the presence of the directory on the server could be inferred from the 404 response. The contents and other metadata about the directory are not exposed.
This affects http4s versions:
- 0.21.7 through 0.21.23
- 0.22.0-M1 through 0.22.0-M8
- 0.23.0-M1
- 1.0.0-M1 through 1.0.0-M22
Patches
The patch is available in the following versions:
- v0.21.24
- v0.22.0-RC1
- v0.23.0-RC1
- v1.0.0-M23
Note: a previous version of this advisory incorrectly referred to 0.22.0-M9 and 0.23.0-M2.
Workarounds
Don't call StaticFile.fromUrl with non-file URLs.
For more information
If you have any questions or comments about this advisory:
- Open an issue in the http4s repository
- Disclose further vulnerabilities according to the http4s security policy
NVD (es)
Http4s es una interfaz de Scala para servicios HTTP. el directorio "StaticFile.fromUrl" puede filtrar la presencia de un directorio en un servidor cuando el esquema "URL" no es "file://", y la URL apunta a un recurso recuperable bajo su esquema y autoridad. La función devuelve "F[None]", indicando que no hay recurso, si "url.getFile" es un directorio, sin comprobar primero el esquema o la autoridad de la URL. Si una conexión URL al esquema y la URL devolvieran una secuencia, y la ruta en la URL se presenta como un directorio en el servidor, la presencia del directorio en el servidor podría inferirse de la respuesta 404. No son expuestas los contenidos y otros metadatos sobre el directorio. Esto afecta a versiones de http4s: versiones 0.21.7 hasta 0.21.23, 0.22.0-M1 hasta 0.22.0-M8, 0.23.0-M1 y versiones 1.0.0-M1 hasta 1.0.0-M22. El [parche] (https://github.com/http4s/http4s/commit/52e1890665410b4385e37b96bc49c5e3c708e4e9) está disponible en las siguientes versiones: v0.21.24, v0.22.0-M9, v0.23.0-M2, v1.0.0-M23. Como solución alternativa, los usuarios pueden evitar llamar a "StaticFile.fromUrl" con URL que no sean archivos
References
| https://github.com/http4s/http4s/security/advisories/GHSA-6h7w-fc84-x7p6 | patch, third-party-advisory, web | |
| https://github.com/http4s/http4s/commit/52e1890665410b4385e37b96bc49c5e3c708e4e9 | patch, third-party-advisory, web | |
| https://mvnrepository.com/artifact/org.http4s/http4s-core | third-party-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2021-32643 | advisory | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-32643 changed 2024-08-03 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-6h7w-fc84-x7p6 changed 2026-07-08 | CC-BY-4.0 |
| NVD | CVE-2021-32643 changed 2026-06-17 | Public domain |