Why a binary carries standard library findings you never imported#
A Go program that imports only net/http still contains crypto/tls and crypto/x509, because the HTTP client needs them to verify a server's certificate. Those packages are compiled into the executable at build time. Upgrading Go on the build host, or on the server that runs the binary, changes nothing in a binary that already exists. Only the next build picks up the patched packages.
The Go project ships those patches as minor releases. Its release history page says: "We fix critical problems, including critical security problems, in supported releases as needed by issuing minor revisions (for example, Go 1.6.1, Go 1.6.2, and so on)." A standard library advisory therefore names a fixed toolchain version, not a module version.
The advisory used here is GO-2025-4007 (CVE-2025-58187), quadratic name-constraint checking in crypto/x509. Its OSV record in golang/vulndb lists the package as stdlib and gives two fixed points, one per supported release line:
"package": { "name": "stdlib", "ecosystem": "Go" },
"ranges": [{ "type": "SEMVER", "events": [
{ "introduced": "0" }, { "fixed": "1.24.9" },
{ "introduced": "1.25.0" }, { "fixed": "1.25.3" }
]}]
Its details field limits the exposure: "This affects programs which validate arbitrary certificate chains."
Read the toolchain from the binary#
go version -m reads build information embedded in the executable. The go command documentation for Go 1.24.9 says that go version "reports the Go version used to build each of the named files." It adds: "The -m flag causes go version to print each file's embedded module version information, when available."
The constructed program below calls http.Get and uses golang.org/x/text; it never imports crypto/x509. It was built twice from the same source, once with the local Go 1.24.7 and once with GOTOOLCHAIN=go1.24.9:
$ go version -m fetch-old
fetch-old: go1.24.7
path example.com/fetch
mod example.com/fetch (devel)
dep golang.org/x/text v0.3.8 h1:nAL+...
build -buildmode=exe
build -compiler=gc
build -trimpath=true
build CGO_ENABLED=1
build GOARCH=amd64
build GOOS=linux
build GOAMD64=v1
$ go version -m fetch-new
fetch-new: go1.24.9
...
The first line is the toolchain, and it is the only field that decides a standard library advisory. The dep lines list module dependencies with versions and checksums; they decide module advisories, never standard library ones. Go 1.24.7 is below the fixed version 1.24.9, so the first binary is in range and the second is not.
Confirm with a scan of the binary itself#
govulncheck v1.10.0 in binary mode, run against a local database holding the GO-2025-4007 record copied from golang/vulndb, agrees with that reading:
$ govulncheck -db file:///.../vulndb -mode binary -show verbose ./fetch-old
Govulncheck scanned the following 2 modules and the go1.24.7 standard library:
example.com/fetch@(devel)
golang.org/x/text@v0.3.8
=== Symbol Results ===
Vulnerability #1: GO-2025-4007
Quadratic complexity when checking name constraints in crypto/x509
More info: https://pkg.go.dev/vuln/GO-2025-4007
Standard library
Found in: crypto/x509@go1.24.7
Fixed in: crypto/x509@go1.24.9
Vulnerable symbols found:
#1: x509.CertPool.AppendCertsFromPEM
#2: x509.Certificate.CheckSignatureFrom
#3: x509.Certificate.Verify
#4: x509.ParseCertificate
...
Your code is affected by 1 vulnerability from the Go standard library.
$ govulncheck -db file:///.../vulndb -mode binary -show verbose ./fetch-new
Govulncheck scanned the following 2 modules and the go1.24.9 standard library:
...
No vulnerabilities found.
A source scan of the same code at Go 1.24.7 shows how a program that never names crypto/x509 reaches it. Its second trace runs from the deferred resp.Body.Close() in main through a TLS client handshake into Conn.verifyServerCertificate and Certificate.Verify. The traces are approximate: the govulncheck documentation warns that it "analyzes function pointer and interface calls conservatively, which may result in false positives or inaccurate call stacks in some cases." The conclusion holds anyway. An HTTPS client verifies certificate chains that a remote server chooses, which is the case the advisory describes.
The fix for the first binary is a rebuild and a redeploy. To keep the next build from regressing, pin the builder image's Go version (a toolchain line in go.mod also works where GOTOOLCHAIN allows switching), and rescan the artifact the build produced.
When the scanner read the wrong version#
A standard library finding is only as good as the toolchain version the scanner used. Two other fields are easy to confuse with it, and the second one happened in this fixture.
The go line in go.mod. This module's go.mod says go 1.24. A tool that treats that as the toolchain would place every build of this module in the affected range. The toolchain documentation defines that line differently: "The go line declares the minimum required Go version for using the module or workspace." It says nothing about which toolchain built a given binary.
The go command on the scanning machine. govulncheck's source mode uses "the Go version specified by the “go” command found on the PATH", per its documentation. The source scan above ran with the local Go 1.24.7 and reported GO-2025-4007, while the release binary fetch-new, built from the same commit with Go 1.24.9, scans clean. A CI job that runs a source scan on an older image than the release builder reports a vulnerability the shipped artifact does not have.
$ GOTOOLCHAIN=local go version
go version go1.24.7 linux/amd64
$ GOTOOLCHAIN=local govulncheck -db file:///.../vulndb ./...
=== Symbol Results ===
Vulnerability #1: GO-2025-4007
...
Found in: crypto/x509@go1.24.7
Fixed in: crypto/x509@go1.24.9
...
Your code is affected by 1 vulnerability from the Go standard library.
Either way, the binary's own version line settles it. If go version -m on the deployed artifact prints a toolchain at or above the fixed version for its release line, record that output and dismiss the finding as a scanner input error. If it prints an older one, the finding stands regardless of what go.mod or the CI image says.
Decide from the binary's version line#
| What the scan says | Evidence to collect | Decision |
|---|---|---|
| Standard library advisory, binary built below the fixed version | go version -m on the deployed artifact, and whether the vulnerable package handles outside input | Rebuild with a patched toolchain, pin it, redeploy |
| Standard library advisory, binary at or above the fixed version for its release line | The go version -m first line and the field the scanner read | Dismiss as a scanner input error; record both versions |
| Finding from a source scan only | The Go version of the scanning job versus the release builder | Rescan the release binary before deciding |
| Advisory on a release line no longer supported | The release history for that line | Move to a supported release; no minor fix will arrive |
Module advisory on a dep line | That module's version and whether the code calls the symbol | Handle as a module upgrade, separate from the toolchain |
For module advisories, the guide to govulncheck's called-symbol results covers how to read a trace into a dependency. The same rebuild logic applies to base images, which the container image review guide covers.