CVE-2022-41716 Unsanitized NUL in environment variables on Windows in syscall and os/exec
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.
| Package | Affected | Fixed in |
|---|---|---|
golang Bitnami | All versions | 1.18.8, 1.19.3 |
stdlib Go | All versions | 1.18.8, 1.19.3 |
Linux distribution packages (10)
go1.18 SUSE:Linux Enterprise Module for Development Tools 15 SP3 | All versions | 1.18.8-150000.1.37.1 |
go1.19 SUSE:Linux Enterprise Module for Development Tools 15 SP3 | All versions | 1.19.3-150000.1.15.1 |
go1.18 SUSE:Linux Enterprise Module for Development Tools 15 SP4 | All versions | 1.18.8-150000.1.37.1 |
go1.19 SUSE:Linux Enterprise Module for Development Tools 15 SP4 | All versions | 1.19.3-150000.1.15.1 |
go1.18 openSUSE:Leap 15.3 | All versions | 1.18.8-150000.1.37.1 |
go1.19 openSUSE:Leap 15.3 | All versions | 1.19.3-150000.1.15.1 |
go1.18 openSUSE:Leap 15.4 | All versions | 1.18.8-150000.1.37.1 |
go1.19 openSUSE:Leap 15.4 | All versions | 1.19.3-150000.1.15.1 |
go1.18 openSUSE:Tumbleweed | All versions | 1.18.8-1.1 |
go1.19 openSUSE:Tumbleweed | All versions | 1.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.
Other vulnerabilities in Golang Go
- CVE-2020-0601 Microsoft Windows CryptoAPI Spoofing
- CVE-2026-27143 Missing bound checks can lead to memory corruption in safe Go in cmd/compile
- CVE-2024-24790 Unexpected behavior from Is methods for IPv4-mapped IPv6 addresses in net/netip
- CVE-2023-39320 Arbitrary code execution via go.mod toolchain directive in cmd/go
- CVE-2023-24540 Improper handling of JavaScript whitespace in html/template
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.