Skip to content

GHSA-7mj9-2mp8-4m2p CVE-2026-84381 PYSEC-2026-3844 PYSEC-2026-3845

HTTPX2: Secure WebSocket traffic sent without TLS through SOCKS proxies

High PyPI
Severity
8.1 / 10
High · CVSS 3.1
Exploit chance (EPSS)
0.08%
Chance of exploitation in the next 30 days. Higher than 0.13% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-319 Cleartext Transmission of Sensitive Information
Fix
Available
2 packages have a fixed version

Description

Summary

httpcore2 does not start TLS for wss:// connections routed through a SOCKS5 proxy. The WebSocket opening handshake and all subsequent frames are sent in plaintext through the proxy path, despite the caller selecting the secure wss scheme.

The transport flaw affects httpcore2 releases before 2.10.0. HTTPX2 exposed this behavior through its public Client.websocket() and AsyncClient.websocket() APIs from 2.6.0 through 2.9.1.

Details

The synchronous and asynchronous SOCKS5 connection implementations upgrade the established proxy tunnel to TLS only when the remote origin scheme is https. The equivalent check does not include wss. After the SOCKS5 handshake succeeds, the raw stream is therefore passed directly to the HTTP/1.1 connection, which writes the WebSocket upgrade request without first performing a TLS handshake or verifying the destination certificate.

For example, an application using HTTPX2 2.6.0 through 2.9.1 may open an authenticated WebSocket through a SOCKS proxy:

import httpx2

with httpx2.Client(proxy="socks5://proxy.example:1080") as client:
    with client.websocket(
        "wss://service.example/private?token=query-secret",
        headers={"Authorization": "Bearer header-secret"},
        cookies={"session": "cookie-secret"},
    ) as websocket:
        websocket.send_text("private message")

On affected versions, the stream passing through the SOCKS proxy begins with a plaintext request such as:

GET /private?token=query-secret HTTP/1.1
Host: service.example
Authorization: Bearer header-secret
Cookie: session=cookie-secret

Before HTTPX2 2.6.0, the same underlying httpcore2 behavior could be reached by integrations constructing a WebSocket upgrade request through the low-level transport API, but HTTPX2 did not yet provide its native WebSocket client API.

A normal secure WebSocket server will usually reject these plaintext bytes because it expects a TLS ClientHello. However, a malicious or compromised SOCKS proxy can accept the SOCKS connection, observe the plaintext handshake, return a forged 101 Switching Protocols response, and then read or modify WebSocket frames in both directions. An observer between the proxy and destination may also read the plaintext traffic.

RFC 6455 requires a client using a secure WebSocket connection to perform the TLS handshake before sending the WebSocket opening handshake. A wss URI promises confidentiality, integrity, and endpoint authentication through TLS.

Impact

An attacker able to control or observe the SOCKS proxy path can obtain URL query parameters, authorization headers, cookies, and application messages that the caller expected TLS to protect. Because no TLS handshake occurs, certificate verification also does not occur, allowing an attacker controlling the proxy to impersonate the WebSocket server and inject or alter messages.

Only wss:// connections routed through a SOCKS5 proxy are affected. Direct wss:// connections and ordinary https:// requests through SOCKS already start TLS correctly.

Mitigation

Upgrade HTTPX2 and httpcore2 to 2.10.0 or later. Patched versions start TLS for both https and wss origins in the synchronous and asynchronous SOCKS5 connection paths.

If upgrading is not immediately possible, do not route wss:// connections through a SOCKS proxy. Use a direct secure WebSocket connection or another transport that performs and verifies TLS to the WebSocket origin.

Affected versions

PyPI

PackageVulnerableFixed in
httpcore2
< 2.10.0
2.10.0
httpcore2
< 2.10.0
2.10.0
httpx2
>= 2.6.0, < 2.10.0
2.10.0
httpx2
>= 2.6.0, < 2.10.0
2.10.0

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

httpcore2 PyPI → 2.10.0

pip
pip install --upgrade "httpcore2>=2.10.0"
poetry
poetry add "httpcore2>=2.10.0"
uv
uv add "httpcore2>=2.10.0"

httpx2 PyPI → 2.10.0

pip
pip install --upgrade "httpx2>=2.10.0"
poetry
poetry add "httpx2>=2.10.0"
uv
uv add "httpx2>=2.10.0"

Severity breakdown

CVSS 3.1 8.1

CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N

Attack vector
Adjacent
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None

Weakness

CWE-319: Cleartext Transmission of Sensitive Information

The product transmits sensitive or security-critical data in cleartext in a communication channel that can be sniffed by unauthorized actors.

How to prevent it
  • Architecture and Design: Before transmitting, encrypt the data using reliable, confidentiality-protecting cryptographic protocols.
  • Implementation: When using web applications with SSL, use SSL for the entire session from login to logout, not just for the initial login page.
  • Implementation: When designing hardware platforms, ensure that approved encryption algorithms (such as those recommended by NIST) protect paths from security critical data to trusted user applications.
  • Testing: Use tools and techniques that require manual (human) analysis, such as penetration testing, threat modeling, and interactive tools that allow the tester to record and modify an active session. These may be more effective than strictly automated techniques. This is especially the case with weaknesses that are related to design and business rules.
  • Operation: Configure servers to use encrypted channels for communication, which may include SSL or other secure protocols.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-8xx6-hgc6-gc2m
HTTPX2: Streaming response decompression does not bound peak memory (decompression amplification)
High Also affects httpx2
GHSA-pf96-p4fj-6566
HTTPX2: Conflicting Content-Length and Transfer-Encoding headers can be auto-generated
Medium Also affects httpx2
GHSA-h4x7-gw46-3wm6
HTTPX2: Multipart part header injection via unvalidated file Content-Type and custom headers
Medium Also affects httpx2
GHSA-f2fp-rgf2-35cp
HTTPX2: Quadratic SSE line buffering can cause CPU denial of service
Medium Also affects httpx2
GHSA-3wp9-xfwm-rjjf
AsyncHttpClient: WebSocket proxy credentials sent to the origin server over a CONNECT tunnel
Medium Same weakness, CWE-319
GHSA-jmqq-x5g9-9p2w
AsyncHttpClient: Replay to a different host sends the original host request and credentials to the new host
Critical Same weakness, CWE-319
GHSA-rqf5-2wxv-rjf4
AsyncHttpClient: Digest challenge without a usable nonce downgrades to Basic and sends the password in cleartext
High Same weakness, CWE-319
GHSA-xr57-gcx8-52hf
AsyncHttpClient sends origin credentials to the proxy on the plaintext CONNECT request
Medium Same weakness, CWE-319

Credits: maxisbey

Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor