-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
mbedtls_debug_print_mpi crashes on 0 #4608
Labels
Comments
gilles-peskine-arm
added a commit
to gilles-peskine-arm/mbedtls
that referenced
this issue
Jun 2, 2021
Rewrite mbedtls_debug_print_mpi to be simpler and smaller. Leverage mbedtls_mpi_bitlen() instead of manually looking for the leading zeros. Fix Mbed-TLS#4608: the old code made an invalid memory dereference when X->n==0 (freshly initialized bignum with the value 0). Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This was referenced Jun 2, 2021
Fix posted in #4604. I'll make backports once it's been reviewed. |
This was referenced Jun 7, 2021
gilles-peskine-arm
added a commit
to gilles-peskine-arm/mbedtls
that referenced
this issue
Jun 7, 2021
Rewrite mbedtls_debug_print_mpi to be simpler and smaller. Leverage mbedtls_mpi_bitlen() instead of manually looking for the leading zeros. Fix Mbed-TLS#4608: the old code made an invalid memory dereference when X->n==0 (freshly initialized bignum with the value 0). Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
gilles-peskine-arm
added a commit
to gilles-peskine-arm/mbedtls
that referenced
this issue
Jun 17, 2021
Rewrite mbedtls_debug_print_mpi to be simpler and smaller. Leverage mbedtls_mpi_bitlen() instead of manually looking for the leading zeros. Fix Mbed-TLS#4608: the old code made an invalid memory dereference when X->n==0 (freshly initialized bignum with the value 0). Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
gilles-peskine-arm
added a commit
to gilles-peskine-arm/mbedtls
that referenced
this issue
Jun 21, 2021
Rewrite mbedtls_debug_print_mpi to be simpler and smaller. Leverage mbedtls_mpi_bitlen() instead of manually looking for the leading zeros. Fix Mbed-TLS#4608: the old code made an invalid memory dereference when X->n==0 (freshly initialized bignum with the value 0). Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
jepaan
added a commit
to LogosDesignAS/mbedtls
that referenced
this issue
Jun 24, 2021
Rewrite mbedtls_debug_print_mpi to be simpler and smaller. Leverage mbedtls_mpi_bitlen() instead of manually looking for the leading zeros. Fix Mbed-TLS#4608: the old code made an invalid memory dereference when X->n==0 (freshly initialized bignum with the value 0). Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com> (cherry picked from commit 2ee0bb3)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This bug was originally reported by @lhuang04 in #4578. I'm creating an issue to facilitate tracking.
Steps to reproduce (confirmed at 72dcd4e, but I think the TLS/x25519 part has existed ever since TLS started supporting x52219 and the debug_mpi part since PolarSSL):
Expected behavior: a TLS connection happens normally, using x25519 for the key exchange.
Actual behavior:
An UBSan or Msan build gives a backtrace:
As analyzed by @lhuang04,
mbedtls_debug_print_mpi
does not correctly handle the case of an MPI such thatX->n == 0
, which is a valid representation of 0.In addition,
mbedtls_debug_print_ecp
shouldn't be printing 0 here, but that's more of a cosmetic issue.The text was updated successfully, but these errors were encountered: