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 HatNVDcve.org
Base Score7.8N/A8.8
Attack VectorLocalN/ANetwork
Attack ComplexityLowN/ALow
Privileges RequiredNoneN/ANone
User InteractionRequiredN/ARequired
ScopeUnchangedN/AUnchanged
ConfidentialityHighN/AHigh
Integrity ImpactHighN/AHigh
Availability ImpactHighN/AHigh

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

Want to get errata notifications? Sign up here.