CVE-2026-27140 Code execution vulnerability in SWIG code generation in cmd/go

High 8.8 Published Updated

Attackers can execute arbitrary code during build time by crafting SWIG filenames that bypass trust layers in the Go toolchain.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2026-27140?

CVE-2026-27140 is a high-severity code injection vulnerability in Golang Go, published on 8 Apr 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

SWIG file names containing 'cgo' and well-crafted payloads could lead to code smuggling and arbitrary code execution at build time due to trust layer bypass.

Weakness: CWE-863, CWE-641

Which versions are affected by CVE-2026-27140?

2 open source packages ship an affected version, including golang and toolchain. It affects 1 product.

PackageAffectedFixed in
golang BitnamiAll versions1.25.9, 1.26.2
toolchain GoAll versions1.25.9, 1.26.2
Linux distribution packages (38)
delve Red Hat:rhel_aus:8.4::appstreamAll versions0:1.5.0-2.module+el8.4.0+8864+58b0fcdb
delve-debuginfo Red Hat:rhel_aus:8.4::appstreamAll versions0:1.5.0-2.module+el8.4.0+8864+58b0fcdb
delve-debugsource Red Hat:rhel_aus:8.4::appstreamAll versions0:1.5.0-2.module+el8.4.0+8864+58b0fcdb
go-toolset Red Hat:rhel_aus:8.4::appstreamAll versions0:1.15.14-3.module+el8.4.0+22765+91da4d3f
golang Red Hat:rhel_aus:8.4::appstreamAll versions0:1.15.14-22.module+el8.4.0+24267+d2faeddf
golang-bin Red Hat:rhel_aus:8.4::appstreamAll versions0:1.15.14-22.module+el8.4.0+24267+d2faeddf
golang-docs Red Hat:rhel_aus:8.4::appstreamAll versions0:1.15.14-22.module+el8.4.0+24267+d2faeddf
golang-misc Red Hat:rhel_aus:8.4::appstreamAll versions0:1.15.14-22.module+el8.4.0+24267+d2faeddf
golang-race Red Hat:rhel_aus:8.4::appstreamAll versions0:1.15.14-22.module+el8.4.0+24267+d2faeddf
golang-src Red Hat:rhel_aus:8.4::appstreamAll versions0:1.15.14-22.module+el8.4.0+24267+d2faeddf
golang-tests Red Hat:rhel_aus:8.4::appstreamAll versions0:1.15.14-22.module+el8.4.0+24267+d2faeddf
delve Red Hat:rhel_aus:8.6::appstreamAll versions0:1.7.2-1.module+el8.6.0+12972+ebab5911
delve-debuginfo Red Hat:rhel_aus:8.6::appstreamAll versions0:1.7.2-1.module+el8.6.0+12972+ebab5911
delve-debugsource Red Hat:rhel_aus:8.6::appstreamAll versions0:1.7.2-1.module+el8.6.0+12972+ebab5911
go-toolset Red Hat:rhel_aus:8.6::appstreamAll versions0:1.17.13-2.module+el8.6.0+22782+bd95fb4c
golang Red Hat:rhel_aus:8.6::appstreamAll versions0:1.17.13-16.module+el8.6.0+24266+ace38400
golang-bin Red Hat:rhel_aus:8.6::appstreamAll versions0:1.17.13-16.module+el8.6.0+24266+ace38400
golang-docs Red Hat:rhel_aus:8.6::appstreamAll versions0:1.17.13-16.module+el8.6.0+24266+ace38400
golang-misc Red Hat:rhel_aus:8.6::appstreamAll versions0:1.17.13-16.module+el8.6.0+24266+ace38400
golang-race Red Hat:rhel_aus:8.6::appstreamAll versions0:1.17.13-16.module+el8.6.0+24266+ace38400
golang-src Red Hat:rhel_aus:8.6::appstreamAll versions0:1.17.13-16.module+el8.6.0+24266+ace38400
golang-tests Red Hat:rhel_aus:8.6::appstreamAll versions0:1.17.13-16.module+el8.6.0+24266+ace38400
delve Red Hat:rhel_e4s:8.6::appstreamAll versions0:1.7.2-1.module+el8.6.0+12972+ebab5911
delve-debuginfo Red Hat:rhel_e4s:8.6::appstreamAll versions0:1.7.2-1.module+el8.6.0+12972+ebab5911
delve-debugsource Red Hat:rhel_e4s:8.6::appstreamAll versions0:1.7.2-1.module+el8.6.0+12972+ebab5911
go-toolset Red Hat:rhel_e4s:8.6::appstreamAll versions0:1.17.13-2.module+el8.6.0+22782+bd95fb4c
golang Red Hat:rhel_e4s:8.6::appstreamAll versions0:1.17.13-16.module+el8.6.0+24266+ace38400
golang-bin Red Hat:rhel_e4s:8.6::appstreamAll versions0:1.17.13-16.module+el8.6.0+24266+ace38400
golang-docs Red Hat:rhel_e4s:8.6::appstreamAll versions0:1.17.13-16.module+el8.6.0+24266+ace38400
golang-misc Red Hat:rhel_e4s:8.6::appstreamAll versions0:1.17.13-16.module+el8.6.0+24266+ace38400
golang-race Red Hat:rhel_e4s:8.6::appstreamAll versions0:1.17.13-16.module+el8.6.0+24266+ace38400
golang-src Red Hat:rhel_e4s:8.6::appstreamAll versions0:1.17.13-16.module+el8.6.0+24266+ace38400
golang-tests Red Hat:rhel_e4s:8.6::appstreamAll versions0:1.17.13-16.module+el8.6.0+24266+ace38400
delve Red Hat:rhel_e4s:8.8::appstreamAll versions0:1.9.1-1.module+el8.8.0+16778+5fbb74f5
delve-debuginfo Red Hat:rhel_e4s:8.8::appstreamAll versions0:1.9.1-1.module+el8.8.0+16778+5fbb74f5
delve-debugsource Red Hat:rhel_e4s:8.8::appstreamAll versions0:1.9.1-1.module+el8.8.0+16778+5fbb74f5
go-toolset Red Hat:rhel_e4s:8.8::appstreamAll versions0:1.19.13-4.module+el8.8.0+23976+18ba1869
golang Red Hat:rhel_e4s:8.8::appstreamAll versions0:1.19.13-24.module+el8.8.0+24268+9f9e0e19

Products include Golang Go.

How do I fix CVE-2026-27140?

Upgrade golang to a fixed version for your release line: 1.25.9 or 1.26.2.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is CVE-2026-27140 being exploited?

There is no known exploitation of CVE-2026-27140 in the wild and no public exploit code.

All Golang Go vulnerabilities

Sources

Also known as AZL-98607, BELL-CVE-2026-27140, BIT-golang-2026-27140, CLEANSTART-2026-GQ35594, CLEANSTART-2026-KD34055, CLEANSTART-2026-OK73778 and 648 more.

Is CVE-2026-27140 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free