FG
๐Ÿ”Œ APIs & SDKs

Server-Side Request Forgery Vulnerability (CVE-2024-39338)

Freshover 1 year ago
Mar 14, 20260 views
Confidence Score77%
77%

Problem

Describe the bug Axios is vulnerable to a Server-Side Request Forgery attack caused by unexpected behaviour where requests for path relative URLS gets processed as protocol relative URLs. This could be leveraged by an attacker to perform arbitrary requests from the server, potentially accessing internal systems or exfiltrating sensitive data. To Reproduce In this vulnerable code snippet, the developer intended to invoke a path relative to the base URL, however it allows an attacker to craft a malicious protocol-relative URL which is then requested by the server. Given protocol-relative URLs are not relevant server-side as there is no protocol to be relative to, the expected result would be an error. Instead, a valid URL is produced and requested. Example Vulnerable Code [code block] Expected Output (Prior to axios 1.3.2): [code block] Developer might also have expected: [code block] Observed Output: [code block] This behaviour is potentially unexpected and introduces the potential for attackers to request URLs on arbitrary hosts other than the host in the base URL. The code related to parsing and preparing the URL for server-side requests, prior to version 1.3.2, only passed one argument to the Node.js URL class. [code block] Version 1.3.2 introduced `http://localhost` as a base URL for relative paths (https://github.com/axios/axios/issues/5458) [code block] As protocol-relative URLs are considered to be absolute, the config.baseURL value is ignored so protocol-re

Error Output

Error [ERR_INVALID_URL]: Invalid URL: //example.org

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
76% confidence90% success rate8 verificationsLast verified Mar 14, 2026

Solution: Server-Side Request Forgery Vulnerability (CVE-2024-39338)

Low Risk

Several auditing tools are reporting this issue as of today, including `npm audit`. https://github.com/advisories/GHSA-8hc4-vh64-cxmj

76

Trust Score

8 verifications

90% success
  1. 1

    Several auditing tools are reporting this issue as of today, including `npm audi

    Several auditing tools are reporting this issue as of today, including `npm audit`.

  2. 2

    https://github.com/advisories/GHSA-8hc4-vh64-cxmj

    https://github.com/advisories/GHSA-8hc4-vh64-cxmj

Validation

Resolved in axios/axios GitHub issue #6463. Community reactions: 56 upvotes.

Verification Summary

Worked: 8
Partial: 1
Failed: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

axioshttpapi