GHSA-wcmj-x466-56mm: OpenTofu Provider Cache Installation Follows Root-module-controlled Vulnerability

MODERATE
CVSS 6.1
CWE-61
Published
Advisory Summary

GHSA-wcmj-x466-56mm is a MODERATE (CVSS 6.1) provider cache installation follows root-module-controlled vulnerability (CWE-61: UNIX Symbolic Link (Symlink) Following) affecting OpenTofu libraries in the Go ecosystem. The issue involves provider cache installation follows root-module-controlled package directory symlink and writes outside the working tree. Remediation is available by upgrading affected packages to version 1.11.7, 1.10.10.

GHSA-wcmj-x466-56mm at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-wcmj-x466-56mm
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-61: UNIX Symbolic Link (Symlink) Following
Affected Product OpenTofu
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 6.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix GHSA-wcmj-x466-56mm

To remediate this vulnerability, upgrade all affected OpenTofu dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/opentofu/opentofu fixed: 1.11.7
Upgrade github.com/opentofu/opentofu to 1.11.7
github.com/opentofu/opentofu fixed: 1.10.10
Upgrade github.com/opentofu/opentofu to 1.10.10
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/opentofu/opentofu

How to Check if You Are Affected

To determine whether your application is affected by GHSA-wcmj-x466-56mm, inspect your project dependencies for OpenTofu:

inspect dependencies for github.com/opentofu/opentofu

Analyze the terminal output to locate any version of OpenTofu in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.11.7), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-61: UNIX Symbolic Link (Symlink) Following, where the product, when opening a file or directory, does not sufficiently account for when the file is a symbolic link that resolves to a target outside of the intended control sphere. this could allow an attacker to cause the product to operate on unauthorized files. In OpenTofu, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary If a symlink already exists under the `.terraform/providers` directory where a provider package needs to be installed, `tofu init` would follow that symlink and install the new package content into it. If an attacker can coerce an operator into running `tofu init` in a directory whose contents are attacker-controlled, they can include such a symlink along with instruction to install an attacker-controlled provider package at the path of that symlink, which would then cause OpenTofu to write the contents of that provider package into an arbitrary directory elsewhere in the filesystem if the OpenTofu process has sufficient permission to write there. ## Details OpenTofu permits provider cache entries to be symlinks to other locations because that is how the local cache in a specific working directory refers to matching entries in a global cache directory configured in the CLI configuration file. Unfortunately, OpenTofu's provider installer was missing a rule to remove an existing symlink during installation if it refers to a directory that doesn't already match the expected provider package content. Instead, it would attempt to update the content of the target directory to match the content of the provider package. If developers use OpenTofu with the `TF_DATA_DIR` environment variable set, note that the directory they specify in that environment variable is treated as a replacement location for the content that would normally be in the `.terraform` directory, and so it is _that_ location which is sensitive to pre-existing symlinks. In the newly-issued versions of OpenTofu, it is now considered an error if any existing directory entry is present in the cache whose content does not already match the expected package content. As before, if an existing entry is present and its content already matches the expected package content then OpenTofu makes no changes to the target directory and just uses it as-is. ## Workaround If developers cannot upgrade to a fixed version immediately, OpenTofu recommends that they ensure that there is no `.terraform` directory already present when running `tofu init` for the first time in a new working directory. The absence of that directory guarantees that there cannot be a conflicting symlink. For an extra line of defense, verify before running `tofu init` that there are no symlinks anywhere under the current working directory that refer to any path above the current working directory. This limits the scope of attack only to other files in the same working directory, which the attacker already controls in this scenario. ## Notes and Resources - OpenTofu thanks Francesco Sabiu (@fsabiu) for finding and responsibly disclosing this vulnerability. - Generally-speaking, the OpenTofu project expects that operators will run `tofu init` only in directories containing content they trust. OpenTofu prioritized addressing this _specific_ concern because a successful attack can write arbitrary files into an arbitrary directory and therefore the potential impact is relatively high and the solution to the problem is low-risk, but this is a pragmatic exception to the usual threat model and there aren't any plans for broader hardening of OpenTofu against attacks of this type. OpenTofu recommends that developers ensure that their working directory contents are as they expect before running `tofu init`. In particular: it remains possible for an attacker to place a symlink at some higher point in the directory structure of the provider cache, into which OpenTofu will construct subdirectories needed to create the remaining provider cache directory structure. OpenTofu evaluated that as a less severe concern because it does not give the attacker full control over what is written into the target directory, but note that this does still allow an attacker to write arbitrary content into a directory two levels beneath the target when placing the symlink at the hostname level of the cache directory structure. - The original fix for this issue is in https://github.com/opentofu/opentofu/pull/4082. It was backported as follows: - [v1.12 branch](https://github.com/opentofu/opentofu/pull/4087) for v1.12.0 - [v1.11 branch](https://github.com/opentofu/opentofu/pull/4088) for v1.11.7 - [v1.10 branch](https://github.com/opentofu/opentofu/pull/4089) for v1.10.10

GHSA-wcmj-x466-56mm Affected OpenTofu Versions

2 component(s)
Fixed Versions:
1.11.71.10.10
Product / Package Ecosystem Affected Versions Fixed Version
github.com/opentofu/opentofu
Go
≥ 1.11.0
< 1.11.7
1.11.7
github.com/opentofu/opentofu
Go
< 1.10.10
1.10.10

References

Frequently Asked Questions

