VYPR
Medium severity5.5NVD Advisory· Published Jan 26, 2024· Updated May 12, 2026

CVE-2024-0727

CVE-2024-0727

Description

Issue summary: Processing a maliciously formatted PKCS12 file may lead OpenSSL to crash leading to a potential Denial of Service attack

Impact summary: Applications loading files in the PKCS12 format from untrusted sources might terminate abruptly.

A file in PKCS12 format can contain certificates and keys and may come from an untrusted source. The PKCS12 specification allows certain fields to be NULL, but OpenSSL does not correctly check for this case. This can lead to a NULL pointer dereference that results in OpenSSL crashing. If an application processes PKCS12 files from an untrusted source using the OpenSSL APIs then that application will be vulnerable to this issue.

OpenSSL APIs that are vulnerable to this are: PKCS12_parse(), PKCS12_unpack_p7data(), PKCS12_unpack_p7encdata(), PKCS12_unpack_authsafes() and PKCS12_newpass().

We have also fixed a similar issue in SMIME_write_PKCS7(). However since this function is related to writing data we do not consider it security significant.

The FIPS modules in 3.2, 3.1 and 3.0 are not affected by this issue.

Affected products

1

Patches

5
3519591d255d

bump openssl in CI (#10298)

https://github.com/pyca/cryptographyPaul KehrerJan 30, 2024via ghsa
2 files changed · +9 9
  • .github/actions/cache/action.yml+1 1 modified
    @@ -17,5 +17,5 @@ runs:
           shell: bash
         - uses: Swatinem/rust-cache@3cf7f8cc28d1b4e7d01e3783be10a97d55d483c8  # v2.7.1
           with:
    -        key: ${{ steps.normalized-key.outputs.key }}-1
    +        key: ${{ steps.normalized-key.outputs.key }}-2
             workspaces: "./src/rust/ -> target"
    
  • .github/workflows/ci.yml+8 8 modified
    @@ -29,17 +29,17 @@ jobs:
             PYTHON:
               - {VERSION: "3.12", NOXSESSION: "flake"}
               - {VERSION: "3.12", NOXSESSION: "rust"}
    -          - {VERSION: "3.12", NOXSESSION: "docs", OPENSSL: {TYPE: "openssl", VERSION: "3.2.0"}}
    +          - {VERSION: "3.12", NOXSESSION: "docs", OPENSSL: {TYPE: "openssl", VERSION: "3.2.1"}}
               - {VERSION: "pypy-3.9", NOXSESSION: "tests-nocoverage"}
               - {VERSION: "pypy-3.10", NOXSESSION: "tests-nocoverage"}
               - {VERSION: "3.12", NOXSESSION: "tests", OPENSSL: {TYPE: "openssl", VERSION: "1.1.1w"}}
    -          - {VERSION: "3.12", NOXSESSION: "tests", OPENSSL: {TYPE: "openssl", VERSION: "3.0.12"}}
    -          - {VERSION: "3.12", NOXSESSION: "tests", OPENSSL: {TYPE: "openssl", VERSION: "3.1.4"}}
    -          - {VERSION: "3.12", NOXSESSION: "tests-ssh", OPENSSL: {TYPE: "openssl", VERSION: "3.2.0"}}
    -          - {VERSION: "3.12", NOXSESSION: "tests", OPENSSL: {TYPE: "openssl", VERSION: "3.2.0", CONFIG_FLAGS: "no-engine no-rc2 no-srtp no-ct no-psk"}}
    -          - {VERSION: "3.12", NOXSESSION: "tests", OPENSSL: {TYPE: "openssl", VERSION: "3.2.0", CONFIG_FLAGS: "no-legacy", NO_LEGACY: "1"}}
    -          - {VERSION: "3.12", NOXSESSION: "tests", NOXARGS: "--enable-fips=1", OPENSSL: {TYPE: "openssl", CONFIG_FLAGS: "enable-fips", VERSION: "3.1.4"}}
    -          - {VERSION: "3.12", NOXSESSION: "tests", NOXARGS: "--enable-fips=1", OPENSSL: {TYPE: "openssl", CONFIG_FLAGS: "enable-fips", VERSION: "3.2.0"}}
    +          - {VERSION: "3.12", NOXSESSION: "tests", OPENSSL: {TYPE: "openssl", VERSION: "3.0.13"}}
    +          - {VERSION: "3.12", NOXSESSION: "tests", OPENSSL: {TYPE: "openssl", VERSION: "3.1.5"}}
    +          - {VERSION: "3.12", NOXSESSION: "tests-ssh", OPENSSL: {TYPE: "openssl", VERSION: "3.2.1"}}
    +          - {VERSION: "3.12", NOXSESSION: "tests", OPENSSL: {TYPE: "openssl", VERSION: "3.2.1", CONFIG_FLAGS: "no-engine no-rc2 no-srtp no-ct no-psk"}}
    +          - {VERSION: "3.12", NOXSESSION: "tests", OPENSSL: {TYPE: "openssl", VERSION: "3.2.1", CONFIG_FLAGS: "no-legacy", NO_LEGACY: "1"}}
    +          - {VERSION: "3.12", NOXSESSION: "tests", NOXARGS: "--enable-fips=1", OPENSSL: {TYPE: "openssl", CONFIG_FLAGS: "enable-fips", VERSION: "3.1.5"}}
    +          - {VERSION: "3.12", NOXSESSION: "tests", NOXARGS: "--enable-fips=1", OPENSSL: {TYPE: "openssl", CONFIG_FLAGS: "enable-fips", VERSION: "3.2.1"}}
               - {VERSION: "3.12", NOXSESSION: "tests", OPENSSL: {TYPE: "libressl", VERSION: "3.8.2"}}
               - {VERSION: "3.12", NOXSESSION: "tests-randomorder"}
               # Latest commit on the BoringSSL master branch, as of Jan 30, 2024.
    
add20f73b6b4

Bump OpenSSL to 3.2.1 (#229)

https://github.com/alexcrichton/openssl-src-rsAlex CrichtonJan 30, 2024via ghsa
3 files changed · +14 4
  • Cargo.toml+2 1 modified
    @@ -1,10 +1,11 @@
     [package]
     name = "openssl-src"
    -version = "300.2.1+3.2.0"
    +version = "300.2.2+3.2.1"
     authors = ["Alex Crichton <alex@alexcrichton.com>"]
     license = "MIT/Apache-2.0"
     readme = "README.md"
     repository = "https://github.com/alexcrichton/openssl-src-rs"
    +edition = "2021"
     description = """
     Source of OpenSSL and logic to build it.
     """
    
  • openssl+1 1 modified
    @@ -1 +1 @@
    -Subproject commit cf2877791ce7508684109664f467c9e40987692f
    +Subproject commit a7e992847de83aa36be0c399c89db3fb827b0be2
    
  • src/lib.rs+11 2 modified
    @@ -636,12 +636,21 @@ fn cp_r(src: &Path, dst: &Path) {
             }
     
             let dst = dst.join(name);
    -        if f.file_type().unwrap().is_dir() {
    +        let ty = f.file_type().unwrap();
    +        if ty.is_dir() {
                 fs::create_dir_all(&dst).unwrap();
                 cp_r(&path, &dst);
    +        } else if ty.is_symlink() {
    +            // not needed to build
    +            if path.iter().any(|p| p == "cloudflare-quiche") {
    +                continue;
    +            }
    +            panic!("can't copy symlink {path:?}");
             } else {
                 let _ = fs::remove_file(&dst);
    -            fs::copy(&path, &dst).unwrap();
    +            if let Err(e) = fs::copy(&path, &dst) {
    +                panic!("failed to copy {path:?} to {dst:?}: {e}");
    +            }
             }
         }
     }
    
d135eeab8a5d

Add NULL checks where ContentInfo data can be NULL

https://github.com/openssl/opensslMatt CaswellJan 19, 2024via ghsa
4 files changed · +31 4
  • crypto/pkcs12/p12_add.c+18 0 modified
    @@ -78,6 +78,12 @@ STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7)
             ERR_raise(ERR_LIB_PKCS12, PKCS12_R_CONTENT_TYPE_NOT_DATA);
             return NULL;
         }
    +
    +    if (p7->d.data == NULL) {
    +        ERR_raise(ERR_LIB_PKCS12, PKCS12_R_DECODE_ERROR);
    +        return NULL;
    +    }
    +
         return ASN1_item_unpack(p7->d.data, ASN1_ITEM_rptr(PKCS12_SAFEBAGS));
     }
     
    @@ -150,6 +156,12 @@ STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass,
     {
         if (!PKCS7_type_is_encrypted(p7))
             return NULL;
    +
    +    if (p7->d.encrypted == NULL) {
    +        ERR_raise(ERR_LIB_PKCS12, PKCS12_R_DECODE_ERROR);
    +        return NULL;
    +    }
    +
         return PKCS12_item_decrypt_d2i_ex(p7->d.encrypted->enc_data->algorithm,
                                        ASN1_ITEM_rptr(PKCS12_SAFEBAGS),
                                        pass, passlen,
    @@ -188,6 +200,12 @@ STACK_OF(PKCS7) *PKCS12_unpack_authsafes(const PKCS12 *p12)
             ERR_raise(ERR_LIB_PKCS12, PKCS12_R_CONTENT_TYPE_NOT_DATA);
             return NULL;
         }
    +
    +    if (p12->authsafes->d.data == NULL) {
    +        ERR_raise(ERR_LIB_PKCS12, PKCS12_R_DECODE_ERROR);
    +        return NULL;
    +    }
    +
         p7s = ASN1_item_unpack(p12->authsafes->d.data,
                                ASN1_ITEM_rptr(PKCS12_AUTHSAFES));
         if (p7s != NULL) {
    
  • crypto/pkcs12/p12_mutl.c+5 0 modified
    @@ -98,6 +98,11 @@ static int pkcs12_gen_mac(PKCS12 *p12, const char *pass, int passlen,
             return 0;
         }
     
    +    if (p12->authsafes->d.data == NULL) {
    +        ERR_raise(ERR_LIB_PKCS12, PKCS12_R_DECODE_ERROR);
    +        return 0;
    +    }
    +
         salt = p12->mac->salt->data;
         saltlen = p12->mac->salt->length;
         if (p12->mac->iter == NULL)
    
  • crypto/pkcs12/p12_npas.c+3 2 modified
    @@ -77,8 +77,9 @@ static int newpass_p12(PKCS12 *p12, const char *oldpass, const char *newpass)
                 bags = PKCS12_unpack_p7data(p7);
             } else if (bagnid == NID_pkcs7_encrypted) {
                 bags = PKCS12_unpack_p7encdata(p7, oldpass, -1);
    -            if (!alg_get(p7->d.encrypted->enc_data->algorithm,
    -                         &pbe_nid, &pbe_iter, &pbe_saltlen))
    +            if (p7->d.encrypted == NULL
    +                    || !alg_get(p7->d.encrypted->enc_data->algorithm,
    +                                &pbe_nid, &pbe_iter, &pbe_saltlen))
                     goto err;
             } else {
                 continue;
    
  • crypto/pkcs7/pk7_mime.c+5 2 modified
    @@ -33,10 +33,13 @@ int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags)
         int ctype_nid = OBJ_obj2nid(p7->type);
         const PKCS7_CTX *ctx = ossl_pkcs7_get0_ctx(p7);
     
    -    if (ctype_nid == NID_pkcs7_signed)
    +    if (ctype_nid == NID_pkcs7_signed) {
    +        if (p7->d.sign == NULL)
    +            return 0;
             mdalgs = p7->d.sign->md_algs;
    -    else
    +    } else {
             mdalgs = NULL;
    +    }
     
         flags ^= SMIME_OLDMIME;
     
    
775acfdbd0c6

Add NULL checks where ContentInfo data can be NULL

https://github.com/openssl/opensslMatt CaswellJan 19, 2024via ghsa
4 files changed · +31 4
  • crypto/pkcs12/p12_add.c+18 0 modified
    @@ -78,6 +78,12 @@ STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7)
             ERR_raise(ERR_LIB_PKCS12, PKCS12_R_CONTENT_TYPE_NOT_DATA);
             return NULL;
         }
    +
    +    if (p7->d.data == NULL) {
    +        ERR_raise(ERR_LIB_PKCS12, PKCS12_R_DECODE_ERROR);
    +        return NULL;
    +    }
    +
         return ASN1_item_unpack_ex(p7->d.data, ASN1_ITEM_rptr(PKCS12_SAFEBAGS),
                                    ossl_pkcs7_ctx_get0_libctx(&p7->ctx),
                                    ossl_pkcs7_ctx_get0_propq(&p7->ctx));
    @@ -152,6 +158,12 @@ STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass,
     {
         if (!PKCS7_type_is_encrypted(p7))
             return NULL;
    +
    +    if (p7->d.encrypted == NULL) {
    +        ERR_raise(ERR_LIB_PKCS12, PKCS12_R_DECODE_ERROR);
    +        return NULL;
    +    }
    +
         return PKCS12_item_decrypt_d2i_ex(p7->d.encrypted->enc_data->algorithm,
                                        ASN1_ITEM_rptr(PKCS12_SAFEBAGS),
                                        pass, passlen,
    @@ -191,6 +203,12 @@ STACK_OF(PKCS7) *PKCS12_unpack_authsafes(const PKCS12 *p12)
             ERR_raise(ERR_LIB_PKCS12, PKCS12_R_CONTENT_TYPE_NOT_DATA);
             return NULL;
         }
    +
    +    if (p12->authsafes->d.data == NULL) {
    +        ERR_raise(ERR_LIB_PKCS12, PKCS12_R_DECODE_ERROR);
    +        return NULL;
    +    }
    +
         p7ctx = &p12->authsafes->ctx;
         p7s = ASN1_item_unpack_ex(p12->authsafes->d.data,
                                   ASN1_ITEM_rptr(PKCS12_AUTHSAFES),
    
  • crypto/pkcs12/p12_mutl.c+5 0 modified
    @@ -98,6 +98,11 @@ static int pkcs12_gen_mac(PKCS12 *p12, const char *pass, int passlen,
             return 0;
         }
     
    +    if (p12->authsafes->d.data == NULL) {
    +        ERR_raise(ERR_LIB_PKCS12, PKCS12_R_DECODE_ERROR);
    +        return 0;
    +    }
    +
         salt = p12->mac->salt->data;
         saltlen = p12->mac->salt->length;
         if (p12->mac->iter == NULL)
    
  • crypto/pkcs12/p12_npas.c+3 2 modified
    @@ -80,8 +80,9 @@ static int newpass_p12(PKCS12 *p12, const char *oldpass, const char *newpass)
                 bags = PKCS12_unpack_p7data(p7);
             } else if (bagnid == NID_pkcs7_encrypted) {
                 bags = PKCS12_unpack_p7encdata(p7, oldpass, -1);
    -            if (!alg_get(p7->d.encrypted->enc_data->algorithm,
    -                         &pbe_nid, &pbe_iter, &pbe_saltlen, &cipherid))
    +            if (p7->d.encrypted == NULL
    +                    || !alg_get(p7->d.encrypted->enc_data->algorithm,
    +                                &pbe_nid, &pbe_iter, &pbe_saltlen, &cipherid))
                     goto err;
             } else {
                 continue;
    
  • crypto/pkcs7/pk7_mime.c+5 2 modified
    @@ -33,10 +33,13 @@ int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags)
         int ctype_nid = OBJ_obj2nid(p7->type);
         const PKCS7_CTX *ctx = ossl_pkcs7_get0_ctx(p7);
     
    -    if (ctype_nid == NID_pkcs7_signed)
    +    if (ctype_nid == NID_pkcs7_signed) {
    +        if (p7->d.sign == NULL)
    +            return 0;
             mdalgs = p7->d.sign->md_algs;
    -    else
    +    } else {
             mdalgs = NULL;
    +    }
     
         flags ^= SMIME_OLDMIME;
     
    
09df4395b507

Add NULL checks where ContentInfo data can be NULL

https://github.com/openssl/opensslMatt CaswellJan 19, 2024via ghsa
4 files changed · +31 4
  • crypto/pkcs12/p12_add.c+18 0 modified
    @@ -78,6 +78,12 @@ STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7)
             ERR_raise(ERR_LIB_PKCS12, PKCS12_R_CONTENT_TYPE_NOT_DATA);
             return NULL;
         }
    +
    +    if (p7->d.data == NULL) {
    +        ERR_raise(ERR_LIB_PKCS12, PKCS12_R_DECODE_ERROR);
    +        return NULL;
    +    }
    +
         return ASN1_item_unpack(p7->d.data, ASN1_ITEM_rptr(PKCS12_SAFEBAGS));
     }
     
    @@ -150,6 +156,12 @@ STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass,
     {
         if (!PKCS7_type_is_encrypted(p7))
             return NULL;
    +
    +    if (p7->d.encrypted == NULL) {
    +        ERR_raise(ERR_LIB_PKCS12, PKCS12_R_DECODE_ERROR);
    +        return NULL;
    +    }
    +
         return PKCS12_item_decrypt_d2i_ex(p7->d.encrypted->enc_data->algorithm,
                                        ASN1_ITEM_rptr(PKCS12_SAFEBAGS),
                                        pass, passlen,
    @@ -188,6 +200,12 @@ STACK_OF(PKCS7) *PKCS12_unpack_authsafes(const PKCS12 *p12)
             ERR_raise(ERR_LIB_PKCS12, PKCS12_R_CONTENT_TYPE_NOT_DATA);
             return NULL;
         }
    +
    +    if (p12->authsafes->d.data == NULL) {
    +        ERR_raise(ERR_LIB_PKCS12, PKCS12_R_DECODE_ERROR);
    +        return NULL;
    +    }
    +
         p7s = ASN1_item_unpack(p12->authsafes->d.data,
                                ASN1_ITEM_rptr(PKCS12_AUTHSAFES));
         if (p7s != NULL) {
    
  • crypto/pkcs12/p12_mutl.c+5 0 modified
    @@ -98,6 +98,11 @@ static int pkcs12_gen_mac(PKCS12 *p12, const char *pass, int passlen,
             return 0;
         }
     
    +    if (p12->authsafes->d.data == NULL) {
    +        ERR_raise(ERR_LIB_PKCS12, PKCS12_R_DECODE_ERROR);
    +        return 0;
    +    }
    +
         salt = p12->mac->salt->data;
         saltlen = p12->mac->salt->length;
         if (p12->mac->iter == NULL)
    
  • crypto/pkcs12/p12_npas.c+3 2 modified
    @@ -77,8 +77,9 @@ static int newpass_p12(PKCS12 *p12, const char *oldpass, const char *newpass)
                 bags = PKCS12_unpack_p7data(p7);
             } else if (bagnid == NID_pkcs7_encrypted) {
                 bags = PKCS12_unpack_p7encdata(p7, oldpass, -1);
    -            if (!alg_get(p7->d.encrypted->enc_data->algorithm,
    -                         &pbe_nid, &pbe_iter, &pbe_saltlen))
    +            if (p7->d.encrypted == NULL
    +                    || !alg_get(p7->d.encrypted->enc_data->algorithm,
    +                                &pbe_nid, &pbe_iter, &pbe_saltlen))
                     goto err;
             } else {
                 continue;
    
  • crypto/pkcs7/pk7_mime.c+5 2 modified
    @@ -33,10 +33,13 @@ int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags)
         int ctype_nid = OBJ_obj2nid(p7->type);
         const PKCS7_CTX *ctx = ossl_pkcs7_get0_ctx(p7);
     
    -    if (ctype_nid == NID_pkcs7_signed)
    +    if (ctype_nid == NID_pkcs7_signed) {
    +        if (p7->d.sign == NULL)
    +            return 0;
             mdalgs = p7->d.sign->md_algs;
    -    else
    +    } else {
             mdalgs = NULL;
    +    }
     
         flags ^= SMIME_OLDMIME;
     
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

22

News mentions

0

No linked articles in our index yet.