centos 7
crypto weakness #345

4

Weakness Breakdown


Definition:

This weakness involves creating non-standard or non-tested algorithms, using weak algorithms or applying cryptographic algorithms incorrectly. Algorithms that were once considered safe are commonly later found to be unsafe, as the algorithms were broken.

Warning code(s):

The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment.

File Name:

mod_nss-1.0.14/nss_engine_pcache.c

Context:

The highlighted line of code below is the trigger point of this particular Centos 7 crypto weakness.

     } while(0);

    if (err)
    {
        DestroyPk11PinStore(store);
        store = 0;
    }

    *out = store;
    return err;
}

/*
 * DestroyPk11PinStore
 */
void DestroyPk11PinStore(Pk11PinStore *store)
{
    if (store == 0) return;

    if (store->params) {
        SECITEM_ZfreeItem(store->params, PR_TRUE);
    }

    if (store->crypt) {
        memset(store->crypt, 0, store->length);
        free(store->crypt);
    }

    free(store);
}

SECStatus Pk11StoreGetPin(char **out, Pk11PinStore *store)
{
    SECStatus err = SECSuccess;
    unsigned char *plain;
    SECStatus rv;
    PK11Context *ctx = 0;
    int outLen;
    PK11SlotInfo *slot;
    PK11SymKey * tmpkey;

    do {
        plain = (unsigned char *)malloc(store->length);
        if (!plain) { err = SECFailure;ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, "plain is null"); break; }

        slot = PK11_FindSlotByName(store->tokenName);
        ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, "slot is %s param len is %d", store->tokenName, store->params->len);
        if (slot == 0) {
             ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, "no slot");
             err=SECFailure;break; 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.