]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.19] syscall, os/exec: reject environment variables containing...
authorDamien Neil <dneil@google.com>
Tue, 18 Oct 2022 00:38:29 +0000 (17:38 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 1 Nov 2022 16:15:30 +0000 (16:15 +0000)
commit2a7adf4ccde9734becf41acf8274d1a190f2ec64
tree898877ff89ef6f963f42010266f4cd2e8e7375f2
parent0618956b31e11072fcc21c8e9488a7a731482c0b
[release-branch.go1.19] syscall, os/exec: reject environment variables containing NULs

Check for and reject environment variables containing NULs.

The conventions for passing environment variables to subprocesses
cause most or all systems to interpret a NUL as a separator. The
syscall package rejects environment variables containing a NUL
on most systems, but erroneously did not do so on Windows. This
causes an environment variable such as "FOO=a\x00BAR=b" to be
interpreted as "FOO=a", "BAR=b".

Check for and reject NULs in environment variables passed to
syscall.StartProcess on Windows.

Add a redundant check to os/exec as extra insurance.

Updates #56284
Fixes #56328
Fixes CVE-2022-41716

Change-Id: I2950e2b0cb14ebd26e5629be1521858f66a7d4ae
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1609434
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Roland Shoemaker <bracewell@google.com>
TryBot-Result: Security TryBots <security-trybots@go-security-trybots.iam.gserviceaccount.com>
(cherry picked from commit 845accdebb2772c5344ed0c96df9910f3b02d741)
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1617553
Run-TryBot: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/446879
Reviewed-by: Tatiana Bradley <tatiana@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/os/exec/env_test.go
src/os/exec/exec.go
src/os/exec/exec_test.go
src/syscall/exec_windows.go