CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-WCMJ-X466-56MM

GHSA-WCMJ-X466-56MM: Arbitrary File Write via UNIX Symbolic Link Following in OpenTofu

Amit Schendel
Amit Schendel
Senior Security Researcher

Jun 24, 2026·6 min read·16 visits

Executive Summary (TL;DR)

An input validation flaw during provider extraction in OpenTofu allows pre-seeded symbolic links to redirect file writes to arbitrary paths on the host system, enabling arbitrary file write outside the workspace.

A UNIX symbolic link following vulnerability exists in the provider cache installation mechanism of OpenTofu. This flaw allows an attacker with control over the repository files to write files outside of the intended workspace boundary during initialization.

Vulnerability Overview

OpenTofu downloads provider binaries and extracts them to a local cache directory, typically inside .terraform/providers/, within the workspace root directory. This cache folder serves as a local repository for plugins required by the configuration. During the initialization phase initiated by tofu init, the application fetches the required providers, unpacks their compressed archives, and structures them in designated directory paths.

Prior to version 1.10.10, 1.11.7, and 1.12.0, the package installation process did not properly validate whether pre-existing cache directories were actual physical folders or symbolic links. This omission exposes the workspace to directory traversal and out-of-bounds writes if untrusted repositories are loaded into the utility.

This flaw is classified under CWE-61 (UNIX Symbolic Link Following). If an attacker can construct a workspace containing pre-created symbolic links targeting system-level directories and coerce an operator or CI/CD pipeline into running OpenTofu, the application will follow the link and write provider files into the target directories.

Root Cause Analysis

The root cause of this vulnerability lies in the use of the os.Stat function inside the package extraction routines in internal/getproviders/package_location_local_archive.go. When verifying if the destination provider package directory targetDir is already present, OpenTofu called os.Stat(targetDir) to confirm its status.

The standard Go implementation of os.Stat automatically follows symbolic links to their final target on the operating system. If a symbolic link is placed at targetDir pointing to /usr/local/bin, os.Stat retrieves the properties of /usr/local/bin instead of evaluating the symlink itself. Because the target directory exists, os.Stat returns a success code.

Furthermore, the application lacked logic to delete the pre-existing directory structure if the local cache hashes did not match the newly downloaded package contents. Because the application assumed targetDir was a standard folder, the archive extraction routine proceeded to write files into the destination path, which resolved to the symbolic link's destination, executing a write operation outside of the workspace directory.

Code-Level Patch Analysis

The vulnerability was corrected by transitioning filesystem evaluation from os.Stat to os.Lstat and implementing a strict verification validation step before proceeding with package decompression. Unlike os.Stat, os.Lstat queries the metadata of the symbolic link itself without resolving its destination.

Below is the comparison between the vulnerable and patched check sequences in internal/getproviders/package_location_local_archive.go:

// VULNERABLE LOGIC FLOW
if _, err := os.Stat(targetDir); err == nil {
    // Stat resolves the link target
    targetHash, targetErr := PackageHashV1(PackageLocalDir(targetDir))
    fileHash, fileErr := PackageHashV1(meta.Location)
 
    if targetHash == fileHash && fileErr == nil && targetErr == nil {
        // Skipping occurs only if target hashes match exactly.
        // If they mismatch, extraction continues into targetDir.
        return authResult, nil
    }
}
// PATCHED LOGIC FLOW
if info, err := os.Lstat(targetDir); err == nil {
    log.Printf("[TRACE] There's already a directory entry at %s, so we'll check if it matches our expectations", targetDir)
 
    targetHash, targetErr := PackageHashV1(PackageLocalDir(targetDir))
    // Verify if it is a real physical directory and is entirely empty
    isEmptyDir := info.IsDir() && targetHash == emptyPackageHashV1
    if !isEmptyDir {
        fileHash, fileErr := PackageHashV1(meta.Location)
        var err error
        if fileErr != nil {
            err = fmt.Errorf("failed to calculate checksum for temporary copy of provider package")
        } else if targetErr != nil {
            err = fmt.Errorf("failed to calculate checksum for existing cached provider package")
        } else if targetHash != fileHash {
            // Prevent file write and return error instead of silently overwriting
            err = fmt.Errorf("existing cached package at %s does not match the content of the downloaded package", targetDir)
        }
        if err != nil {
            tracing.SetSpanError(span, err)
            return authResult, err
        }
    }
}

This implementation closes the vulnerability by verifying that the existing file path is a real directory (info.IsDir() returns false for a symlink) and that the directory is empty. If these conditions are not met, and the package hash does not match, OpenTofu raises an error and halts execution, preventing file extraction.

Exploitation and Attack Path

To exploit this flaw, an attacker must commit a malicious directory structure to a version control system and wait for an operator or automated agent to run tofu init on the repository.

The attack path proceeds as follows:

By creating a symlink in the local provider path pointing to a system path (such as /usr/local/bin), the attacker forces the archiver to unpack the downloaded provider binary outside of the workspace bounds during tofu init. If the process runs with administrative privileges, this leads to system modification or local execution of arbitrary binaries.

Impact and Threat Assessment

The security impact of GHSA-WCMJ-X466-56MM is classified as Medium, calculated with a CVSS base score of 6.1. The primary consequence is the write-only arbitrary file write capability, which allows an attacker to drop binaries or scripts outside the workspace directory structure.

While the flaw does not allow direct data retrieval or file reading, writing to operational paths on the filesystem is a well-established vector for privilege escalation. In continuous integration and deployment (CI/CD) environments, runners often execute processes under permissions that allow writing to global folders or executing scheduled cron tasks. If an attacker writes a custom executable script into /etc/cron.d/ or /usr/local/bin/, they can transition the arbitrary file write into full system compromise.

