Start here

Home
About Klocwork
What's new
Fixed issues
Release notes
Installation

Reference

C/C++ checkers
Java checkers
C# checkers
MISRA C 2004 checkers
MISRA C++ 2008 checkers
MISRA C 2012 checkers
MISRA C 2012 checkers with Amendment 1
Commands
Metrics
Troubleshooting
Reference

Product components

C/C++ Integration build analysis
Java Integration build analysis
Desktop analysis
Refactoring
Klocwork Static Code Analysis
Klocwork Code Review
Structure101
Tuning
Custom checkers

Coding environments

Visual Studio
Eclipse for C/C++
Eclipse for Java
IntelliJ IDEA
Other

Administration

Project configuration
Build configuration
Administration
Analysis performance
Server performance
Security/permissions
Licensing
Klocwork Static Code Analysis Web API
Klocwork Code Review Web API

Community

View help online
Visit RogueWave.com
Klocwork Support
Rogue Wave Videos

Legal

Legal information

RCA

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).

1 #include <openssl/md5.h>
2
3 void  foo( const  unsigned  char  *msg, unsigned  int  len) {
4     unsigned  char  md5digest[MD5_DIGEST_LENGTH];    
5     MD5(msg, len, md5digest);   //  <== RCA reported
6     // . . . . .
7 }

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.

1 #include <Bcrypt.h> 
2
3 void  demo()
4 { 
5    NTSTATUS status;    
6    BCRYPT_ALG_HANDLE hAlg;    
7    status = BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_MD4_ALGORITHM, 0, 0); //  <== RCA reported 
8    // use(hAlg)
9 }                     

Example 3

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

1 #include <cryptopp/sha.h>
2
3 using namespace  CryptoPP; 
4 void  bar() {    
5     SHA1 *hashfunc =  new  SHA1();   //  <== RCA reported 
6     // use(hashfunc)
7 }    

Example 4

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

1 #include <cryptopp/sha.h>  
2 
3 class  MyAlgo :  public  CryptoPP::SHA1 {   //  <== RCA reported 
4      // . . . . .
5 };