Risky cryptographic algorithm used

If a program processes sensitive data or protects a communication channel, you may use cryptography to prevent attackers from reading it. There are several obsolete cryptographic algorithms that have proven weaknesses against attack.

The RCA checker detects the use of a specific set of known broken or risky cryptographic algorithm.

Vulnerability and risk

If a program uses broken or risky algorithms in data processing, it could lead to security weaknesses within the program. CWE-327 and NIST Special Publication 800-131A Revision 1 list the following algorithms as broken or risky for use: CBC-MAC, DES, DES-X, Two-key Triple DES, MD2, MD4, MD5, RC2, RNG in ANSI X9.31, SHA-0, SHA-1, SKIPJACK. These algorithms can still be supported in cryptographic libraries, though they are not recommended for use.

Mitigation and prevention

Consider replacing the reported weak algorithm with a stronger one. For example, SHA-256 or SHA-512 can replace SHA-1 or MD5, AES can replace DES, and so on.

Example 1

A function call uses risky algorithm (or initializes an object that represents it).

 #include <openssl/md5.h>

 void  foo( const  unsigned  char  *msg, unsigned  int  len) {
     unsigned  char  md5digest[MD5_DIGEST_LENGTH];    
     MD5(msg, len, md5digest);   //  <== RCA reported
     // . . . . .

Example 2

A constant C-string literal that identifies a risky algorithm is passed to a function that will perform it or initialize an object instance that represents it.

 #include <Bcrypt.h> 

 void  demo()
    NTSTATUS status;    
    status = BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_MD4_ALGORITHM, 0, 0); //  <== RCA reported 
    // use(hAlg)

Example 3

An instance of a class that represents a risky algorithm is created.

 #include <cryptopp/sha.h>

 using namespace  CryptoPP; 
 void  bar() {    
     SHA1 *hashfunc =  new  SHA1();   //  <== RCA reported 
     // use(hashfunc)

Example 4

A custom class is inherited from a class that represents a risky algorithm.

 #include <cryptopp/sha.h>  
 class  MyAlgo :  public  CryptoPP::SHA1 {   //  <== RCA reported 
      // . . . . .

Security training

Application security training materials provided by Secure Code Warrior.