CVE-2026-84381 Overview
HTTPX2, a next-generation HTTP client for Python, fails to initiate TLS when connecting to wss:// WebSocket endpoints through a SOCKS5 proxy. The flaw lives in httpcore2 and is exposed by HTTPX2 through Client.websocket() and AsyncClient.websocket(). The TLS upgrade path only checks for the https scheme, so wss traffic traverses the proxy unencrypted and without certificate verification. This is a cleartext transmission of sensitive information issue [CWE-319]. The vulnerability affects HTTPX2 versions 2.6.0 through 2.9.1 and is fixed in httpcore2 2.10.0 and HTTPX2 2.10.0.
Critical Impact
An attacker positioned on the SOCKS5 proxy path can read or modify WebSocket handshake data, Authorization headers, cookies, and application frames, and can impersonate the WebSocket server.
Affected Products
- HTTPX2 versions 2.6.0 through 2.9.1
- httpcore2 prior to 2.10.0
- Python applications using Client.websocket() or AsyncClient.websocket() over SOCKS5 with wss:// origins
Discovery Timeline
- 2026-09-02 - CVE CVE-2026-84381 published to NVD
- 2026-09-02 - Last updated in NVD database
Technical Details for CVE-2026-84381
Vulnerability Analysis
The defect resides in the SOCKS5 proxy connection logic of httpcore2, specifically in src/httpcore2/httpcore2/_sync/socks_proxy.py and src/httpcore2/httpcore2/_async/socks_proxy.py. After the SOCKS5 tunnel is established, the code decides whether to wrap the stream in TLS by comparing self._remote_origin.scheme against the byte string b"https" only.
When HTTPX2's WebSocket client requests a wss:// origin through a SOCKS5 proxy, the scheme is b"wss", so the TLS upgrade branch is skipped. The resulting stream carries the WebSocket opening handshake, query parameters, Authorization headers, cookies, and all subsequent frames in plaintext with no certificate verification.
Root Cause
The TLS activation condition uses an exact-match check on a single scheme rather than a set of secure schemes. WebSocket Secure (wss) is functionally equivalent to https for TLS purposes, but the conditional does not recognize it, producing an inconsistent security posture between HTTPS and WSS calls over SOCKS5.
Attack Vector
An attacker who controls or observes the SOCKS5 proxy path — a malicious proxy operator, a compromised proxy host, or an adversary on an adjacent network segment carrying proxy traffic — can passively read session cookies and bearer tokens, actively modify frames, or terminate the connection and impersonate the WebSocket server. No user interaction or authentication is required.
trace.return_value = stream
# Upgrade the stream to SSL
- if self._remote_origin.scheme == b"https":
+ if self._remote_origin.scheme in (b"https", b"wss"):
ssl_context = default_ssl_context() if self._ssl_context is None else self._ssl_context
alpn_protocols = ["http/1.1", "h2"] if self._http2 else ["http/1.1"]
ssl_context.set_alpn_protocols(alpn_protocols)
Source: GitHub Commit fb008dd. The patch expands the scheme check to include b"wss", ensuring TLS is initiated for WebSocket Secure origins traversing a SOCKS5 proxy.
Detection Methods for CVE-2026-84381
Indicators of Compromise
- Outbound WebSocket handshakes (GET requests with Upgrade: websocket) observed in plaintext on flows destined for a SOCKS5 proxy where the origin URL uses wss://.
- Sec-WebSocket-Key, Authorization, or Cookie headers visible in cleartext packet captures for traffic that should be TLS-protected.
- Python processes with installed HTTPX2 versions between 2.6.0 and 2.9.1 or httpcore2 below 2.10.0.
Detection Strategies
- Inventory Python dependencies with pip list or SBOM tooling and flag httpx2 versions 2.6.0–2.9.1 and any httpcore2 prior to 2.10.0.
- Inspect application source for calls to Client.websocket() or AsyncClient.websocket() combined with a SOCKS5 proxy configuration (socks5:// or socks5h://).
- Use network sensors to identify unencrypted WebSocket upgrades exiting through known SOCKS5 relays.
Monitoring Recommendations
- Log outbound proxy connections and correlate destination scheme against observed TLS ClientHello presence.
- Alert on WebSocket handshakes containing Authorization or session cookies transmitted without TLS negotiation.
- Track dependency updates for httpx2 and httpcore2 across CI/CD pipelines and container images.
How to Mitigate CVE-2026-84381
Immediate Actions Required
- Upgrade HTTPX2 to 2.10.0 or later and httpcore2 to 2.10.0 or later across all environments.
- Rotate credentials, session cookies, and bearer tokens that were transmitted over wss:// through SOCKS5 proxies while running affected versions.
- Audit application logs and proxy logs for suspicious WebSocket sessions initiated during the exposure window.
Patch Information
The fix is available in httpcore2 2.10.0 and HTTPX2 2.10.0. Details are published in the GitHub Security Advisory GHSA-7mj9-2mp8-4m2p, the fix commit fb008dd, the corresponding Pull Request #1104, and the v2.10.0 release notes.
Workarounds
- Avoid routing wss:// WebSocket connections through SOCKS5 proxies until affected components are upgraded.
- Terminate TLS end-to-end at the application layer by wrapping the stream manually or by using a direct network path.
- Restrict proxy usage to trusted hosts and networks and enforce mutual authentication on the WebSocket server side to detect impersonation attempts.
# Upgrade to patched versions
pip install --upgrade "httpx2>=2.10.0" "httpcore2>=2.10.0"
# Verify installed versions
pip show httpx2 httpcore2 | grep -E "Name|Version"
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.