[openssl/openssl] 041962: Add NULL checks where ContentInfo data can be NULL

Matt Caswell noreply at github.com
Thu Jan 25 15:31:59 UTC 2024


  Branch: refs/heads/master
  Home:   https://github.com/openssl/openssl
  Commit: 041962b429ebe748c8b6b7922980dfb6decfef26
      https://github.com/openssl/openssl/commit/041962b429ebe748c8b6b7922980dfb6decfef26
  Author: Matt Caswell <matt at openssl.org>
  Date:   2024-01-25 (Thu, 25 Jan 2024)

  Changed paths:
    M crypto/pkcs12/p12_add.c
    M crypto/pkcs12/p12_mutl.c
    M crypto/pkcs12/p12_npas.c
    M crypto/pkcs7/pk7_mime.c

  Log Message:
  -----------
  Add NULL checks where ContentInfo data can be NULL

PKCS12 structures contain PKCS7 ContentInfo fields. These fields are
optional and can be NULL even if the "type" is a valid value. OpenSSL
was not properly accounting for this and a NULL dereference can occur
causing a crash.

CVE-2024-0727

Reviewed-by: Tomas Mraz <tomas at openssl.org>
Reviewed-by: Hugo Landau <hlandau at openssl.org>
Reviewed-by: Neil Horman <nhorman at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23361)


  Commit: 8a85df7c60ba1372ee98acc5982e902d75f52130
      https://github.com/openssl/openssl/commit/8a85df7c60ba1372ee98acc5982e902d75f52130
  Author: Matt Caswell <matt at openssl.org>
  Date:   2024-01-25 (Thu, 25 Jan 2024)

  Changed paths:
    M test/recipes/80-test_pkcs12.t
    A test/recipes/80-test_pkcs12_data/bad1.p12
    A test/recipes/80-test_pkcs12_data/bad2.p12
    A test/recipes/80-test_pkcs12_data/bad3.p12

  Log Message:
  -----------
  Add some tests for various PKCS12 files with NULL ContentInfo

PKCS7 ContentInfo fields held within a PKCS12 file can be NULL, even if the
type has been set to a valid value. CVE-2024-0727 is a result of OpenSSL
attempting to dereference the NULL pointer as a result of this.

We add test for various instances of this problem.

Reviewed-by: Tomas Mraz <tomas at openssl.org>
Reviewed-by: Hugo Landau <hlandau at openssl.org>
Reviewed-by: Neil Horman <nhorman at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23361)


Compare: https://github.com/openssl/openssl/compare/72062fca2870...8a85df7c60ba


More information about the openssl-commits mailing list