{"id":"EEF-CVE-2026-107685","summary":"WebSocket sessions do not verify TLS certificates, exposing API keys and OAuth tokens to on-path attackers","details":"## Summary\n\nImproper 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.\n\nThe 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.\n\nThis issue affects req_llm: from 1.9.0 before 1.29.0.\n\n## Details\n\n**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.\n\n**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.\n\n**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.\n\n## Proof of concept\n\n1. 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`.\n2. On a vulnerable version, call `ReqLLM.Streaming.WebSocketSession.start_link/2` with `wss://localhost:\u003cport\u003e/socket` and `headers: [{\"authorization\", \"Bearer \u003ctoken\u003e\"}]`, then `await_connected/2`.\n3. `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.\n\n## Impact\n\nAn 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.\n\n## Workarounds\n\nLeave 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.","aliases":["CVE-2026-107685","GHSA-6vww-5m28-f26v"],"modified":"2026-10-23T11:25:55.127328620Z","published":"2026-10-23T11:00:38.975Z","database_specific":{"cpe_ids":["cpe:2.3:a:agentjido:req_llm:*:*:*:*:*:*:*:*"],"cwe_ids":["CWE-295"],"capec_ids":["CAPEC-94"]},"references":[{"type":"ADVISORY","url":"https://github.com/agentjido/req_llm/security/advisories/GHSA-6vww-5m28-f26v"},{"type":"WEB","url":"https://cna.erlef.org/cves/CVE-2026-107685.html"},{"type":"WEB","url":"https://github.com/agentjido/req_llm/commit/a389d718640ceb2d541a8f540ab954cbf5ef8313"},{"type":"FIX","url":"https://github.com/agentjido/req_llm/commit/c7264fc0217fbacfb5562234ff790b8e4462de76"},{"type":"PACKAGE","url":"https://hex.pm/packages/req_llm"}],"affected":[{"package":{"name":"req_llm","ecosystem":"Hex","purl":"pkg:hex/req_llm"},"ranges":[{"type":"SEMVER","events":[{"introduced":"1.9.0"},{"fixed":"1.29.0"}]}],"versions":["1.10.0","1.11.0","1.12.0","1.13.0","1.14.0","1.15.0","1.16.0","1.17.0","1.17.1","1.18.0","1.19.0","1.20.0","1.21.0","1.21.1","1.22.0","1.23.0","1.24.0","1.25.0","1.26.0","1.27.0","1.28.0","1.9.0"],"database_specific":{"source":"https://cna.erlef.org/osv/EEF-CVE-2026-107685.json"}},{"ranges":[{"type":"GIT","repo":"https://github.com/agentjido/req_llm","events":[{"introduced":"a389d718640ceb2d541a8f540ab954cbf5ef8313"},{"fixed":"c7264fc0217fbacfb5562234ff790b8e4462de76"}]}],"versions":["v1.28.0","v1.27.0","v1.26.0","v1.25.0","v1.24.0","v1.23.0","v1.22.0","v1.21.1","v1.21.0","v1.20.0","v1.19.0","v1.18.0","v1.17.1","v1.17.0","v1.16.0","v1.15.0","v1.14.0","v1.13.0","v1.12.0","v1.11.0","v1.10.0","v1.9.0"],"database_specific":{"source":"https://cna.erlef.org/osv/EEF-CVE-2026-107685.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V4","score":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N"}],"credits":[{"name":"Neil Berkman","type":"REPORTER"},{"name":"Neil Berkman","type":"FINDER"},{"name":"Mike Hostetler","type":"REMEDIATION_DEVELOPER"},{"name":"Jonatan Männchen / EEF","type":"COORDINATOR"}]}