0010-SAE-Fix-confirm-message-validation-in-error-cases.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. From ac8fa9ef198640086cf2ce7c94673be2b6a018a0 Mon Sep 17 00:00:00 2001
  2. From: Jouni Malinen <jouni@codeaurora.org>
  3. Date: Tue, 5 Mar 2019 23:43:25 +0200
  4. Subject: [PATCH 10/14] SAE: Fix confirm message validation in error cases
  5. Explicitly verify that own and peer commit scalar/element are available
  6. when trying to check SAE confirm message. It could have been possible to
  7. hit a NULL pointer dereference if the peer element could not have been
  8. parsed. (CVE-2019-9496)
  9. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
  10. ---
  11. src/common/sae.c | 14 +++++++++++---
  12. 1 file changed, 11 insertions(+), 3 deletions(-)
  13. diff --git a/src/common/sae.c b/src/common/sae.c
  14. index eaf825d..5a50294 100644
  15. --- a/src/common/sae.c
  16. +++ b/src/common/sae.c
  17. @@ -1487,23 +1487,31 @@ int sae_check_confirm(struct sae_data *sae, const u8 *data, size_t len)
  18. wpa_printf(MSG_DEBUG, "SAE: peer-send-confirm %u", WPA_GET_LE16(data));
  19. - if (sae->tmp == NULL) {
  20. + if (!sae->tmp || !sae->peer_commit_scalar ||
  21. + !sae->tmp->own_commit_scalar) {
  22. wpa_printf(MSG_DEBUG, "SAE: Temporary data not yet available");
  23. return -1;
  24. }
  25. - if (sae->tmp->ec)
  26. + if (sae->tmp->ec) {
  27. + if (!sae->tmp->peer_commit_element_ecc ||
  28. + !sae->tmp->own_commit_element_ecc)
  29. + return -1;
  30. sae_cn_confirm_ecc(sae, data, sae->peer_commit_scalar,
  31. sae->tmp->peer_commit_element_ecc,
  32. sae->tmp->own_commit_scalar,
  33. sae->tmp->own_commit_element_ecc,
  34. verifier);
  35. - else
  36. + } else {
  37. + if (!sae->tmp->peer_commit_element_ffc ||
  38. + !sae->tmp->own_commit_element_ffc)
  39. + return -1;
  40. sae_cn_confirm_ffc(sae, data, sae->peer_commit_scalar,
  41. sae->tmp->peer_commit_element_ffc,
  42. sae->tmp->own_commit_scalar,
  43. sae->tmp->own_commit_element_ffc,
  44. verifier);
  45. + }
  46. if (os_memcmp_const(verifier, data + 2, SHA256_MAC_LEN) != 0) {
  47. wpa_printf(MSG_DEBUG, "SAE: Confirm mismatch");
  48. --
  49. 2.7.4