Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS1yOW1xLTNjOXItZm1qcc4ABARd

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

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

Permalink: https://github.com/advisories/GHSA-r9mq-3c9r-fmjq
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1yOW1xLTNjOXItZm1qcc4ABARd
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Critical
Classification: General
Published: about 6 hours ago
Updated: about 5 hours ago


CVSS Score: 9.1
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H

Identifiers: GHSA-r9mq-3c9r-fmjq, CVE-2024-48914
References: Repository: https://github.com/vendure-ecommerce/vendure
Blast Radius: 16.4

Affected Packages

npm:@vendure/asset-server-plugin
Dependent packages: 74
Dependent repositories: 64
Downloads: 13,127 last month
Affected Version Ranges: >= 3.0.0, < 3.0.5, < 2.3.3
Fixed in: 3.0.5, 2.3.3
All affected versions: 0.1.0, 0.2.0, 0.2.1, 0.3.0, 0.3.1, 0.3.3, 0.3.4, 0.4.0, 0.5.0, 0.5.1, 0.6.0, 0.6.1, 0.6.2, 0.6.4, 0.6.5, 0.7.0, 0.8.0, 0.8.1, 0.8.2, 0.9.0, 0.10.0, 0.10.1, 0.10.2, 0.11.0, 0.11.1, 0.12.0, 0.12.1, 0.12.3, 0.12.5, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.16.2, 0.16.3, 0.17.0, 0.17.1, 0.17.2, 0.17.3, 0.18.0, 0.18.1, 0.18.2, 0.18.3, 0.18.4, 0.18.5, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.6.5, 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.8.0, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.8.5, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.9.4, 1.9.5, 1.9.6, 1.9.7, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4,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