CVE-2024-39338: Axios Server-Side Request Forgery Vulnerability

HIGH
Advisory Identifier: GHSA-8hc4-vh64-cxmj
CWE-918
Published
Advisory Summary

CVE-2024-39338 is a HIGH server-side request forgery vulnerability (CWE-918: Server-Side Request Forgery (SSRF)) affecting Axios libraries in the npm ecosystem. The issue involves server-side request forgery in axios. Remediation is available by upgrading affected packages to version 1.7.4.

CVE-2024-39338 at a Glance

CVE Identifier CVE-2024-39338
GHSA Identifier GHSA-8hc4-vh64-cxmj
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-918: Server-Side Request Forgery (SSRF)
Affected Product Axios
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2024-39338

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

axios fixed: 1.7.4
npm install axios@1.7.4
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 axios

How to Check if You Are Affected

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

npm ls axios

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

Note: The npm ls axios 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-918: Server-Side Request Forgery (SSRF), where the web server receives a url or similar request from an upstream component and retrieves the contents of this url, but it does not sufficiently ensure that the request is being sent to the expected destination. In Axios, 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

axios 1.7.2 allows SSRF via unexpected behavior where requests for path relative URLs get processed as protocol relative URLs.

CVE-2024-39338 Affected Axios Versions

1 component(s)
Fixed Versions:
1.7.4
Product / Package Ecosystem Affected Versions Fixed Version
axios
npm
≥ 1.3.2
< 1.7.4
1.7.4

References

Frequently Asked Questions

What is CVE-2024-39338?
CVE-2024-39338 is a security vulnerability in Axios involving Server-Side Request Forgery in axios under CWE-918: Server-Side Request Forgery (SSRF).
Which Axios versions are affected?
Affected versions include releases prior to 1.7.4 across affected packages: axios.
What version fixes CVE-2024-39338?
Upgrading to 1.7.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is axios affected?
Yes, axios is affected in releases prior to 1.7.4. Upgrade your dependency to 1.7.4 or later.
What CWE is associated with CVE-2024-39338?
CVE-2024-39338 is classified under CWE-918: Server-Side Request Forgery (SSRF) (The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.).
How can I check npm dependencies for CVE-2024-39338?
Run the dependency tree command: 'npm ls axios'. 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-8hc4-vh64-cxmj",
  "modified" : "2024-08-13T19:53:23Z",
  "published" : "2024-08-12T15:30:49Z",
  "aliases" : [ "CVE-2024-39338" ],
  "summary" : "Server-Side Request Forgery in axios",
  "details" : "axios 1.7.2 allows SSRF via unexpected behavior where requests for path relative URLs get processed as protocol relative URLs.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "axios"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.3.2"
      }, {
        "fixed" : "1.7.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.7.3"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-39338"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/axios/axios/issues/6463"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/axios/axios/pull/6539"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/axios/axios/pull/6543"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/axios/axios/commit/6b6b605eaf73852fb2dae033f1e786155959de3a"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/axios/axios"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/axios/axios/releases"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/axios/axios/releases/tag/v1.7.4"
  }, {
    "type" : "WEB",
    "url" : "https://jeffhacks.com/advisories/2024/06/24/CVE-2024-39338.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-918" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-08-12T17:26:43Z",
    "nvd_published_at" : "2024-08-12T13:38:24Z"
  }
}