Track vulnerabilities like this one.
Sign up free to get alerted when software you use is affected.
9.1
CVE-2026-107685: req_llm WebSocket connections expose API keys to attackers
CVE-2026-107685 · published 1 month ago
Summary
The WebSocket client used by req_llm does not check the server’s security certificate, so a network eavesdropper could read or change the traffic that carries OpenAI API keys or OAuth tokens. This affects all versions from 1.9.0 up to but not including 1.29.0. Upgrade to version 1.29.0 or later, or configure the client to enforce proper certificate verification.
What to do
- Update mikehostetler req_llm to version 1.29.0.
- Update req_llm to version 1.29.0.
Affected software
| Ecosystem | Vendor | Product | Affected versions |
|---|---|---|---|
| – | agentjido | req_llm |
< 1.29.0 < c7264fc0217fbacfb5562234ff790b8e4462de76 |
| Hex | mikehostetler | req_llm |
>= 1.9.0, < 1.29.0 Fix: upgrade to 1.29.0
|
| Hex | – | req_llm |
>= 1.9.0, < 1.29.0 Fix: upgrade to 1.29.0
|
Original advisory text
WebSocket sessions do not verify TLS certificates, exposing API keys and OAuth tokens to on-path attackers
## Summary
Improper Certificate Validation vulnerability in the WebSocket streaming client in agentjido req_llm allows an on-path attacker to read and modify OpenAI WebSocket sessions, including the `authorization` bearer token, via a TLS certificate the client does not trust. `ReqLLM.Streaming.WebSocketSession.Client.start/3` in `lib/req_llm/streaming/web_socket_session/client.ex` starts WebSockex without TLS options, and WebSockex defaults to `insecure: true`, which connects with `verify: :verify_none`. The option allowlist also drops any caller-supplied `cacerts` or `ssl_options`, so an application cannot turn verification on.
The OpenAI Responses, Realtime, and Codex WebSocket paths reach this client and send the API key or OAuth access token in the `authorization` header. HTTP streaming through Finch and the HTTP/2 duplex session through Mint verify certificates and are not affected.
This issue affects req_llm: from 1.9.0 before 1.29.0.
## Details
**1. Entry points.** `ReqLLM.Providers.OpenAI.WebSocket.responses_url/2` and `realtime_url/2`, and the Codex provider's `codex_websocket_url/1`, turn the provider base URL into a `wss://` URL and start `ReqLLM.Streaming.WebSocketSession` with an `authorization` header that carries the OpenAI API key or the OAuth access token.
**2. Missing TLS options.** `WebSocketSession.init/1` passes only the headers and the timeouts to `WebSocketSession.Client.start/3`, and the allowlist in `start/3` forwards only `name`, `debug`, `async`, `handle_initial_conn_failure`, and the socket timeouts to `WebSockex.start/4`. No `insecure`, `cacerts`, or `ssl_options` value reaches WebSockex, and a caller cannot inject one.
**3. Insecure default.** WebSockex 0.5.1 sets `insecure: true` when the option is absent and opens the `wss://` connection through `:ssl.connect/4` with `verify: :verify_none`. Any certificate completes the handshake, so an attacker who terminates TLS on the path receives the upgrade request with the bearer token and every frame of the session, and can rewrite frames in either direction.
## Proof of concept
1. Start a TLS endpoint on `localhost` with a self-signed certificate chain that no trust store contains, and let it answer the WebSocket upgrade with `101 Switching Protocols`.
2. On a vulnerable version, call `ReqLLM.Streaming.WebSocketSession.start_link/2` with `wss://localhost:<port>/socket` and `headers: [{"authorization", "Bearer <token>"}]`, then `await_connected/2`.
3. `await_connected/2` returns `:ok`, the endpoint completes the TLS handshake, and the endpoint receives the upgrade request carrying the bearer token. On 1.29.0 the same call returns `{:error, %WebSockex.ConnError{original: {:tls_alert, {:unknown_ca, _}}}}` and the endpoint never sees the request.
## Impact
An attacker on the network path between an application and the OpenAI endpoint presents their own certificate, obtains the OpenAI API key or OAuth access token and the full session content, and can alter model output and tool calls before the application acts on them. Every application that uses the OpenAI Responses, Realtime, or Codex WebSocket paths is affected.
## Workarounds
Leave the `openai_stream_transport` provider option at its default `:sse` for the OpenAI and OpenAI Codex providers, and do not call `ReqLLM.Providers.OpenAI.WebSocket.start_responses_session/2` directly. Responses streaming then runs over HTTP through Finch, which verifies certificates. `ReqLLM.OpenAI.Realtime.connect/2` has no HTTP alternative, so do not use it on an affected version.
Improper Certificate Validation vulnerability in the WebSocket streaming client in agentjido req_llm allows an on-path attacker to read and modify OpenAI WebSocket sessions, including the `authorization` bearer token, via a TLS certificate the client does not trust. `ReqLLM.Streaming.WebSocketSession.Client.start/3` in `lib/req_llm/streaming/web_socket_session/client.ex` starts WebSockex without TLS options, and WebSockex defaults to `insecure: true`, which connects with `verify: :verify_none`. The option allowlist also drops any caller-supplied `cacerts` or `ssl_options`, so an application cannot turn verification on.
The OpenAI Responses, Realtime, and Codex WebSocket paths reach this client and send the API key or OAuth access token in the `authorization` header. HTTP streaming through Finch and the HTTP/2 duplex session through Mint verify certificates and are not affected.
This issue affects req_llm: from 1.9.0 before 1.29.0.
## Details
**1. Entry points.** `ReqLLM.Providers.OpenAI.WebSocket.responses_url/2` and `realtime_url/2`, and the Codex provider's `codex_websocket_url/1`, turn the provider base URL into a `wss://` URL and start `ReqLLM.Streaming.WebSocketSession` with an `authorization` header that carries the OpenAI API key or the OAuth access token.
**2. Missing TLS options.** `WebSocketSession.init/1` passes only the headers and the timeouts to `WebSocketSession.Client.start/3`, and the allowlist in `start/3` forwards only `name`, `debug`, `async`, `handle_initial_conn_failure`, and the socket timeouts to `WebSockex.start/4`. No `insecure`, `cacerts`, or `ssl_options` value reaches WebSockex, and a caller cannot inject one.
**3. Insecure default.** WebSockex 0.5.1 sets `insecure: true` when the option is absent and opens the `wss://` connection through `:ssl.connect/4` with `verify: :verify_none`. Any certificate completes the handshake, so an attacker who terminates TLS on the path receives the upgrade request with the bearer token and every frame of the session, and can rewrite frames in either direction.
## Proof of concept
1. Start a TLS endpoint on `localhost` with a self-signed certificate chain that no trust store contains, and let it answer the WebSocket upgrade with `101 Switching Protocols`.
2. On a vulnerable version, call `ReqLLM.Streaming.WebSocketSession.start_link/2` with `wss://localhost:<port>/socket` and `headers: [{"authorization", "Bearer <token>"}]`, then `await_connected/2`.
3. `await_connected/2` returns `:ok`, the endpoint completes the TLS handshake, and the endpoint receives the upgrade request carrying the bearer token. On 1.29.0 the same call returns `{:error, %WebSockex.ConnError{original: {:tls_alert, {:unknown_ca, _}}}}` and the endpoint never sees the request.
## Impact
An attacker on the network path between an application and the OpenAI endpoint presents their own certificate, obtains the OpenAI API key or OAuth access token and the full session content, and can alter model output and tool calls before the application acts on them. Every application that uses the OpenAI Responses, Realtime, or Codex WebSocket paths is affected.
## Workarounds
Leave the `openai_stream_transport` provider option at its default `:sse` for the OpenAI and OpenAI Codex providers, and do not call `ReqLLM.Providers.OpenAI.WebSocket.start_responses_session/2` directly. Responses streaming then runs over HTTP through Finch, which verifies certificates. `ReqLLM.OpenAI.Realtime.connect/2` has no HTTP alternative, so do not use it on an affected version.
References
- https://github.com URL
- https://cna.erlef.org/cves/CVE-2026-107685.html URL
- https://github.com/agentjido/req_llm/commit/a389d718640ceb2d541a8f540ab954cbf5ef... URL
- https://github.com/agentjido/req_llm/commit/c7264fc0217fbacfb5562234ff790b8e4462... Patch
- https://hex.pm/packages/req_llm Product
- https://repo.hex.pm URL
- https://github.com/agentjido/req_llm/security/advisories/GHSA-6vww-5m28-f26v Vendor Advisory
- https://osv.dev/vulnerability/EEF-CVE-2026-107685 URL
- https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/107xxx/CVE-2026-1076... Vendor Advisory
- https://nvd.nist.gov/vuln/detail/CVE-2026-107685 Vendor Advisory
- https://github.com/agentjido/req_llm Product
Internet-facing
14 days
Internal
At next upgrade
- Not known to be exploited
- Needs hands-on effort to exploit
- Gives an attacker full control
Severity
9.1
Critical
Type
CWE-295Improper Certificate Validation
Timeline
Published23 Oct 2026
Updated2 Dec 2026
First seen23 Oct 2026
Sources
CVE-2026-107685 · NVD
CVE-2026-107685 · MITRE
EEF-CVE-2026-107685 · OSV
GHSA-6vww-5m28-f26v · GHSA
CVE-2026-107685 · OSV
Track software like this
Free during beta