Guides / Languages and packages
Find vulnerable Go dependencies with govulncheck
govulncheck is the vulnerability scanner of the Go project. It reads the modules of a program, looks them up in the Go vulnerability database and then checks whether your code calls the affected functions. That last step keeps the report short. A module with a known bug in a function you never call is listed apart from the findings that affect you.
Install it
govulncheck is a Go program. Install a fixed version so that every machine and CI run uses the same one (v1.10.0 is the latest release as of November 2026):
go install golang.org/x/vuln/cmd/govulncheck@v1.10.0
The binary lands in $(go env GOPATH)/bin, usually ~/go/bin. Add that directory to PATH if govulncheck is not found.
Scan a module
Run it from the directory with go.mod:
govulncheck ./...
The example module calls language.ParseAcceptLanguage from golang.org/x/text v0.3.7 (output of govulncheck v1.10.0 with Go 1.27.3):
=== Symbol Results ===
Vulnerability #1: GO-2022-1059
Denial of service via crafted Accept-Language header in
golang.org/x/text/language
More info: https://pkg.go.dev/vuln/GO-2022-1059
Module: golang.org/x/text
Found in: golang.org/x/text@v0.3.7
Fixed in: golang.org/x/text@v0.3.8
Example traces found:
#1: main.go:11:46: demo.main calls language.ParseAcceptLanguage
Your code is affected by 1 vulnerability from 1 module.
This scan also found 0 vulnerabilities in packages you import and 3
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use '-show verbose' for more details.
The report has up to three parts:
- Symbol results: vulnerabilities in functions your code calls, with the call path. These are the ones to fix first.
- Package results: your code imports the affected package but does not call the vulnerable function.
- Module results: a required module, or the standard library, has a vulnerability in a package you do not import.
The last two only appear as counts in the summary; -show verbose lists them.
Each finding has a Go ID (GO-2022-1059), the version you have and the first fixed version. The page under pkg.go.dev/vuln lists the CVE and GHSA aliases (CVE-2022-32149 and GHSA-69ch-w2m2-3vjp for this one).
For the full call stack of each finding:
govulncheck -show traces ./...
Fix what it finds
Upgrade the module to the fixed version or later, then tidy and test:
go get golang.org/x/text@v0.3.8
go mod tidy
go test ./...
govulncheck ./...
go get golang.org/x/text@latest takes the newest release, which also has the fixes of later advisories. Prefer it unless it breaks your build.
If the vulnerable module is only an indirect dependency, the same go get adds it to go.mod with the higher version (marked // indirect), and Go uses that version for the whole build, since minimal version selection picks the highest required version. There is no separate override file.
Standard library findings
Vulnerabilities in net/http, crypto/tls and the other standard packages are fixed by a newer Go release. govulncheck checks the source against the Go version on your PATH and names the release with the fix. As of November 2026, Go 1.27.3 has one such entry:
Vulnerability #1: GO-2026-6859
HTTP/1 server crash due to MaxBytesReader header race in net/http
More info: https://pkg.go.dev/vuln/GO-2026-6859
Standard library
Found in: stdlib@go1.27.3
Fixed in: stdlib@go1.27.4
Install that release (or set it with go get toolchain@go1.x.y if you use toolchain switching), then rebuild and redeploy every binary. A binary keeps the standard library it was built with. Updating Go on the build machine changes nothing on the server until the new binary is deployed.
Scan a compiled binary
On a server or in a container image you often have the binary and not the source. govulncheck reads the module list and symbol table that the Go linker writes into each binary:
govulncheck -mode=binary /usr/local/bin/myapp
Vulnerability #1: GO-2022-1059
...
Found in: golang.org/x/text@v0.3.7
Fixed in: golang.org/x/text@v0.3.8
Vulnerable symbols found:
#1: language.ParseAcceptLanguage
Binary mode cannot show call stacks, and it may report code that is in the binary but never runs. To see which module versions a binary was built with, without any database lookup:
go version -m /usr/local/bin/myapp
Run it in CI
govulncheck exits with a non-zero code when it finds vulnerabilities that affect your code, so a plain run fails the job (the exit code was 3 in the example above). With -format json, -format sarif or -format openvex it always exits 0; use those formats for reports and the text format for a pass or fail gate.
GitHub Actions has an official action:
name: govulncheck
on: [push, pull_request]
jobs:
govulncheck:
runs-on: ubuntu-latest
steps:
- uses: golang/govulncheck-action@v1
with:
go-version-input: "1.27.4"
go-package: ./...
Without go-version-input, the action installs the latest Go release. Set it to the version you build with, so that the standard library findings match your binaries.
In GitLab CI, use the Go image of the version you build with:
govulncheck:
image: golang:1.27.4-alpine3.24
script:
- go install golang.org/x/vuln/cmd/govulncheck@v1.10.0
- govulncheck ./...
New advisories appear on days when your code does not change. Add a scheduled run (on: schedule in GitHub Actions, a pipeline schedule in GitLab) so that a project without commits still gets checked.
Limits
govulncheck works from static analysis. The documentation lists what it cannot see:
- Calls through
reflectare invisible, so a reachable vulnerable function can be missed. - Code that uses
unsafecan produce false negatives. - Calls through function pointers and interfaces are treated conservatively, which can produce false positives.
- A finding you have reviewed cannot be silenced.
It also covers only Go code. C libraries linked with cgo and the packages of the operating system in your container image need their own scan; see /guides/scan-images-in-ci.
What leaves your machine
govulncheck downloads advisories from vuln.go.dev. According to the documentation, its requests contain only the module paths for which the database has entries, not your code. For builds without internet access, -db points it at another copy of the database in the same format.
The Patchbrief agent can read the go.mod files of the app paths you configure and checks the modules against new advisories every day, without the call analysis of govulncheck.
Sources
- govulncheck command documentation — flags, exit behaviour, binary mode, limitations, database requests
- Go vulnerability management — the Go vulnerability database and its sources
- golang/vuln tags — v1.10.0 as the latest release
- golang/govulncheck-action — inputs of the GitHub Action
- GO-2022-1059 — the golang.org/x/text advisory used in the example
Check your servers every day
The agent of Patchbrief reports the packages and settings of a server once a day; the digest names what to fix first.