# Undici ProxyAgent vulnerable to MITM 

Undici's ProxyAgent never validated the remote server's TLS certificate, letting any network-path attacker or the proxy itself MITM all HTTPS traffic sent through it.

- Payout: $1,000
- Severity: high
- Program: Internet Bug Bounty
- Found by: pimterry
- Disclosed: 2022-07-13
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/1599063
- Library page: https://bugbountylibrary.com/r/h1%3A1599063
- Tags: area:oss domain:oss impact:data-leak impact:integrity kind:bounty platform:hackerone sev:high tech:nodejs technique:source-review vuln:misconfiguration

**Target:** Undici ProxyAgent / Node.js global fetch HTTP proxy dispatcher
**Root cause:** ProxyAgent did not verify the remote server's certificate and forwarded request/response data to the proxy, so HTTPS via an HTTP proxy was effectively plaintext and HTTPS via an HTTPS proxy was fully visible to the proxy.
**Steps:**
1. Configure Undici or Node global fetch to use `ProxyAgent` as dispatcher for an HTTPS target through an HTTP proxy.
2. Observe that the TLS connection to the origin is not certificate-validated and traffic between client and proxy is plaintext HTTP.
3. Position on the network path (or be the proxy) and intercept/modify the nominally HTTPS request and response.
**Exploitation:** Any party on the network path between client and proxy (or the proxy itself) can read and modify all HTTPS traffic because the client-to-proxy leg is plaintext and the origin certificate is never verified.
**Insight:** When auditing proxy dispatchers, check whether the origin TLS handshake is actually performed and validated end-to-end versus terminated at the proxy; a proxy that 'just forwards' HTTPS may silently downgrade to plaintext.

