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

Matt Caswell noreply at github.com
Thu Jan 25 15:34:47 UTC 2024


  Branch: refs/heads/openssl-3.1
  Home:   https://github.com/openssl/openssl
  Commit: d135eeab8a5dbf72b3da5240bab9ddb7678dbd2c
      https://github.com/openssl/openssl/commit/d135eeab8a5dbf72b3da5240bab9ddb7678dbd2c
  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/23362)


  Commit: febb086d0fc1ea12181f4d833aa9b8fdf2133b3b
      https://github.com/openssl/openssl/commit/febb086d0fc1ea12181f4d833aa9b8fdf2133b3b
  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/23362)


Compare: https://github.com/openssl/openssl/compare/960141346307...febb086d0fc1


More information about the openssl-commits mailing list