-
Notifications
You must be signed in to change notification settings - Fork 18k
x/crypto/chacha20: panic with valid counter value #37157
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
Labels
Milestone
Comments
CC @FiloSottile |
Change https://golang.org/cl/220591 mentions this issue: |
Change https://golang.org/cl/224279 mentions this issue: |
Change https://golang.org/cl/229119 mentions this issue: |
c-expert-zigbee
pushed a commit
to c-expert-zigbee/crypto_go
that referenced
this issue
Mar 28, 2022
Certain operations with counter values close to overflowing were causing an unnecessary panic, which was reachable due to the SetCounter API and actually observed in QUIC. Tests by lukechampine <luke.champine@gmail.com> from CL 220591. Fixes golang/go#37157 Change-Id: Iba52edb1ba36af391b8fe4ee615c5c41d7e64f48 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/224279 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
c-expert-zigbee
pushed a commit
to c-expert-zigbee/crypto_go
that referenced
this issue
Mar 28, 2022
Certain operations with counter values close to overflowing were causing an unnecessary panic, which was reachable due to the SetCounter API and actually observed in QUIC. Tests by lukechampine <luke.champine@gmail.com> from CL 220591. Fixes golang/go#37157 Relanding of CL 224279, which was broken on multi-block buffers. Reviewed-on: https://go-review.googlesource.com/c/crypto/+/224279 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org> Change-Id: Ia382c6f62ae49ffe257b67f7b794e8d7124d981e (cherry picked from commit 1c2c788) Reviewed-on: https://go-review.googlesource.com/c/crypto/+/229119 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
c-expert-zigbee
added a commit
to c-expert-zigbee/crypto_go
that referenced
this issue
Mar 29, 2022
Certain operations with counter values close to overflowing were causing an unnecessary panic, which was reachable due to the SetCounter API and actually observed in QUIC. Tests by lukechampine <luke.champine@gmail.com> from CL 220591. Fixes golang/go#37157 Change-Id: Iba52edb1ba36af391b8fe4ee615c5c41d7e64f48 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/224279 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
c-expert-zigbee
added a commit
to c-expert-zigbee/crypto_go
that referenced
this issue
Mar 29, 2022
Certain operations with counter values close to overflowing were causing an unnecessary panic, which was reachable due to the SetCounter API and actually observed in QUIC. Tests by lukechampine <luke.champine@gmail.com> from CL 220591. Fixes golang/go#37157 Relanding of CL 224279, which was broken on multi-block buffers. Reviewed-on: https://go-review.googlesource.com/c/crypto/+/224279 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org> Change-Id: Ia382c6f62ae49ffe257b67f7b794e8d7124d981e (cherry picked from commit 1c2c788) Reviewed-on: https://go-review.googlesource.com/c/crypto/+/229119 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
c-expert-zigbee
added a commit
to c-expert-zigbee/crypto_go
that referenced
this issue
Mar 29, 2022
Certain operations with counter values close to overflowing were causing an unnecessary panic, which was reachable due to the SetCounter API and actually observed in QUIC. Tests by lukechampine <luke.champine@gmail.com> from CL 220591. Fixes golang/go#37157 Change-Id: Iba52edb1ba36af391b8fe4ee615c5c41d7e64f48 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/224279 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
c-expert-zigbee
added a commit
to c-expert-zigbee/crypto_go
that referenced
this issue
Mar 29, 2022
Certain operations with counter values close to overflowing were causing an unnecessary panic, which was reachable due to the SetCounter API and actually observed in QUIC. Tests by lukechampine <luke.champine@gmail.com> from CL 220591. Fixes golang/go#37157 Relanding of CL 224279, which was broken on multi-block buffers. Reviewed-on: https://go-review.googlesource.com/c/crypto/+/224279 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org> Change-Id: Ia382c6f62ae49ffe257b67f7b794e8d7124d981e (cherry picked from commit 1c2c788) Reviewed-on: https://go-review.googlesource.com/c/crypto/+/229119 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
LewiGoddard
pushed a commit
to LewiGoddard/crypto
that referenced
this issue
Feb 16, 2023
Certain operations with counter values close to overflowing were causing an unnecessary panic, which was reachable due to the SetCounter API and actually observed in QUIC. Tests by lukechampine <luke.champine@gmail.com> from CL 220591. Fixes golang/go#37157 Change-Id: Iba52edb1ba36af391b8fe4ee615c5c41d7e64f48 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/224279 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
LewiGoddard
pushed a commit
to LewiGoddard/crypto
that referenced
this issue
Feb 16, 2023
Certain operations with counter values close to overflowing were causing an unnecessary panic, which was reachable due to the SetCounter API and actually observed in QUIC. Tests by lukechampine <luke.champine@gmail.com> from CL 220591. Fixes golang/go#37157 Relanding of CL 224279, which was broken on multi-block buffers. Reviewed-on: https://go-review.googlesource.com/c/crypto/+/224279 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org> Change-Id: Ia382c6f62ae49ffe257b67f7b794e8d7124d981e (cherry picked from commit 0b689e6) Reviewed-on: https://go-review.googlesource.com/c/crypto/+/229119 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
BiiChris
pushed a commit
to BiiChris/crypto
that referenced
this issue
Sep 15, 2023
Certain operations with counter values close to overflowing were causing an unnecessary panic, which was reachable due to the SetCounter API and actually observed in QUIC. Tests by lukechampine <luke.champine@gmail.com> from CL 220591. Fixes golang/go#37157 Change-Id: Iba52edb1ba36af391b8fe4ee615c5c41d7e64f48 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/224279 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
BiiChris
pushed a commit
to BiiChris/crypto
that referenced
this issue
Sep 15, 2023
Certain operations with counter values close to overflowing were causing an unnecessary panic, which was reachable due to the SetCounter API and actually observed in QUIC. Tests by lukechampine <luke.champine@gmail.com> from CL 220591. Fixes golang/go#37157 Relanding of CL 224279, which was broken on multi-block buffers. Reviewed-on: https://go-review.googlesource.com/c/crypto/+/224279 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org> Change-Id: Ia382c6f62ae49ffe257b67f7b794e8d7124d981e (cherry picked from commit 1c2c788) Reviewed-on: https://go-review.googlesource.com/c/crypto/+/229119 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
desdeel2d0m
added a commit
to desdeel2d0m/crypto
that referenced
this issue
Jul 1, 2024
Certain operations with counter values close to overflowing were causing an unnecessary panic, which was reachable due to the SetCounter API and actually observed in QUIC. Tests by lukechampine <luke.champine@gmail.com> from CL 220591. Fixes golang/go#37157 Change-Id: Iba52edb1ba36af391b8fe4ee615c5c41d7e64f48 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/224279 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
desdeel2d0m
added a commit
to desdeel2d0m/crypto
that referenced
this issue
Jul 1, 2024
Certain operations with counter values close to overflowing were causing an unnecessary panic, which was reachable due to the SetCounter API and actually observed in QUIC. Tests by lukechampine <luke.champine@gmail.com> from CL 220591. Fixes golang/go#37157 Relanding of CL 224279, which was broken on multi-block buffers. Reviewed-on: https://go-review.googlesource.com/c/crypto/+/224279 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org> Change-Id: Ia382c6f62ae49ffe257b67f7b794e8d7124d981e (cherry picked from commit 78fe84a) Reviewed-on: https://go-review.googlesource.com/c/crypto/+/229119 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
What version of Go are you using (
go version
)?Go 1.13.7
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?darwin/amd64
What did you do?
Ran the following test, which reproduces the panic.
Note that this test uses the pending CL golang/crypto#108, which adds the SetCounter method to x/crypto/chacha20. While the panic on the last valid counter value, 2^32-1, is present in the current x/crypto/chacha20, it's unlikley to be hit in typical use as the counter value cannot be set and always starts at 0.
Background:
IETF ChaCha20 allows 2^32 blocks: https://tools.ietf.org/html/rfc7539#section-2.3.2.
IETF QUIC ChaCha20-based header protection, https://tools.ietf.org/html/draft-ietf-quic-tls-24#section-5.4.4, initializes the ChaCha20 counter with "4 bytes of [...] sampled ciphertext", so it's possible to have any counter value in [0, 2^32-1] and attempt to encrypt one block.
We hit this panic in production while using https://github.com/lucas-clemente/quic-go, which uses a recent fork of x/crypto/internal/chacha20 that exposes a function to set the counter value.
Related issue: quic-go/quic-go#2326.
What did you expect to see?
Successful test run.
What did you see instead?
Here is a fix implemented by @lukechampine: lukechampine/crypto@d3e589b (briefly discussed here: golang/crypto#108 (comment)).
The text was updated successfully, but these errors were encountered: