Skip to content

Bugs found #36

Description

@LeoneChen

Null Pointer Dereference (NPD) (70)

In ecall_OBJ_nid2sn, invalid n fed to OBJ_nid2sn will cause NULL is returned to str (e.g. when ecall_OBJ_create is not called before), and then strlen(str) will crash

In ecall_ENGINE_get_name, ename is obtained from e, and can be null, then strlen can crash

In ecall_SSL_CIPHER_get_name, ret obtained from c can be null, then strlen(ret) can crash.

In ecall_SSL_set_fd, when ssl_hardening is never initialized before (get_ssl_hardening not called before), then m obtained is newly created and m->count is 0, cause output in_s with null in hashmapGet, then in SSL_copy_fields_to_in_struct, in->state crashes. What's more, out_s assigned with parameter can be null but without any check, then out->state crashes. Below are functions that have same problem:

  • ecall_SSL_connect
  • ecall_SSL_accept
  • ecall_SSL_pending
  • ecall_SSL_ctrl
  • ecall_SSL_state
  • ecall_SSL_shutdown
  • ecall_SSL_read
  • ecall_SSL_write
  • ecall_SSL_free (in_s can be null, then in_s->references crash)
  • ecall_SSL_set_fd
  • ecall_SSL_set_verify
  • ecall_SSL_set_verify_result
  • ecall_SSL_set_session_id_context
  • ecall_SSL_set_alpn_protos
  • ecall_SSL_set_shutdown
  • ecall_SSL_set_cipher_list
  • ecall_SSL_set_bio
  • ecall_SSL_get_ciphers
  • ecall_SSL_get_peer_certificate
  • ecall_SSL_get_verify_result
  • ecall_SSL_get_verify_mode
  • ecall_SSL_get_wbio
  • ecall_SSL_get_rbio
  • ecall_SSL_get_servername
  • ecall_SSL_get_SSL_CTX
  • ecall_SSL_get_shutdown

Another simliar case is ecall_SSL_set_info_callback->SSL_copy_fields_to_out_struct, invalid in_s output out_s with null in hashmapGet, then out->state crash. Below are functions that have same problem:

  • ecall_SSL_set_info_callback

In ecall_BN_to_ASN1_INTEGER -> BN_to_ASN1_INTEGER, when bn is null, BN_is_negative(bn) can crash.

ecall_X509_get_ex_data -> X509_get_ex_data -> CRYPTO_get_ex_data. When r in ECALL is fed with null, ad is 0x28, then ad->sk cause NPD.

ecall_SSL_CTX_get_client_CA_list -> SSL_CTX_get_client_CA_list. When ctx is null, ctx->client_CA crashes.

ecall_X509_get_cert_key_algor_algorithm->X509_get_cert_key_algor_algorithm. x->cert_info->key->algor can be null, then x->cert_info->key->algor->algorithm; cause NPD. Below are functions that have same problem:

  • ecall_X509_get_cert_key_algor_algorithm
  • ecall_X509_get_algorithm

ecall_SSL_use_PrivateKey->SSL_use_PrivateKey->ssl_cert_inst. ssl in SSL_use_PrivateKey can be null, then o from &ssl->cert is 0xf8, then *o == NULL crash.

