Skip to content

Commit

Permalink
In PKINIT, check for null PKCS7 enveloped fields
Browse files Browse the repository at this point in the history
The PKCS7 ContentInfo content field and EncryptedContentInfo
encryptedContent field are optional.  Check for null values in
cms_envelopeddata_verify() before calling pkcs7_decrypt().  Reported
by Bahaa Naamneh.

ticket: 9107 (new)
tags: pullup
target_version: 1.21-next
target_version: 1.20-next
  • Loading branch information
greghudson committed Nov 28, 2023
1 parent c20251d commit 19b78c1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2464,7 +2464,9 @@ cms_envelopeddata_verify(krb5_context context,
}

/* verify that the received message is PKCS7 EnvelopedData message */
if (OBJ_obj2nid(p7->type) != NID_pkcs7_enveloped) {
if (OBJ_obj2nid(p7->type) != NID_pkcs7_enveloped ||
p7->d.enveloped == NULL ||
p7->d.enveloped->enc_data->enc_data == NULL) {
pkiDebug("Expected id-enveloped PKCS7 msg (received type = %d)\n",
OBJ_obj2nid(p7->type));
krb5_set_error_message(context, retval, "wrong oid\n");
Expand Down

0 comments on commit 19b78c1

Please sign in to comment.