CVE-2022-41716 Unsanitized NUL in environment variables on Windows in syscall and os/exec

Medium 6.3 Published Updated

Attackers can inject environment variables on Windows via unsanitized NUL bytes in Go's os/exec and syscall packages.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-41716?

CVE-2022-41716 is a medium-severity vulnerability in Golang Go, published on 2 Nov 2022. Any signed-in user can exploit it over the network, with no action from the victim.

Official description

Due to unsanitized NUL values, attackers may be able to maliciously set environment variables on Windows. In syscall.StartProcess and os/exec.Cmd, invalid environment variable values containing NUL values are not properly checked for. A malicious environment variable value can exploit this behavior to set a value for a different environment variable. For example, the environment variable string "A=B\x00C=D" sets the variables "A=B" and "C=D".

Which versions are affected by CVE-2022-41716?

2 open source packages ship an affected version, including golang and stdlib. It affects 1 product.

PackageAffectedFixed in
golang BitnamiAll versions1.18.8, 1.19.3
stdlib GoAll versions1.18.8, 1.19.3
Linux distribution packages (10)
go1.18 SUSE:Linux Enterprise Module for Development Tools 15 SP3All versions1.18.8-150000.1.37.1
go1.19 SUSE:Linux Enterprise Module for Development Tools 15 SP3All versions1.19.3-150000.1.15.1
go1.18 SUSE:Linux Enterprise Module for Development Tools 15 SP4All versions1.18.8-150000.1.37.1
go1.19 SUSE:Linux Enterprise Module for Development Tools 15 SP4All versions1.19.3-150000.1.15.1
go1.18 openSUSE:Leap 15.3All versions1.18.8-150000.1.37.1
go1.19 openSUSE:Leap 15.3All versions1.19.3-150000.1.15.1
go1.18 openSUSE:Leap 15.4All versions1.18.8-150000.1.37.1
go1.19 openSUSE:Leap 15.4All versions1.19.3-150000.1.15.1
go1.18 openSUSE:TumbleweedAll versions1.18.8-1.1
go1.19 openSUSE:TumbleweedAll versions1.19.3-1.1

Products include Golang Go.

How do I fix CVE-2022-41716?

Upgrade golang to a fixed version for your release line: 1.18.8 or 1.19.3.

Is CVE-2022-41716 being exploited?

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

All Golang Go vulnerabilities

Sources

Also known as AZL-79026, AZL-98883, BIT-golang-2022-41716, DEBIAN-CVE-2022-41716, GHSA-mh68-qf2j-8c5g, GO-2022-1095 and 7 more.

Is CVE-2022-41716 in your software?

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

Check your SBOMs for free