openpgp/elgamal: fix index out of range panic in Decrypt when ciphertext is zero#348
openpgp/elgamal: fix index out of range panic in Decrypt when ciphertext is zero#348nasaa0x wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
30493ae to
dcecbae
Compare
|
This PR (HEAD: dcecbae) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/crypto/+/786500. Important tips:
|
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/786500. |
|
Message from Gopher Robot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be During May-July and Nov-Jan the Go project is in a code freeze, during which Please don’t reply on this GitHub thread. Visit golang.org/cl/786500. |
|
Message from Nasanbat: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/786500. |
|
Message from Alan Donovan: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/786500. |
|
Message from Nasanbat: Patch Set 3: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/786500. |
|
Message from Nasanbat: Patch Set 3: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/786500. |
Decrypt panics when the recovered value s equals zero because
s.Bytes() returns an empty slice and em[0] is indexed without
a bounds check.
An attacker can force s=0 by supplying c2=0 in a crafted
OpenPGP PKESK packet, causing a denial of service.
Fix: check len(em) == 0 before indexing and return an error.
Fixes golang/go#79841
Fixes: https://issuetracker.google.com/issues/519383708