GHSA-mjcp-gpgx-ggcg: Github.com/opentofu/opentofu OpenTofu Incorrectly Validates Excluded Subdomain Vulnerability

MODERATE
CVSS 5.9
CWE-296 CWE-1395
Published
Advisory Summary

GHSA-mjcp-gpgx-ggcg is a MODERATE (CVSS 5.9) opentofu incorrectly validates excluded subdomain vulnerability (CWE-296: Improper Following of a Certificate's Chain of Trust) affecting Github.com/opentofu/opentofu libraries in the Go ecosystem. The issue involves opentofu incorrectly validates excluded subdomain constraint in conjunction with tls certificates containing wildcard sans. Remediation is available by upgrading affected packages to version 1.10.8.

GHSA-mjcp-gpgx-ggcg at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-mjcp-gpgx-ggcg
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-296: Improper Following of a Certificate's Chain of Trust
Affected Product Github.com/opentofu/opentofu
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.9

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:U/C:L/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 Unchanged (S:U)
Confidentiality Low (C:L)
Integrity High (I:H)
Availability None (A:N)

How to Fix GHSA-mjcp-gpgx-ggcg

To remediate this vulnerability, upgrade all affected Github.com/opentofu/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.10.8
Upgrade github.com/opentofu/opentofu to 1.10.8
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-mjcp-gpgx-ggcg, inspect your project dependencies for Github.com/opentofu/opentofu:

inspect dependencies for github.com/opentofu/opentofu

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

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

Technical Details

Vulnerability Mechanism & RFC 5280 Specification

Under RFC 5280 specifications for X.509 certificates, the Name Constraints extension defines a namespace within which all subsequent subject names in a certification path must be located. Constraints apply to various name forms including directory names, IP addresses, rfc822Name (email addresses), and uniformResourceIdentifier (URI) entries. Specifically, during certificate path validation, affected versions of Github.com/opentofu/opentofu failed to properly normalize or enforce boundary checks when domain names contained trailing dot (.) characters. Because domain names with a trailing dot signify fully qualified domain names (FQDNs), this omission allowed non-conforming certificates to be improperly validated as compliant with the defined name constraints.

Source Advisory Statement

When OpenTofu is acting as a TLS client authenticating a certificate chain provided by a TLS server, an excluded subdomain constraint in a certificate chain does not restrict the usage of wildcard [SANs](https://en.wikipedia.org/wiki/Public_key_certificate#Subject_Alternative_Name_certificate) in the leaf certificate. For example a constraint that excludes the subdomain test.example.com does not prevent a leaf certificate from claiming the SAN *.example.com. ### Details When acting as a TLS client, OpenTofu relies on the implementation of TLS certificate verification from the standard library of the Go programming language. The Go project has recently published the following advisory for that which indirectly affects OpenTofu's behavior: - [CVE-2025-61727](https://www.cve.org/CVERecord?id=CVE-2025-61727): Improper application of excluded DNS name constraints when verifying wildcard names in crypto/x509 OpenTofu acts as a TLS client when calling a module or provider registry to request metadata, when downloading module or provider packages from "https" URLs, and when interacting with remote services for state storage and encryption. In these situations, OpenTofu could potentially accept as valid a certificate chain containing conflicting information about whether it is valid for the target hostname. All certificates in the chain are still checked separately for validity, and so a successful attack requires an attacker-controlled server to produce a chain of valid-but-contradictory certificates and have access to the private keys associated with each one, and for the attacker to then arrange for OpenTofu to attempt to connect to the affected hostname. ### Patches OpenTofu v1.10.8 addresses these vulnerabilities by being built against Go 1.24.11, which contains an improved version of the upstream implementation. The OpenTofu v1.9 and v1.8 series are also affected by these vulnerabilities. However, those series are built with a version of Go for which no upstream fix is available. Adopting Go 1.24.11 for those series would effectively end support for certain versions of macOS and Linux, and the OpenTofu Project has determined that the impact of these vulnerabilities is not high enough to justify that disruption in a patch release. For those using the OpenTofu v1.9 or v1.8 releases we recommend planning to upgrade to OpenTofu v1.10.8 in the near future.

GHSA-mjcp-gpgx-ggcg Affected Github.com/opentofu/opentofu Versions

1 component(s)
Fixed Versions:
1.10.8
Product / Package Ecosystem Affected Versions Fixed Version
github.com/opentofu/opentofu
Go
< 1.10.8
1.10.8

References

Frequently Asked Questions

What is GHSA-mjcp-gpgx-ggcg?
GHSA-mjcp-gpgx-ggcg is a security vulnerability in Github.com/opentofu/opentofu involving OpenTofu incorrectly validates excluded subdomain constraint in conjunction with TLS certificates containing wildcard SANs under CWE-296: Improper Following of a Certificate's Chain of Trust.
Which Github.com/opentofu/opentofu versions are affected?
Affected versions include releases prior to 1.10.8 across affected packages: github.com/opentofu/opentofu.
What version fixes GHSA-mjcp-gpgx-ggcg?
Upgrading to 1.10.8 (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.10.8. Upgrade your dependency to 1.10.8 or later.
What is the CVSS score of GHSA-mjcp-gpgx-ggcg?
GHSA-mjcp-gpgx-ggcg has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:H/A:N.
What CWE is associated with GHSA-mjcp-gpgx-ggcg?
GHSA-mjcp-gpgx-ggcg is classified under CWE-296: Improper Following of a Certificate's Chain of Trust (The product does not follow, or incorrectly follows, the chain of trust for a certificate back to a trusted root certificate.).
How can I check Go dependencies for GHSA-mjcp-gpgx-ggcg?
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-mjcp-gpgx-ggcg",
  "modified" : "2025-12-09T22:48:08Z",
  "published" : "2025-12-09T22:48:08Z",
  "aliases" : [ ],
  "summary" : "OpenTofu incorrectly validates excluded subdomain constraint in conjunction with TLS certificates containing wildcard SANs",
  "details" : "When OpenTofu is acting as a TLS client authenticating a certificate chain provided by a TLS server, an excluded subdomain constraint in a certificate chain does not restrict the usage of wildcard [SANs](https://en.wikipedia.org/wiki/Public_key_certificate#Subject_Alternative_Name_certificate) in the leaf certificate.\n\nFor example a constraint that excludes the subdomain test.example.com does not prevent a leaf certificate from claiming the SAN *.example.com.\n\n### Details\n\nWhen acting as a TLS client, OpenTofu relies on the implementation of TLS certificate verification from the standard library of the Go programming language.\n\nThe Go project has recently published the following advisory for that which indirectly affects OpenTofu's behavior:\n\n- [CVE-2025-61727](https://www.cve.org/CVERecord?id=CVE-2025-61727): Improper application of excluded DNS name constraints when verifying wildcard names in crypto/x509\n\nOpenTofu acts as a TLS client when calling a module or provider registry to request metadata, when downloading module or provider packages from \"https\" URLs, and when interacting with remote services for state storage and encryption. In these situations, OpenTofu could potentially accept as valid a certificate chain containing conflicting information about whether it is valid for the target hostname.\n\nAll certificates in the chain are still checked separately for validity, and so a successful attack requires an attacker-controlled server to produce a chain of valid-but-contradictory certificates and have access to the private keys associated with each one, and for the attacker to then arrange for OpenTofu to attempt to connect to the affected hostname.\n\n### Patches\n\nOpenTofu v1.10.8 addresses these vulnerabilities by being built against Go 1.24.11, which contains an improved version of the upstream implementation.\n\nThe OpenTofu v1.9 and v1.8 series are also affected by these vulnerabilities. However, those series are built with a version of Go for which no upstream fix is available. Adopting Go 1.24.11 for those series would effectively end support for certain versions of macOS and Linux, and the OpenTofu Project has determined that the impact of these vulnerabilities is not high enough to justify that disruption in a patch release. For those using the OpenTofu v1.9 or v1.8 releases we recommend planning to upgrade to OpenTofu v1.10.8 in the near future.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/opentofu/opentofu"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.10.8"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/opentofu/opentofu/security/advisories/GHSA-mjcp-gpgx-ggcg"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-61727"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/opentofu/opentofu/issues/3546"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/opentofu/opentofu"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/opentofu/opentofu/releases/tag/v1.10.8"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1395", "CWE-296" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-12-09T22:48:08Z",
    "nvd_published_at" : null
  }
}