# CVE-2022-27775: Bad local IPv6 connection reuse

curl's connection-reuse matching ignored IPv6 zone index, so a connection to a scoped address was reused for a different zone, leaking data across interfaces.

- Payout: $480
- Severity: low
- Program: Internet Bug Bounty
- Found by: nyymi
- Disclosed: 2022-04-29
- CVE: CVE-2022-27775
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/1551588
- Library page: https://bugbountylibrary.com/r/h1%3A1551588
- Tags: area:oss domain:oss impact:data-leak kind:bounty platform:hackerone sev:low tech:curl technique:source-review vuln:info-disclosure

**Target:** curl/libcurl connection pool reuse logic
**Root cause:** The connection config matching function did not compare the IPv6 address zone id, so a pooled connection to one zone matched a request for another (or no) zone.
**Steps:**
1. Start fake server: `echo -ne 'HTTP/1.1 200 OK\r\nContent-Length: 6\r\n\r\nHello\n' | nc -6 -v -l -p 9999`
2. Run `curl "http://[ipv6addr]:9999/x" "http://[ipv6addr%25lo]:9999/y"`
3. Observe both GET /x and GET /y arrive on the same connection to the first address, though the %lo request should fail
**How found:** Noticed that a lone request to `http://[ipv6addr%25lo]:9999/` fails to connect, yet when preceded by a request to the same address without zone id, the second request succeeds on the reused connection — revealing zone id was excluded from reuse matching.
**Exploitation:** Precondition: attacker-influenced or multi-tenant app issuing curl requests to numeric scoped IPv6 addresses. The wrong pooled connection is reused, so a response intended for one interface/zone is delivered to a request for another, potentially disclosing confidential data. Not exploitable with public IPv6 on Linux (kernel strips zone index); exploitable on macOS and possibly other non-Linux OSes.
**Insight:** When auditing connection-pool reuse, enumerate every field of the address/config tuple (zone id, scope, interface) and test pairs that differ only in one field; a lone request failing while a paired request succeeds is the tell.

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

**Fake server and curl commands reproducing zone-id reuse**

```
echo -ne 'HTTP/1.1 200 OK\r\nContent-Length: 6\r\n\r\nHello\n' | nc -6 -v -l -p 9999`
  2. curl "http://[ipv6addr]:9999/x" "http://[ipv6addr%25lo]:9999/y"
```

