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

Information Exposure due to the handling of the Proxy-Authorization header across hosts #6313

Open
Shirley0001 opened this issue Mar 21, 2024 · 1 comment

Comments

@Shirley0001
Copy link

Describe the issue

We encountered the following security issues:
Affected versions of this package are vulnerable to Information Exposure due to the handling of the Proxy-Authorization header across hosts. When using a dependent library, it only clears the authorization header during cross-domain redirects but allows the proxy-authentication header, which contains credentials, to persist. This behavior may lead to the unintended leakage of credentials if an attacker can trigger a cross-domain redirect and capture the persistent proxy-authentication header.
When will a new version be released to address this security issue?

Axios Version

@1.6.5

@justindhillon
Copy link

This is handled in lib/adapters/http.js.

My first approach was to just delete Proxy-Authorization whenever we redirect:

function dispatchBeforeRedirect(options, responseDetails) {
  if (options.beforeRedirects.proxy) {
    options.beforeRedirects.proxy(options);
  }
  if (options.beforeRedirects.config) {
    options.beforeRedirects.config(options, responseDetails);
  }
  // Clear Proxy-Authorization header during cross-domain redirects
  delete options.headers['Proxy-Authorization'];
}

My second approach is to remove Proxy-Authorization from header, but then turn it into a veriable returned by options. The same way it is implemented for authorization:

// HTTP basic authentication
let auth = undefined;
if (config.auth) {
  const username = config.auth.username || '';
  const password = config.auth.password || '';
  auth = username + ':' + password;
}

if (!auth && parsed.username) {
  const urlUsername = parsed.username;
  const urlPassword = parsed.password;
  auth = urlUsername + ':' + urlPassword;
}

auth && headers.delete('authorization');

Which way should I fix this security vulnerability?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants