CVE-2018-16874 Path traversal in golang

Medium 6.8 Published Updated

Attackers can exploit directory traversal in the Go 'go get' command to write arbitrary files and execute code when using GOPATH mode.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2018-16874?

CVE-2018-16874 is a medium-severity path traversal vulnerability in Debian Debian Linux, published on 14 Dec 2018. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

In Go before 1.10.6 and 1.11.x before 1.11.3, the "go get" command is vulnerable to directory traversal when executed with the import path of a malicious Go package which contains curly braces (both '{' and '}' characters). Specifically, it is only vulnerable in GOPATH mode, but not in module mode (the distinction is documented at https://golang.org/cmd/go/#hdr-Module_aware_go_get). The attacker can cause an arbitrary filesystem write, which can lead to code execution.

Weakness: CWE-22, CWE-20

Which versions are affected by CVE-2018-16874?

1 open source package ship an affected version, including toolchain. It affects 5 products.

PackageAffectedFixed in
toolchain GoAll versions1.10.6, 1.11.3

Products include Debian Debian Linux, Golang Go, Opensuse Backports Sle, Opensuse Leap, Suse Linux Enterprise Server.

How do I fix CVE-2018-16874?

Upgrade toolchain to a fixed version for your release line: 1.10.6 or 1.11.3.

Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.

Is CVE-2018-16874 being exploited?

There is no known exploitation of CVE-2018-16874 in the wild and no public exploit code.

All Debian Debian Linux vulnerabilities

Sources

Also known as GHSA-7p6h-w6m6-5fm2, GO-2022-0190, UBUNTU-CVE-2018-16874.

Is CVE-2018-16874 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free