CVE-2021-32643
JSON

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 packageVersionsReported 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-M23CVE 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-M23GitHub Advisory Database
typelevel http4sfrom 0.21.7 before 0.21.24, 0.22.0, 0.23.0, 1.0.0NVD

All scores

GitHub_M5.8medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N
GitHub5.8medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N
NVD5.8medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N
NVD5.0medium CVSS:2.0AV: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:

NVD (es)

Http4s es una interfaz de Scala para servicios HTTP.&#xa0;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.&#xa0;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.&#xa0;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.&#xa0;No son expuestas los contenidos y otros metadatos sobre el directorio.&#xa0;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.&#xa0;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.&#xa0;Como solución alternativa, los usuarios pueden evitar llamar a "StaticFile.fromUrl" con URL que no sean archivos

References

Sources

SourceRecordLicence
CVE ListCVE-2021-32643 changed 2024-08-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-6h7w-fc84-x7p6 changed 2026-07-08CC-BY-4.0
NVDCVE-2021-32643 changed 2026-06-17Public domain