Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crypto/rand: Read hangs when passed buffer larger than 1<<32 - 1 [1.18 backport] #52933

Closed
gopherbot opened this issue May 16, 2022 · 4 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge Security
Milestone

Comments

@gopherbot
Copy link

@rolandshoemaker requested issue #52561 to be considered for backport to the next 1.18 minor release.

@gopherbot please open backport issues, this is a minor security issue.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label May 16, 2022
@gopherbot gopherbot added this to the Go1.18.3 milestone May 16, 2022
@gopherbot
Copy link
Author

Change https://go.dev/cl/406634 mentions this issue: [release-branch.go1.18 crypto/rand: properly handle large Read on windows

@toothrot toothrot added the CherryPickApproved Used during the release process for point releases label May 25, 2022
@toothrot
Copy link
Contributor

Approved. This is a serious issue with no workaround. @rolandshoemaker Does this need security text/labeling?

@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label May 25, 2022
@rolandshoemaker
Copy link
Member

@toothrot Yup, will follow-up OOB.

@gopherbot
Copy link
Author

Closed by merging 32dedaa to release-branch.go1.18.

gopherbot pushed a commit that referenced this issue May 25, 2022
…handle large Read on windows

Use the batched reader to chunk large Read calls on windows to a max of
1 << 31 - 1 bytes. This prevents an infinite loop when trying to read
more than 1 << 32 -1 bytes, due to how RtlGenRandom works.

This change moves the batched function from rand_unix.go to rand.go,
since it is now needed for both windows and unix implementations.

Updates #52561
Fixes #52933
Fixes CVE-2022-30634

Change-Id: Id98fc4b1427e5cb2132762a445b2aed646a37473
Reviewed-on: https://go-review.googlesource.com/c/go/+/402257
Run-TryBot: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Filippo Valsorda <valsorda@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit bb1f441)
Reviewed-on: https://go-review.googlesource.com/c/go/+/406634
Reviewed-by: Damien Neil <dneil@google.com>
@golang golang locked and limited conversation to collaborators Jun 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge Security
Projects
None yet
Development

No branches or pull requests

4 participants