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.
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.
nettle-2.7.1/testsuite/des-compat-test.c
The highlighted line of code below is the trigger point of this particular Centos 7 crypto weakness.
for (i=0; i<4; i++)
{
printf(" %d",i);
des_ncbc_encrypt( (des_cblock *) &(cbc_out[i]), (des_cblock *) cbc_in,
sizeof(cbc_data), ks, &cbc_iv,
DES_ENCRYPT);
}
printf("\noutput word alignment test");
for (i=0; i<4; i++)
{
printf(" %d",i);
des_ncbc_encrypt( (des_cblock *) cbc_out, (des_cblock *) &(cbc_in[i]),
sizeof(cbc_data), ks, &cbc_iv,
DES_ENCRYPT);
}
printf("\n");
printf("fast crypt test ");
str=crypt("testing","ef");
if (strcmp("efGnQx2725bI2",str) != 0)
{
printf("fast crypt error, %s should be efGnQx2725bI2\n",str);
err=1;
}
str=crypt("bca76;23","yA");
if (strcmp("yA1Rp/1hZXIJk",str) != 0)
{
printf("fast crypt error, %s should be yA1Rp/1hZXIJk\n",str);
err=1;
}
printf("\n");
#endif
ASSERT (err == 0);
}
static char *pt(const unsigned char *p)
{
static char bufs[10][20];
static int bnum=0;
char *ret;
int i;
static const char *f="0123456789ABCDEF";
ret= &(bufs[bnum++][0]);
bnum%=10;
for (i=0; i<8; i++)
{
ret[i*2]=f[(p[i]>>4)&0xf];
ret[i*2+1]=f[p[i]&0xf];
}