CVE-2026-97034
Description
A flaw was found in cmd/go. This flaw allows an attacker to achieve arbitrary command execution when a developer or automated system builds an untrusted Go package that uses cgo (Go's C language integration). When compiling with the GCC (GNU Compiler Collection) compiler, specific build flags cause the linker to search for and evaluate configuration spec files from untrusted directories. An attacker can supply a specially crafted package containing a malicious spec file, resulting in command execution on the host machine during the build process.
Statement
This vulnerability is rated as having Moderate impact because exploitation requires developer interaction, specifically compiling untrusted Go source code that utilizes cgo with malicious compiler directives. Production environments running precompiled Go binaries are not affected by this flaw. The risk is constrained to development workstations and continuous integration build environments where untrusted third-party dependencies are compiled using GCC.
Mitigation
Disable cgo support in environments where native C dependencies are not required.
Set the CGO_ENABLED environment variable before invoking the Go toolchain:
export CGO_ENABLED=0
Caveat: Disabling cgo prevents the compilation of Go packages that rely on native C code or external C libraries. For builds that strictly require cgo, isolate the build process within an unprivileged container or sandbox, and avoid building untrusted source repositories.
Common Vulnerability Scoring System (CVSS) Score Details
Info alert:Important note
CVSS scores for open source components depend on vendor-specific factors (e.g. version or build chain). Therefore, Red Hat's score and impact rating can be different from NVD and other vendors. Red Hat remains the authoritative CVE Naming Authority (CNA) source for its products and services (see Red Hat classifications).
The following CVSS metrics and score provided are preliminary and subject to review.
CVSS v3 Score Breakdown
| Red Hat | NVD | cve.org | |
|---|---|---|---|
| Base Score | 7.8 | N/A | 8.8 |
| Attack Vector | Local | N/A | Network |
| Attack Complexity | Low | N/A | Low |
| Privileges Required | None | N/A | None |
| User Interaction | Required | N/A | Required |
| Scope | Unchanged | N/A | Unchanged |
| Confidentiality | High | N/A | High |
| Integrity Impact | High | N/A | High |
| Availability Impact | High | N/A | High |
Vector
Red Hat: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
cve.org: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Understanding the Weakness (CWE)
Confidentiality,Integrity,Availability
Technical Impact: Execute Unauthorized Code or Commands
Frequently Asked Questions
Not sure what something means? Check out our Security Glossary.
Want to get errata notifications? Sign up here.