ecall_SSL_set_connect_state->SSL_set_connect_state. s can be null, then s->server = 0; crash. Below are functions that have same problem:

  • ecall_SSL_set_connect_state
  • ecall_SSL_set_accept_state
  • ecall_SSL_get_certificate (s->cert in SSL_get_certificate)
  • ecall_SSL_get_privatekey (s->cert in SSL_get_privatekey)
  • ecall_SSL_do_handshake (s->handshake_func in SSL_do_handshake)
  • ecall_SSL_CTX_get_cert_store (ctx->cert_store in SSL_CTX_get_cert_store)
  • ecall_X509_sign (x->cert_info in X509_sign)
  • ecall_SSL_CTX_get_verify_mode (ctx in SSL_CTX_get_verify_mode)
  • ecall_SSL_CTX_set_default_passwd_cb (ctx in SSL_CTX_set_default_passwd_cb)
  • ecall_SSL_CTX_ctrl (ctx in SSL_CTX_ctrl)
  • ecall_EVP_DigestFinal_ex (ctx and ctx->digest in EVP_DigestFinal_ex)
  • ecall_X509_get_ext (X509_get_ext in X509_get_ext)
  • ecall_SSL_CTX_get_verify_callback (ctx in SSL_CTX_get_verify_callback)
  • ecall_X509_get_subject_name (a in X509_get_subject_name)
  • ecall_ENGINE_get_name (e in ENGINE_get_name)
  • ecall_X509_pubkey_digest (x->cert_info->key in X509_pubkey_digest->X509_get0_pubkey_bitstr)
  • ecall_SSL_select_next_proto (server in SSL_select_next_proto, server[i])
  • ecall_DH_free (r->meth in DH_free)
  • ecall_SSL_CTX_sess_set_get_cb (ctx in SSL_CTX_sess_set_get_cb)
  • ecall_BN_is_zero (a in BN_is_zero)
  • ecall_BN_num_bits (a in BN_num_bits)
  • ecall_ENGINE_get_id (e in ENGINE_get_id)
  • ecall_d2i_SSL_SESSION (p is from *pp which is one of ECALL parameters, in d2i_SSL_SESSION->asn1_GetSequence->ASN1_get_object)
  • ecall_SSL_CTX_set_ex_data (s in SSL_CTX_set_ex_data, then &s->ex_data is 0xd0, ad->sk in CRYPTO_set_ex_data crash)

ecall_BN_dup->BN_dup->BN_copy. A is from a->d and is null since a is newly allocated from BN_new. Then A[0] crashes. When i smaller then 0, A[1] crashes in case 3, case 2 and case 1

ecall_SSL_CTX_set_default_verify_paths->SSL_CTX_set_default_verify_paths. ctx can be null, then ctx->cert_store crashes

ecall_SSL_get_error->SSL_get_error->SSL_want_read (SSL_want). s can be null, then s->rwstate crashes

ecall_X509_check_issued->X509_check_issued->X509_NAME_cmp->i2d_X509_NAME->ASN1_item_i2d->asn1_item_flags_i2d->ASN1_item_ex_i2d->ef->asn1_ex_i2d->x509_name_encode->BUF_MEM_grow. str can be null, then str->length crashes.

ecall_SSL_CTX_set_cipher_list->SSL_CTX_set_cipher_list. ctx can be null, then ctx->method crashes

ecall_SSL_CTX_set_default_verify_paths->SSL_CTX_set_default_verify_paths->X509_STORE_set_default_paths->X509_STORE_add_lookup->sk_X509_LOOKUP_push (sk_push)->sk_insert. st->data can be null, st->data[st->num] crashes

ecall_X509_digest->X509_digest->ASN1_item_digest->ASN1_item_i2d->asn1_item_flags_i2d->ASN1_item_ex_i2d->asn1_template_ex_i2d->ASN1_item_ex_i2d->asn1_template_ex_i2d->ASN1_item_ex_i2d->asn1_i2d_ex_primitive->asn1_ex_i2c. pf can be null, then pf->prim_i2c crashes

ecall_EC_KEY_free->EC_KEY_free->EC_GROUP_free. group

ecall_SSL_CTX_use_PrivateKey_file->SSL_CTX_use_PrivateKey_file->BIO_new->execute_bio_ocall_malloc->bio_alloc_from_pool. When first call get_bio_mempool, m_memStart of returned pool is 0, then in pool_alloc, AddrFromIndex return p with null, then *p crashes

ecall_X509_set_ex_data->X509_set_ex_data->CRYPTO_set_ex_data->sk_void_set (sk_set). st->data can be null.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions