Vulnerabilities in pkg:npm/@vendure/asset-server-plugin

PACKAGE
Advisory Identifier: GHSA-r9mq-3c9r-fmjq
Advisory Summary

CVE-2024-48914 is a CRITICAL (CVSS 9.1) vendure asset server plugin has vulnerability (CWE-20: Improper Input Validation) affecting @vendure/asset server plugin libraries in the npm ecosystem. The issue involves vendure asset server plugin has local file read vulnerability with assetserverplugin & localassetstoragestrategy. Remediation is available by upgrading affected packages to version 2.3.3, 3.0.5.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/@vendure/asset-server-plugin

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/@vendure/asset-server-plugin. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-r9mq-3c9r-fmjq CVE-2024-48914 CRITICAL Vendure asset server plugin has local file read vulnerability with AssetServerPlugin & LocalAssetStorageStrategy

CVE-2024-48914 at a Glance

CVE Identifier CVE-2024-48914
GHSA Identifier GHSA-r9mq-3c9r-fmjq
Severity CRITICAL
CVSS v3.1 Base Score 9.1
CWE Classification CWE-20: Improper Input Validation
Affected Product @vendure/asset server plugin
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 9.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2024-48914

To remediate this vulnerability, upgrade all affected @vendure/asset server plugin dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@vendure/asset-server-plugin fixed: 2.3.3
npm install @vendure/asset-server-plugin@2.3.3
@vendure/asset-server-plugin fixed: 3.0.5
npm install @vendure/asset-server-plugin@3.0.5
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @vendure/asset-server-plugin

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2024-48914, inspect your project dependencies using npm:

npm ls @vendure/asset-server-plugin

Analyze the terminal output to locate any version of @vendure/asset server plugin in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.3.3), your application is affected.

Note: The npm ls @vendure/asset-server-plugin command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In @vendure/asset server plugin, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

# 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 `/../`

CVE-2024-48914 Affected @vendure/asset server plugin Versions

2 component(s)
Fixed Versions:
2.3.33.0.5
Product / Package Ecosystem Affected Versions Fixed Version
@vendure/asset-server-plugin
npm
< 2.3.3
2.3.3
@vendure/asset-server-plugin
npm
≥ 3.0.0
< 3.0.5
3.0.5

References

Frequently Asked Questions

What is CVE-2024-48914?
CVE-2024-48914 is a security vulnerability in @vendure/asset server plugin involving Vendure asset server plugin has local file read vulnerability with AssetServerPlugin & LocalAssetStorageStrategy under CWE-20: Improper Input Validation.
Which @vendure/asset server plugin versions are affected?
Affected versions include releases prior to 2.3.3, 3.0.5 across affected packages: @vendure/asset-server-plugin.
What version fixes CVE-2024-48914?
Upgrading to 2.3.3, 3.0.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @vendure/asset-server-plugin affected?
Yes, @vendure/asset-server-plugin is affected in releases prior to 2.3.3, 3.0.5. Upgrade your dependency to 2.3.3, 3.0.5 or later.
What is the CVSS score of CVE-2024-48914?
CVE-2024-48914 has a CVSS v3.1 base score of 9.1 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H.
What CWE is associated with CVE-2024-48914?
CVE-2024-48914 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check npm dependencies for CVE-2024-48914?
Run the dependency tree command: 'npm ls @vendure/asset-server-plugin'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-r9mq-3c9r-fmjq",
  "modified" : "2024-10-15T19:56:24Z",
  "published" : "2024-10-15T18:00:02Z",
  "aliases" : [ "CVE-2024-48914" ],
  "summary" : "Vendure asset server plugin has local file read vulnerability with AssetServerPlugin & LocalAssetStorageStrategy",
  "details" : "# Description\n\n## Path traversal\n\nThis 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.\n\nFrom Rajesh Sharma who discovered the vulnerability:\n\nPOC: `curl --path-as-is http://localhost:3000/assets/../package.json` gives you the content of package.json present in the local directory.\n\nThe vulnerability stems from usage of decodedReqPath directly in path.join without performing any path normalization i.e path.normalize in node.js\n\nhttps://github.com/vendure-ecommerce/vendure/blob/801980e8f599c28c5059657a9d85dd03e3827992/packages/asset-server-plugin/src/plugin.ts#L352-L358\n\nIf 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. \n\nThe reporter found a customer website which uses local asset plugin and using above mentioned vulnerability, and was able to find secrets like email credentials.\n\n\n## DOS via malformed URI\n\nIn the same code path is an additional vector for crashing the server via a malformed URI\n\nAgain from Rajesh:\n\nThere 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.\nExploit: `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. \n\n```\n[:server] /Users/abc/mywork/vendure/packages/asset-server-plugin/src/plugin.ts:353\n[:server]         const decodedReqPath = decodeURIComponent(req.path);\n[:server]                                ^\n[:server] URIError: URI malformed\n```\n\n### Patches\nv3.0.5, v2.3.3\n\n### Workarounds\n- Use object storage rather than the local file system, e.g. MinIO or S3\n- Define middleware which detects and blocks requests with urls containing `/../`\n\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@vendure/asset-server-plugin"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.3.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@vendure/asset-server-plugin"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.0.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/vendure-ecommerce/vendure/security/advisories/GHSA-r9mq-3c9r-fmjq"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-48914"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vendure-ecommerce/vendure/commit/e2ee0c43159b3d13b51b78654481094fdd4850c5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vendure-ecommerce/vendure/commit/e4b58af6822d38a9c92a1d8573e19288b8edaa1c"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/vendure-ecommerce/vendure"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vendure-ecommerce/vendure/blob/801980e8f599c28c5059657a9d85dd03e3827992/packages/asset-server-plugin/src/plugin.ts#L352-L358"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-22" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-10-15T18:00:02Z",
    "nvd_published_at" : "2024-10-15T16:15:06Z"
  }
}