Hermes Agent < 0.16.0 - DNS Rebinding Bypass via WebSocket Endpoints
Description
Hermes Agent before 0.16.0 contains a DNS rebinding vulnerability in WebSocket endpoints that allows remote attackers to bypass Host and Origin validation. FastAPI HTTP middleware does not execute for WebSocket upgrade requests on /api/pty, /api/ws, /api/pub, and /api/events endpoints, enabling attackers to exploit DNS rebinding and inject malicious commands or read terminal output.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected products
1- Range: <0.16.0
Patches
Vulnerability mechanics
Root cause
"FastAPI HTTP middleware does not execute for WebSocket upgrade routes, so the dashboard's Host-header validation was applied to HTTP requests but not to WebSocket upgrades on /api/pty, /api/ws, /api/pub, and /api/events."
Attack vector
An attacker can exploit DNS rebinding to make a victim's browser initiate a WebSocket upgrade to a loopback-bound Hermes dashboard with an attacker-controlled Host header (e.g. `Host: evil.example`) and Origin header (e.g. `Origin: http://evil.example`). Because FastAPI HTTP middleware does not run for WebSocket upgrades, the vulnerable endpoints accept the connection as long as a valid dashboard session token is present in the WebSocket query string. Once the WebSocket is established, the attacker can inject malicious commands via `/api/pty` or read terminal output, bypassing the Host/Origin boundary that protects HTTP routes [ref_id=1][ref_id=2].
Affected code
The vulnerability resides in `hermes_cli/web_server.py` where the four WebSocket endpoints (`/api/pty`, `/api/ws`, `/api/pub`, `/api/events`) did not validate the Host or Origin headers before accepting the upgrade. FastAPI HTTP middleware (which already enforced Host validation for normal HTTP requests) does not execute for WebSocket upgrade routes, leaving a transport-level gap.
What the fix does
The patch adds two new functions in `hermes_cli/web_server.py`: `_ws_host_origin_is_allowed()` and `_ws_request_is_allowed()`. The former reuses the existing `_is_accepted_host()` helper to validate the WebSocket Host header and, when present, checks that the Origin header also targets the bound dashboard host. The latter combines this Host/Origin check with the existing client-IP guard. All four WebSocket endpoints (`/api/pty`, `/api/ws`, `/api/pub`, `/api/events`) now call this shared guard before `accept()`, closing the transport gap. Invalid Host/Origin combinations cause the WebSocket to close with code 4403, while valid loopback usage and missing-Origin (non-browser) clients continue to work [ref_id=1][ref_id=2].
Preconditions
- configThe dashboard must be bound to loopback with HTTP Host validation enabled.
- authThe attacker must have access to a valid dashboard session token (e.g. via prior token exposure, browser-mediated flow, or an intentionally exposed deployment).
- networkThe victim's browser must be induced to initiate a WebSocket upgrade to the local dashboard through an attacker-controlled origin/host pattern (e.g. via DNS rebinding).
Generated on Jun 18, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
5- github.com/NousResearch/hermes-agent/commit/d9ec90585cf7616b5972e44cf8d92bb569fc3febmitrepatch
- www.vulncheck.com/advisories/hermes-agent-dns-rebinding-bypass-via-websocket-endpointsmitrethird-party-advisory
- github.com/NousResearch/hermes-agent/pull/30221mitreissue-tracking
- github.com/NousResearch/hermes-agent/pull/31685mitreissue-tracking
- github.com/NousResearch/hermes-agent/releases/tag/v2026.6.5mitrerelease-notes
News mentions
0No linked articles in our index yet.