Skip to content

crypto/rand: Legacy RtlGenRandom use on Windows #53192

Closed
@tolginator

Description

@tolginator

What version of Go are you using (go version)? 1.18.3 (Windows)

$ go version
go version go1.18.3 windows/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

Windows 10, x64

go env Output
$ go env

set GOARCH=amd64
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVERSION=go1.18.3
set GCCGO=gccgo
set GOAMD64=v1

What did you do?

I identified this issue in a security code review.

What did you expect to see?

Use a recommended Windows random number as specified in https://docs.microsoft.com/en-us/security/sdl/cryptographic-recommendations#random-number-generators.
Id recommend BCryptGenRandom with the BCRYPT_USE_SYSTEM_PREFERRED_RNG flag, and remove any calls to the RtlGenRandom API.

What did you see instead?

In file rand_windows.go, random numbers are generated by calling a legacy PRNG API, RtlGenRandom.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.OS-Windows

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions