GO-2023-1842

See a problem?
Source
https://pkg.go.dev/vuln/GO-2023-1842
Import Source
https://vuln.go.dev/ID/GO-2023-1842.json
JSON Data
https://api.osv.dev/v1/vulns/GO-2023-1842
Aliases
Published
2023-06-08T20:15:53Z
Modified
2024-05-20T16:03:47Z
Summary
Improper sanitization of LDFLAGS with embedded spaces in go command with cgo in cmd/go
Details

The go command may execute arbitrary code at build time when using cgo. This may occur when running "go get" on a malicious module, or when running any other command which builds untrusted code. This is can by triggered by linker flags, specified via a "#cgo LDFLAGS" directive.

Flags containing embedded spaces are mishandled, allowing disallowed flags to be smuggled through the LDFLAGS sanitization by including them in the argument of another flag. This only affects usage of the gccgo compiler.

References
Credits
    • Juho Nurminen of Mattermost

Affected packages

Go / toolchain

Package

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
1.19.10
Introduced
1.20.0-0
Fixed
1.20.5

Ecosystem specific

{
    "imports": [
        {
            "path": "cmd/go"
        },
        {
            "path": "cmd/cgo"
        }
    ]
}