CVE-2024-10491: Express Remote Code Execution Vulnerability

MODERATE
Advisory Identifier: GHSA-cm5g-3pgc-8rg4
CVSS 4.0
CWE-74
Published
Advisory Summary

CVE-2024-10491 is a MODERATE (CVSS 4.0) remote code execution vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting Express libraries in the npm ecosystem. The issue involves express ressource injection. Remediation is available by upgrading affected packages to version 4.0.0-rc1.

CVE-2024-10491 at a Glance

CVE Identifier CVE-2024-10491
GHSA Identifier GHSA-cm5g-3pgc-8rg4
Severity MODERATE
CVSS v3.1 Base Score 4.0
CWE Classification CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
Affected Product Express
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 4.0

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

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

How to Fix CVE-2024-10491

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

express fixed: 4.0.0-rc1
npm install express@4.0.0-rc1
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 express

How to Check if You Are Affected

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

npm ls express

Analyze the terminal output to locate any version of Express in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.0.0-rc1), your application is affected.

Note: The npm ls express 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-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. In Express, 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

A vulnerability has been identified in the Express response.links function, allowing for arbitrary resource injection in the Link header when unsanitized data is used. The issue arises from improper sanitization in `Link` header values, which can allow a combination of characters like `,`, `;`, and `<>` to preload malicious resources. This vulnerability is especially relevant for dynamic parameters.

CVE-2024-10491 Affected Express Versions

1 component(s)
Fixed Versions:
4.0.0-rc1
Product / Package Ecosystem Affected Versions Fixed Version
express
npm
< 4.0.0-rc1
4.0.0-rc1

References

Frequently Asked Questions

What is CVE-2024-10491?
CVE-2024-10491 is a security vulnerability in Express involving Express ressource injection under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection').
Which Express versions are affected?
Affected versions include releases prior to 4.0.0-rc1 across affected packages: express.
What version fixes CVE-2024-10491?
Upgrading to 4.0.0-rc1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is express affected?
Yes, express is affected in releases prior to 4.0.0-rc1. Upgrade your dependency to 4.0.0-rc1 or later.
What is the CVSS score of CVE-2024-10491?
CVE-2024-10491 has a CVSS v3.1 base score of 4.0 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:N/A:N.
What CWE is associated with CVE-2024-10491?
CVE-2024-10491 is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') (The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.).
How can I check npm dependencies for CVE-2024-10491?
Run the dependency tree command: 'npm ls express'. 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-cm5g-3pgc-8rg4",
  "modified" : "2024-12-19T17:52:09Z",
  "published" : "2024-10-29T18:30:37Z",
  "aliases" : [ "CVE-2024-10491" ],
  "summary" : "Express ressource injection",
  "details" : "A vulnerability has been identified in the Express response.links function, allowing for arbitrary resource injection in the Link header when unsanitized data is used.\n\nThe issue arises from improper sanitization in `Link` header values, which can allow a combination of characters like `,`, `;`, and `<>` to preload malicious resources.\n\nThis vulnerability is especially relevant for dynamic parameters.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "express"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.0.0-rc1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 3.21.4"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-10491"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/expressjs/express/issues/6222"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/expressjs/express"
  }, {
    "type" : "WEB",
    "url" : "https://www.herodevs.com/vulnerability-directory/cve-2024-10491"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-74" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-11-25T21:31:20Z",
    "nvd_published_at" : "2024-10-29T17:15:03Z"
  }
}