-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Closed
prchander/openssl
#3Labels
branch: 1.1.1Applies to OpenSSL_1_1_1-stable branch (EOL)Applies to OpenSSL_1_1_1-stable branch (EOL)branch: masterApplies to master branchApplies to master branchtriaged: documentationThe issue/pr deals with documentation (errors)The issue/pr deals with documentation (errors)
Description
Hi, When I fuzzed the d2i_PrivateKey interface in openssl1.1.1k, it ran for 23 hours and found cransh. there was a bug.
As shown in the figure, the memcpy() is performed when len = 2 and data is unusable in ASN1_STRING_set:304.


For fuzzing, my initial input and cransh are as follows:

My code is as follows
int FuzzerInitialize(int *argc, char ***argv)
{
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
ERR_clear_error();
CRYPTO_free_ex_index(0, -1);
return 1;
}
int type[4] = {EVP_PKEY_NONE, EVP_PKEY_RSA, EVP_PKEY_DSA, EVP_PKEY_EC};
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
int n;
if (len == 0)
return 0;
for(n=0; n<4;++n) {
EVP_PKEY *pkey;
unsigned char *out = NULL;
pkey = d2i_PrivateKey(type[n], NULL, &buf, len);
if (pkey != NULL) {
i2d_PrivateKey(pkey,&out);
OPENSSL_free(out);
EVP_PKEY_free(pkey);
}
}
ERR_clear_error();
return 0;
}
void FuzzerCleanup(void)
{
}My test data is as follows:
Data.zip
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
branch: 1.1.1Applies to OpenSSL_1_1_1-stable branch (EOL)Applies to OpenSSL_1_1_1-stable branch (EOL)branch: masterApplies to master branchApplies to master branchtriaged: documentationThe issue/pr deals with documentation (errors)The issue/pr deals with documentation (errors)