Go 1.27.4 security release: cgo flags and a net/http fix
On 10 November 2026, the Go team released Go 1.27.4 and 1.26.11, which fix 12 security vulnerabilities (CVEs[1]), 11 of them in cgo[2] builds. A dependency that uses cgo could run code on the build machine through flags in its #cgo directives, object files or linker inputs. The fixes refuse more flags, so --sysroot= and -target in #cgo CFLAGS now stop the build with “invalid flag”. In the authors' tests on macOS with Apple clang 21.0.0, those #cgo lines built on the older releases and failed on 1.27.4 and 1.26.11.
The twelfth fix is for a crash in net/http HTTP/1 servers that use MaxBytesReader. If a request body limit is exceeded, a handler that reads the body in one goroutine[3] while setting headers in another can cause a runtime panic that stops the process. The authors did not reproduce the crash. govulncheck[4] v1.9.0 reported no vulnerabilities in a test server built with go1.27.3, so it should not yet be relied on to find affected binaries, which need a rebuild and redeploy.
To fix a build that now fails, move the flag into the CGO_CFLAGS environment variable, since the cgo documentation says flags from environment variables are not subject to these limits. CGO_CFLAGS_ALLOW and CGO_LDFLAGS_ALLOW can allow the flags again, but they apply to every cgo package and reopen the hole for all dependencies. To get the fix, run go get toolchain@go1.27.4, which adds a toolchain line to go.mod so machines with GOTOOLCHAIN=auto switch to 1.27.4.
Read the original importstatic.comDiscussion
Sources
-
ImportStatic
Go 1.27.4 security release: cgo flags and a net/http fix