The primary vector is automated pull request workflows. A hostile external contributor could submit a branch containing a pre-seeded symbolic link. If the CI runner automatically triggers initialization on untrusted pull requests, the host machine executing the action is compromised.

Detection and Remediation Guidance

To remediate this issue, all installations of OpenTofu must be updated to fixed versions. Supported branches have received backported updates. Users should migrate immediately to 1.10.10, 1.11.7, or 1.12.0 depending on their current release lifecycle.

If immediate software upgrade is not possible, operators can employ operational mitigations to prevent exploitation inside build pipelines:

  1. Ensure that any pre-existing configuration directories are thoroughly deleted by executing rm -rf .terraform before running initialization commands on untrusted source codes.
  2. Configure CI/CD runners to execute the OpenTofu process under a low-privilege dedicated user account that has no write permissions on global directories.
  3. Scan the working directories for out-of-bounds symbolic links prior to initialization using the following system command:
find . -path "*/.terraform/providers/*" -type l

Official Patches

OpenTofuPrimary Fix Pull Request (PR 4082)
OpenTofuFix Patch File
OpenTofuv1.12 Backport PR
OpenTofuv1.11 Backport PR
OpenTofuv1.10 Backport PR

Fix Analysis (1)

Technical Appendix

CVSS Score
6.1/ 10
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N

Affected Systems

OpenTofu

Affected Versions Detail

Product
Affected Versions
Fixed Version
github.com/opentofu/opentofu
OpenTofu
< 1.10.101.10.10
github.com/opentofu/opentofu
OpenTofu
>= 1.11.0, < 1.11.71.11.7
github.com/opentofu/opentofu
OpenTofu
>= 1.12.0-alpha1, < 1.12.01.12.0
AttributeDetail
CWE IDCWE-61
Attack VectorNetwork
CVSS v3.16.1 (Medium)
ImpactArbitrary File Write
Exploit StatusProof of Concept
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1204.002User Execution: Malicious File
Execution
T1546Event Triggered Execution
Persistence
T1497Virtualization/Sandbox Evasion
Defense Evasion
CWE-61
UNIX Symbolic Link (Symlink) Following ('Symlink Chase')

The application performs file operations on a target that can be a symbolic link, but it does not check if the symlink points outside the intended directory.

Vulnerability Timeline

Original fix commit authored by Martin Atkins
2026-05-06
GitHub Security Advisory GHSA-WCMJ-X466-56MM published
2026-06-23

References & Sources

  • [1]GitHub Security Advisory Page
  • [2]OpenTofu Advisory Details
  • [3]Primary Fix Pull Request

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•2 days ago•CVE-2026-54068
5.9

CVE-2026-54068: Unauthenticated Server-Side Template Injection and SQLite Exfiltration in SiYuan PKM

An authentication bypass in the SiYuan personal knowledge management system before version 3.7.0 exposes a dynamic icon rendering endpoint. This endpoint processes client-supplied Go template directives. By submitting a crafted request, an unauthenticated remote attacker can leverage registered database template functions to execute arbitrary read-only SQL queries and exfiltrate workspace contents.

Amit Schendel
Amit Schendel
12 views•5 min read
•2 days ago•CVE-2026-54069
9.1

CVE-2026-54069: Authentication Bypass in SiYuan Note via Origin Header Spoofing

CVE-2026-54069 is a critical authentication bypass vulnerability in the SiYuan Note personal knowledge management system. The flaw is located in the HTTP server's middleware handling API authorization, which unconditionally trusts requests carrying a 'chrome-extension://' scheme in the Origin HTTP header, granting administrative access without validating API tokens.

Alon Barad
Alon Barad
10 views•5 min read
•2 days ago•CVE-2026-54089
9.1

CVE-2026-54089: Authentication Bypass by Spoofing in File Browser

CVE-2026-54089 is a critical authentication bypass vulnerability in File Browser affecting instances configured with proxy-based authentication. An unauthenticated remote attacker with direct network access can impersonate arbitrary users or register new accounts by spoofing configured HTTP headers.

Amit Schendel
Amit Schendel
8 views•7 min read
•2 days ago•GHSA-99J7-FHR2-XFJ4
10.0

GHSA-99J7-FHR2-XFJ4: Malicious Remote Code Execution Payload in 'exploration' Cargo Crate

The malicious Cargo package 'exploration' was uploaded to the crates.io registry. During compilation or package import, the crate executes code designed to establish an outbound TCP/HTTP connection, download an external second-stage binary, and execute the binary locally on the host machine. This creates an unauthenticated remote code execution vector impacting developer environments and continuous integration pipelines.

Amit Schendel
Amit Schendel
11 views•6 min read
•2 days ago•CVE-2026-54088
9.3

CVE-2026-54088: Pre-Authentication Remote Code Execution in File Browser Hook Authentication

CVE-2026-54088 is a critical command injection vulnerability in File Browser prior to version 2.63.6. When Hook Authentication is enabled, the application interpolates unsanitized credentials into a shell command, allowing unauthenticated remote code execution.

Alon Barad
Alon Barad
10 views•6 min read
•2 days ago•GHSA-QV4M-M73M-8HJ7
8.8

GHSA-qv4m-m73m-8hj7: Authenticated Arbitrary File Upload leading to Remote Code Execution in NotrinosERP

An authenticated remote code execution vulnerability exists in NotrinosERP (versions up to and including 1.0.0) within the Human Resource Management (HRM) module. Users with employee management permissions can upload arbitrary file types, including PHP scripts, which are written directly to a web-accessible directory. This allows for arbitrary code execution in the context of the web-server user.

Alon Barad
Alon Barad
8 views•6 min read