Summary
Coder's agent connection client can follow attacker-controlled redirects and trust the redirected host when it uses the workspace agent HTTP API port. An authenticated user who controls a workspace agent may redirect control-plane requests to another online agent, potentially accessing files or executing commands across workspace and tenant boundaries.
Affected context
The issue occurs in Coder deployments where the agent connection client follows HTTP redirects and derives the destination host from a redirected request URL. Exploitation depends on an authenticated user controlling a modified workspace agent, knowing the UUID of another online agent, and reaching the workspace agent API port. Read requests are affected by redirect behaviors that replay safely, while some redirect types can also preserve write and process-start requests.
Exploit preconditions
- Attack surface: Coder control-plane requests forwarded through workspace agents - Required access: An authenticated user able to control or modify a workspace agent - Additional knowledge: The UUID of another online workspace agent - Trigger point: Processing a server response that redirects an agent API request - Why exploitation is possible: The custom transport accepts the redirected host
when the destination uses the workspace agent API port, allowing requests intended
for one agent to reach another
Why this happens
The vulnerability combines redirect handling with insufficient destination validation. The agent connection client follows redirects and trusts a host obtained from the redirected URL instead of enforcing a strict relationship between the original destination, the authenticated workspace, and the final network endpoint. This behavior maps to CWE-918: Server-Side Request Forgery, because attacker-influenced routing causes a privileged service to send requests to an unintended internal agent. The resulting cross-workspace access also relates to CWE-863: Incorrect Authorization.
Potential impact
- An attacker may read files from a victim workspace as the victim workspace user.
- An attacker may write or alter files in another workspace.
- An attacker could execute commands through exposed workspace agent process APIs.
- An attacker may cross workspace or tenant isolation boundaries.
- An attacker could modify development artifacts or pipeline inputs.
General mitigation guidance
Mitigation generally focuses on treating redirect destinations as untrusted and preserving authorization boundaries across agent connections. Secure-by-default patterns include disabling redirects for privileged agent API clients unless explicitly required, validating destination hosts against an authenticated workspace-to-agent mapping, and allowing only tightly defined endpoint and port combinations. Redirects should not change the security principal or tenant context, and write or process-start operations should require especially strict destination validation. Network segmentation, least-privilege agent identities, restricted file and process APIs, and minimizing the ability of users to modify agent runtimes can reduce residual impact.
How teams detect issues like this
Detection can include static analysis and code review rules for HTTP clients that automatically follow redirects, accept hosts from redirect URLs, or validate only destination ports without validating identity and tenant context. Reviewers can inspect whether privileged requests preserve authorization and workspace binding after redirects, particularly for file-write and process-start endpoints. Runtime monitoring can flag unusual agent-to-agent requests, cross-tenant API access, unexpected redirect chains, and file or process activity originating from redirected requests. Automated security review tools may help identify these transport and authorization patterns.

