GO-2023-2095

See a problem?
Source
https://pkg.go.dev/vuln/GO-2023-2095
Import Source
https://vuln.go.dev/ID/GO-2023-2095.json
JSON Data
https://api.osv.dev/v1/vulns/GO-2023-2095
Aliases
Published
2023-10-05T20:35:05Z
Modified
2024-05-20T16:03:47Z
Summary
Arbitrary code execution during build via line directives in cmd/go
Details

Line directives ("//line") can be used to bypass the restrictions on "//go:cgo_" directives, allowing blocked linker and compiler flags to be passed during compilation. This can result in unexpected execution of arbitrary code when running "go build". The line directive requires the absolute path of the file in which the directive lives, which makes exploiting this issue significantly more complex.

References

Affected packages

Go / toolchain

Package

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
1.20.9
Introduced
1.21.0-0
Fixed
1.21.2

Ecosystem specific

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