Resources / MCP Server Risk Directory / Terraform MCP Server
Is the Terraform MCP Server safe? Risks, permissions and safe setup
Platform and DevOps teams letting agents look up provider docs and inspect or manage HCP Terraform workspaces and runs. Here is what an AI agent can do through it, its published vulnerabilities and how to set it up safely.
Baseline risk
- Capabilities: 25 of 40
- Read-plus-exfiltrate: no
- Hidden instructions (publicly verified): none known
- Third-party publisher: no (official)
Before your own factors: version pinning, number of users and policy coverage. How we score
- Maker
- HashiCorp (an IBM company)
- Publisher
- Official (published by the maker)
- Runs
- Local or remote
- Transport
- stdio, streamable-http
- Authentication
- HCP Terraform / Terraform Enterprise API token (TFE_TOKEN, or per-user Authorization: Bearer / TFE_TOKEN header in HTTP mode); public registry tools need no token
- Tools
- 68
- Built-in limits
- --toolsets registry, registry-private, terraform, all, default (registry is default) or --tools for individual tools; ENABLE_TF_OPERATIONS=false by default gates delete_project, delete_team, delete_workspace_safely, force_unlock_workspace and action_run; MCP_ORGANIZATION_ALLOWLIST limits HCP Terraform orgs; no read-only mode
- License
- MPL-2.0
- Source
- github.com/hashicorp/terraform-mcp-server
- Last verified
- 2026-11-23
What an agent can do through it
| Tool | Type | What it does |
|---|---|---|
| get_state_version | Read | Reads a workspace state version, which can contain secrets |
| list_workspace_variables | Read | Lists workspace variables |
| create_run | Infrastructure | Starts a Terraform run on a workspace (not gated by ENABLE_TF_OPERATIONS) |
| action_run | Infrastructure | Acts on a run (gated by ENABLE_TF_OPERATIONS) |
| create_workspace_variable | Write | Creates a workspace variable |
| grant_team_access | Write | Grants a team access to a workspace or project |
| delete_workspace_safely | Delete | Deletes a workspace (gated by ENABLE_TF_OPERATIONS) |
| force_unlock_workspace | Infrastructure | Force-unlocks a workspace (gated by ENABLE_TF_OPERATIONS) |
| delete_variable_in_variable_set | Delete | Deletes a variable from a variable set (not gated) |
| search_provider_docs | Read | Searches public Terraform Registry provider docs |
Known vulnerabilities
| ID | Issue | Published | Fixed in |
|---|---|---|---|
| CVE-2026-14869 (HCSEC-2026-23) High (NVD CVSS 3.1 8.6) | Server-side request forgery via client-supplied Terraform address Affected: 0.2.1 through 1.0.0 (bulletin); NVD lists 0.3.0 to before 1.1.0. | 2026-07-28 | 1.1.0 |
| CVE-2026-16496 (HCSEC-2026-23) High (NVD CVSS 3.1 8.9) | Authorization bypass via session credential cache in stateful mode Affected: 0.2.1 through 1.0.0 (bulletin); NVD lists 0.3.0 to before 1.1.0. | 2026-07-28 | 1.1.0 |
| CVE-2026-16498 (HCSEC-2026-23) Critical (NVD CVSS 3.1 10.0) | Cross-tenant credential reuse in stateless mode Affected: 0.2.1 through 1.0.0 (bulletin); NVD lists 0.3.0 to before 1.1.0. | 2026-07-28 | 1.1.0 |
Main risks
Agent changes real infrastructure
LLM06:2025 Excessive Agency
create_run is not gated by ENABLE_TF_OPERATIONS and can start runs on workspaces the token can reach, and variable and team tools can change config and access. A misled agent can trigger plans and applies against production workspaces.
Secrets in state and variables reach the model
LLM02:2025 Sensitive Information Disclosure
get_state_version, plan logs and variable listings can expose credentials and resource details. HashiCorp warns the server may expose Terraform data to the MCP client and LLM and should not be used with untrusted clients or LLMs.
Shared HTTP deployments leak or reuse tokens
ASI03 Identity and Privilege Abuse
HCSEC-2026-23 covered SSRF that sent the server's token to an attacker endpoint and two flaws that let one user's Terraform credentials serve another user's calls. All affected streamable-HTTP deployments before 1.1.0.
Injected text in registry docs or run output
LLM01:2025 Prompt Injection
Provider and module docs, run comments and plan logs are third-party or user-written text returned to the model. Instructions planted there can push the agent toward unsafe modules or runs.
How to set it up safely
- Upgrade to terraform-mcp-server 1.1.0 or later and pin the Docker tag (the README examples use hashicorp/terraform-mcp-server:1.4.1).
- Use only the registry toolset (the default) unless the agent must touch HCP Terraform; add terraform tools with --tools for specific needs.
- Leave ENABLE_TF_OPERATIONS unset (false) so delete, force-unlock and action_run tools stay off.
- Use a team or user token scoped to non-production workspaces, and check its scope with get_token_permissions.
- Set MCP_ORGANIZATION_ALLOWLIST to the HCP Terraform orgs the agent may use.
- In HTTP mode keep TRANSPORT_HOST on 127.0.0.1, set MCP_REQUIRE_TOKEN=true, keep MCP_CORS_MODE strict, and use TLS for any non-localhost deployment.
- Treat MCP session IDs as sensitive and restrict the HTTP listener to trusted users, as HCSEC-2026-23 advises.
- Require human review of every plan before apply, as HashiCorp says to review all outputs before implementation.
How we score
Baseline scores use the method from our guide to scoring every MCP server on employee laptops. Score the servers in your own environment with the free MCP Server Risk Checklist.
1. What the server can do (capped at 40)
- Sends messages externally: 15
- Fetches arbitrary URLs: 15
- Writes to code repositories: 15
- Reads and writes databases: 15
- Writes or deletes local files: 10
- Automates a browser: 10
- Reads and writes SaaS data: 10
- Reads local files: 5
- Runs code or commands: 15 (added for this directory)
- Changes cloud infrastructure: 15 (added for this directory)
- Moves money or changes payments: 15 (added for this directory)
2. What we found
- Read-plus-exfiltrate: reads sensitive data and can also send data out: 20
- Hidden instructions in a tool description (publicly verified): 30, and always Critical
- Third-party: not published by the maker of the system it connects to: 10
3. Band
0–24 Low · 25–49 Medium · 50–74 High · 75–100 Critical.
This is a baseline. The full method also adds points for unpinned package versions, how many employees use the server and whether a policy covers it; those depend on your setup, so check them in your own environment.
How AccuroAI helps
The AccuroAI Endpoint Agent finds the MCP servers configured in AI clients on managed devices and lists the tools each local server exposes. Each server gets a risk level with its capabilities, and you can block a server once in the console to enforce the block on every device: Claude Code and Cursor refuse calls to it, and for other clients the agent stops the server process. Tool calls from coding agents can be graded by risk, then allowed, confirmed with the employee or blocked.
MCP security · MCP server inventory · How to red team an MCP server
Questions about the Terraform MCP Server
Is the Terraform MCP Server safe to use?
It can be, with the right setup. At baseline it scores 25 (Medium) in the AccuroAI method because an agent using it can changes cloud infrastructure, reads and writes saas data. Limit its scopes or tools, keep a person in the loop for write actions and pin the version you reviewed.
Does the Terraform MCP Server have known vulnerabilities?
Yes. 3 published issues are listed on this page with the affected versions and the fix, as of 2026-11-23. Update to a fixed version and check the maker's advisories before approving a new release.
How do I restrict the Terraform MCP Server?
Use the controls the maker provides: --toolsets registry, registry-private, terraform, all, default (registry is default) or --tools for individual tools; ENABLE_TF_OPERATIONS=false by default gates delete_project, delete_team, delete_workspace_safely, force_unlock_workspace and action_run; MCP_ORGANIZATION_ALLOWLIST limits HCP Terraform orgs; no read-only mode. Then grant the narrowest token or account, approve the server centrally and block other copies of it.
Related servers
AWS API MCP Server · Azure MCP Server · All servers
Sources
- https://github.com/hashicorp/terraform-mcp-server
- https://raw.githubusercontent.com/hashicorp/terraform-mcp-server/main/pkg/toolsets/registry.go
- https://github.com/hashicorp/terraform-mcp-server/security/advisories
- https://discuss.hashicorp.com/t/hcsec-2026-23-multiple-vulnerabilities-impacting-hashicorp-terraform-mcp-server/77606
- https://services.nvd.nist.gov/rest/json/cves/2.0?keywordSearch=terraform-mcp-server
Facts were verified on 2026-11-23 against the server’s own repository and documentation and public vulnerability records. Servers change often: check the maker’s latest release notes before approving a new version. This page is general security guidance, not a guarantee about any product.