A hash or cipher that is broken for security purposes is used
What it finds
MD5_Init, SHA1, EVP_des_cbc or RC4_set_key: MD4, MD5 and SHA-1 have practical collision attacks, and DES, RC2, RC4 and Blowfish keys or streams can be broken. They are fine for checksums that no attacker controls, not for signatures, passwords or encryption; SHA-256 and AES are the usual replacements.
Only names of OpenSSL's interface count, in files that include an OpenSSL header and do not declare or define the names themselves.
From the rule's source, weak_cryptography.rs.
#include <openssl/md5.h>#include <openssl/evp.h> void digest(const unsigned char *d, unsigned long n, unsigned char *out){ MD5_CTX ctx; MD5_Init(&ctx);tx0 reports: MD5_Init uses an algorithm that is broken for security purposes MD5_Update(&ctx, d, n);tx0 reports: MD5_Update uses an algorithm MD5_Final(out, &ctx);tx0 reports: MD5_Final uses an algorithm const EVP_MD *good = EVP_sha256(); const EVP_MD *bad = EVP_sha1();tx0 reports: EVP_sha1 uses an algorithm EVP_DigestInit(0, good); EVP_DigestInit(0, bad);} Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/c:weak-cryptography" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/c:weak-cryptography] reason="..."tx0 explain tx0/c:weak-cryptography shows the same in the terminal. Found a false positive? Report it.