centos 7
crypto weakness #323

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:

nspr-4.19.0/nspr/config/libc_r.h

Context:

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

 #define R_CTIME_R(val) \
    ctime_r(val,r_ctime_r)

#define R_GMTIME_INIT_R() \
    struct tm r_gmtime_r

#define R_GMTIME_R(time) \
    gmtime_r(time,&r_gmtime_r)

#define R_LOCALTIME_INIT_R() \
   struct tm r_localtime_r

#define R_LOCALTIME_R(val) \
   localtime_r(val,&r_localtime_r)
    
/***********/
/*  crypt  */
/***********/
#include <crypt.h>
#define R_CRYPT_INIT_R() \
    CRYPTD r_cryptd_r; \
    bzero(&r_cryptd_r,sizeof(CRYPTD)) 

#define R_CRYPT_R(pass,salt) \
    crypt_r(pass,salt,&r_cryptd_r)

/**************/
/*  pw stuff  */
/**************/
#define R_MAX_PW_LEN_R 1024
/* The following must be after the last declaration, but */
/* before the first bit of code...                       */
#define R_GETPWNAM_INIT_R(pw_ptr) \
    struct passwd r_getpwnam_pw_r; \
    char r_getpwnam_line_r[R_MAX_PW_LEN_R]; \
    pw_ptr = &r_getpwnam_pw_r

#define R_GETPWNAM_R(name) \
    getpwnam_r(name,&r_getpwnam_pw_r,r_getpwnam_line_r,R_MAX_PW_LEN_R)

/*******************/
/*  gethost stuff  */
/*******************/
#define R_GETHOSTBYADDR_INIT_R() \
    struct hostent r_gethostbyaddr_r; \
    struct hostent_data r_gethostbyaddr_data_r

#define R_GETHOSTBYADDR_R(addr,len,type,xptr_ent) \
    bzero(&r_gethostbyaddr_r,sizeof(struct hostent)); \
    bzero(&r_gethostbyaddr_data_r,sizeof(struct hostent_data)); \ 

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.