Executive brief
HashiCorp terraform-mcp-server is a service that allows AI agents and other tools to interact with Terraform environments. A security flaw in its session management allows an attacker who obtains a valid session ID to hijack another user's connection. This could allow the attacker to perform actions in Terraform using the victim's credentials, potentially leading to unauthorized access or modification of infrastructure, workspaces, and sensitive variables.
Technical details
The terraform-mcp-server (versions 0.2.1 through 1.0.0) contains an authorization bypass in its stateful streamable-HTTP transport mode. The vulnerability stems from the per-session Terraform client cache using the MCP session ID as the sole lookup key without binding cached clients to the specific token that created them. An attacker who obtains a victim's session ID can submit requests that the server executes using the victim's cached Terraform bearer token. This allows the attacker to access any Terraform resources (organizations, workspaces, variables) within the scope of the hijacked token. The issue is fixed in version 1.1.0; deployments using stdio or stateless HTTP modes are not affected.
Affected products
- HashiCorp terraform-mcp-server 0.2.1 up to and including 1.0.0
Timeline
- 2026-07-28: disclosed
- 2026-07-28: advisory
- 2026-07-28: patched: Fixed in version 1.1.0