mediumCVSS 6.1Vulnerability

GHSA-wcmj-x466-56mm

## 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

Properties

ghsa_id
GHSA-wcmj-x466-56mm
severity
medium
summary
OpenTofu: Provider cache installation follows root-module-controlled package directory symlink and writes outside the working tree
cvss_score
6.1
cve_id
GHSA-wcmj-x466-56mm
cvss_vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N
is_ghsa_only
true
ghsa_published
2026-06-23T22:23:01Z
source_url
https://github.com/advisories/GHSA-wcmj-x466-56mm
ghsa_updated
2026-06-23T22:23:02Z

Related Entities (4)

VULNERABLE_TO (1)

[Software]go/github.com/opentofu/opentofu

AFFECTS (1)

[Software]go/github.com/opentofu/opentofu

HAS_WEAKNESS (1)

[Weakness]UNIX Symbolic Link (Symlink) Following

REPORTED_BY (1)

[Source]GitHub Advisory Database

Explore deeper with Ninja Signal's threat intelligence graph

GHSA-wcmj-x466-56mm (CVSS 6.1) — Ninja Signal Threat Intelligence | Ninja Signal