# GHSA-mjcp-gpgx-ggcg: When OpenTofu is acting as a TLS client authenticating a certificate chain provided by a TLS server, an excluded subdomain constraint in a c

> OpenTofu fails to enforce excluded subdomain constraints against wildcard SANs, allowing attackers to bypass TLS certificate validation checks.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 9 Dec 2025
- **Also known as:** GO-2025-4224

## What is GHSA-mjcp-gpgx-ggcg?

GHSA-mjcp-gpgx-ggcg is a vulnerability in github.com/opentofu/opentofu, published on 9 Dec 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

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.

## Which versions are affected by GHSA-mjcp-gpgx-ggcg?

3 open source packages ship an affected version, including github.com/opentofu/opentofu.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/opentofu/opentofu` | Go | All versions | 1.10.8 |
| `github.com/opentofu/opentofu` | Go | All versions | 1.10.8 |
| `github.com/opentofu/opentofu` | Go | All versions | 1.10.8 |

## How do I fix GHSA-mjcp-gpgx-ggcg?

Upgrade github.com/opentofu/opentofu to 1.10.8 or later.

## Is GHSA-mjcp-gpgx-ggcg being exploited?

There is no known exploitation of GHSA-mjcp-gpgx-ggcg in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-mjcp-gpgx-ggcg and fix it if it is affected.

What it is: GHSA-mjcp-gpgx-ggcg is a vulnerability in github.com/opentofu/opentofu, published on 9 Dec 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-mjcp-gpgx-ggcg in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/opentofu/opentofu (Go): affected all versions; fixed in 1.10.8
- github.com/opentofu/opentofu (Go): affected all versions; fixed in 1.10.8
- github.com/opentofu/opentofu (Go): affected all versions; fixed in 1.10.8

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-mjcp-gpgx-ggcg/ (Markdown: https://insights.sbomify.com/GHSA-mjcp-gpgx-ggcg/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-mjcp-gpgx-ggcg

---
From sbomify Insights: https://insights.sbomify.com/GHSA-mjcp-gpgx-ggcg/
Summaries are generated and may contain mistakes; the official description above is the record.