What is GHSA-wcmj-x466-56mm?
GHSA-wcmj-x466-56mm is a security vulnerability in OpenTofu involving Provider cache installation follows root-module-controlled package directory symlink and writes outside the working tree under CWE-61: UNIX Symbolic Link (Symlink) Following.
Which OpenTofu versions are affected?
Affected versions include releases prior to 1.11.7, 1.10.10 across affected packages: github.com/opentofu/opentofu.
What version fixes GHSA-wcmj-x466-56mm?
Upgrading to 1.11.7, 1.10.10 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/opentofu/opentofu affected?
Yes, github.com/opentofu/opentofu is affected in releases prior to 1.11.7, 1.10.10. Upgrade your dependency to 1.11.7, 1.10.10 or later.
What is the CVSS score of GHSA-wcmj-x466-56mm?
GHSA-wcmj-x466-56mm has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N.
What CWE is associated with GHSA-wcmj-x466-56mm?
GHSA-wcmj-x466-56mm is classified under CWE-61: UNIX Symbolic Link (Symlink) Following (The product, when opening a file or directory, does not sufficiently account for when the file is a symbolic link that resolves to a target outside of the intended control sphere. This could allow an attacker to cause the product to operate on unauthorized files.).
How can I check Go dependencies for GHSA-wcmj-x466-56mm?
Run the dependency tree command: 'inspect dependencies for github.com/opentofu/opentofu'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-wcmj-x466-56mm",
  "modified" : "2026-06-23T22:23:01Z",
  "published" : "2026-06-23T22:23:01Z",
  "aliases" : [ ],
  "summary" : "OpenTofu: Provider cache installation follows root-module-controlled package directory symlink and writes outside the working tree",
  "details" : "## Summary\n\nIf a symlink already exists under the `.terraform/providers` directory where a provider package needs to be installed, `tofu init` would follow that symlink and install the new package content into it.\n\nIf an attacker can coerce an operator into running `tofu init` in a directory whose contents are attacker-controlled, they can include such a symlink along with instruction to install an attacker-controlled provider package at the path of that symlink, which would then cause OpenTofu to write the contents of that provider package into an arbitrary directory elsewhere in the filesystem if the OpenTofu process has sufficient permission to write there.\n\n## Details\n\nOpenTofu permits provider cache entries to be symlinks to other locations because that is how the local cache in a specific working directory refers to matching entries in a global cache directory configured in the CLI configuration file.\n\nUnfortunately, OpenTofu's provider installer was missing a rule to remove an existing symlink during installation if it refers to a directory that doesn't already match the expected provider package content. Instead, it would attempt to update the content of the target directory to match the content of the provider package.\n\nIf developers use OpenTofu with the `TF_DATA_DIR` environment variable set, note that the directory they specify in that environment variable is treated as a replacement location for the content that would normally be in the `.terraform` directory, and so it is _that_ location which is sensitive to pre-existing symlinks.\n\nIn the newly-issued versions of OpenTofu, it is now considered an error if any existing directory entry is present in the cache whose content does not already match the expected package content. As before, if an existing entry is present and its content already matches the expected package content then OpenTofu makes no changes to the target directory and just uses it as-is.\n\n## Workaround\n\nIf developers cannot upgrade to a fixed version immediately, OpenTofu recommends that they ensure that there is no `.terraform` directory already present when running `tofu init` for the first time in a new working directory. The absence of that directory guarantees that there cannot be a conflicting symlink.\n\nFor an extra line of defense, verify before running `tofu init` that there are no symlinks anywhere under the current working directory that refer to any path above the current working directory. This limits the scope of attack only to other files in the same working directory, which the attacker already controls in this scenario.\n\n## Notes and Resources\n\n- OpenTofu thanks Francesco Sabiu (@fsabiu) for finding and responsibly disclosing this vulnerability.\n- Generally-speaking, the OpenTofu project expects that operators will run `tofu init` only in directories containing content they trust.\n\n  OpenTofu prioritized addressing this _specific_ concern because a successful attack can write arbitrary files into an arbitrary directory and therefore the potential impact is relatively high and the solution to the problem is low-risk, but this is a pragmatic exception to the usual threat model and there aren't any plans for broader hardening of OpenTofu against attacks of this type. OpenTofu recommends that developers ensure that their working directory contents are as they expect before running `tofu init`.\n\n    In particular: it remains possible for an attacker to place a symlink at some higher point in the directory structure of the provider cache, into which OpenTofu will construct subdirectories needed to create the remaining provider cache directory structure. OpenTofu evaluated that as a less severe concern because it does not give the attacker full control over what is written into the target directory, but note that this does still allow an attacker to write arbitrary content into a directory two levels beneath the target when placing the symlink at the hostname level of the cache directory structure.\n- The original fix for this issue is in https://github.com/opentofu/opentofu/pull/4082. It was backported as follows:\n    - [v1.12 branch](https://github.com/opentofu/opentofu/pull/4087) for v1.12.0\n    - [v1.11 branch](https://github.com/opentofu/opentofu/pull/4088) for v1.11.7\n    - [v1.10 branch](https://github.com/opentofu/opentofu/pull/4089) for v1.10.10",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/opentofu/opentofu"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.11.0"
      }, {
        "fixed" : "1.11.7"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/opentofu/opentofu"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.10.10"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/opentofu/opentofu/security/advisories/GHSA-wcmj-x466-56mm"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/opentofu/opentofu"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-61" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-23T22:23:01Z",
    "nvd_published_at" : null
  }
}