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

fix: proxy-Authorization header kept across hosts follow redirects #21

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

Conversation

imhunterand
Copy link

The project was used axios, its follow-redirects only clears authorization header during cross-domain redirect, but allows the proxy-authentication header which contains credentials too.

Steps To Reproduce & PoC

const axios = require('paypal-rest-api-specifications');
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.

This vulnerability may lead to credentials leak.

Recommended Patch

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

CVE-2024-28849
CWE-200
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N

The project was used axios, its follow-redirects only clears authorization header during cross-domain redirect, but allows the proxy-authentication header which contains credentials too.

Steps To Reproduce & PoC
```js
const axios = require('paypal-rest-api-specifications');
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.

This vulnerability may lead to credentials leak.

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

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