CVE-2024-48914
JSON

9.1critical

Vendure asset server plugin has local file read vulnerability with AssetServerPlugin & LocalAssetStorageStrategy

Severity
9.1critical CVSS:3.1 by GitHub_M
Exploit likelihood
60.4% (higher than 99% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-r9mq-3c9r-fmjq

Description

Vendure is an open-source headless commerce platform. Prior to versions 3.0.5 and 2.3.3, a vulnerability in Vendure's asset server plugin allows an attacker to craft a request which is able to traverse the server file system and retrieve the contents of arbitrary files, including sensitive data such as configuration files, environment variables, and other critical data stored on the server. In the same code path is an additional vector for crashing the server via a malformed URI. Patches are available in versions 3.0.5 and 2.3.3. Some workarounds are also available. One may use object storage rather than the local file system, e.g. MinIO or S3, or define middleware which detects and blocks requests with urls containing `/../`.

Affected

Product or packageVersionsReported by
vendure-ecommerce vendure< 2.3.3, >= 3.0.0, < 3.0.5CVE List
vendure vendurebefore 2.3.3, up to 3.0.0, before 3.0.5CVE List
@vendure/asset-server-plugin (npm)before 2.3.3, from 3.0.0 before 3.0.5GitHub Advisory Database

All scores

GitHub_M9.1critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H
GitHub9.1critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H

Classification

CWE-20CWE-22

SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact total.

What each source says

CVE List

Vendure is an open-source headless commerce platform. Prior to versions 3.0.5 and 2.3.3, a vulnerability in Vendure's asset server plugin allows an attacker to craft a request which is able to traverse the server file system and retrieve the contents of arbitrary files, including sensitive data such as configuration files, environment variables, and other critical data stored on the server. In the same code path is an additional vector for crashing the server via a malformed URI. Patches are available in versions 3.0.5 and 2.3.3. Some workarounds are also available. One may use object storage rather than the local file system, e.g. MinIO or S3, or define middleware which detects and blocks requests with urls containing `/../`.

GitHub Advisory Database

Description

Path traversal

This vulnerability allows an attacker to craft a request which is able to traverse the server file system and retrieve the contents of arbitrary files, including sensitive data such as configuration files, environment variables, and other critical data stored on the server.

From Rajesh Sharma who discovered the vulnerability:

POC: curl --path-as-is http://localhost:3000/assets/../package.json gives you the content of package.json present in the local directory.

The vulnerability stems from usage of decodedReqPath directly in path.join without performing any path normalization i.e path.normalize in node.js

https://github.com/vendure-ecommerce/vendure/blob/801980e8f599c28c5059657a9d85dd03e3827992/packages/asset-server-plugin/src/plugin.ts#L352-L358

If the vendure service is behind some server like nginx, apache, etc. Path normalization is performed on the root server level but still the actual client's request path will be sent to vendure service but not the resultant normalized path. However, depending the type of root server one can try various payloads to bypass such normalization.

The reporter found a customer website which uses local asset plugin and using above mentioned vulnerability, and was able to find secrets like email credentials.

DOS via malformed URI

In the same code path is an additional vector for crashing the server via a malformed URI

Again from Rajesh:

There is also a potential Denial of Service (DoS) issue when incorrectly encoded URI characters are passed as part of the asset URL. When these malformed requests are processed, they can lead to system crashes or resource exhaustion, rendering the service unavailable to users. Exploit: curl --path-as-is http://localhost:3000/assets/%80package.json , here %80 is not a valid url-encoded character hence the decodeURIComponent is called on it, the entire app crashes.

[:server] /Users/abc/mywork/vendure/packages/asset-server-plugin/src/plugin.ts:353
[:server]         const decodedReqPath = decodeURIComponent(req.path);
[:server]                                ^
[:server] URIError: URI malformed
Patches

v3.0.5, v2.3.3

Workarounds
  • Use object storage rather than the local file system, e.g. MinIO or S3
  • Define middleware which detects and blocks requests with urls containing /../
NVD (es)

Vendure es una plataforma de comercio sin interfaz gráfica de código abierto. Antes de las versiones 3.0.5 y 2.3.3, una vulnerabilidad en el complemento de servidor de activos de Vendure permitía a un atacante crear una solicitud que pudiera atravesar el sistema de archivos del servidor y recuperar el contenido de archivos arbitrarios, incluidos datos confidenciales como archivos de configuración, variables de entorno y otros datos críticos almacenados en el servidor. En la misma ruta de código hay un vector adicional para hacer que el servidor se bloquee mediante una URL mal formada. Hay parches disponibles en las versiones 3.0.5 y 2.3.3. También hay algunos workarounds disponibles. Se puede utilizar el almacenamiento de objetos en lugar del sistema de archivos local, por ejemplo, MinIO o S3, o definir un middleware que detecte y bloquee las solicitudes con URL que contengan `/../`.

References

Sources

SourceRecordLicence
CVE ListCVE-2024-48914 changed 2024-10-15CVE Terms of Use
GitHub Advisory DatabaseGHSA-r9mq-3c9r-fmjq changed 2024-10-15CC-BY-4.0
NVDCVE-2024-48914 changed 2026-06-17Public domain