Cryptography / Broken or Risky Cryptographic Algorithm
Description
"Broken or Risky Cryptographic Algorithm" is a vulnerability that occurs when an application uses a cryptographic algorithm or protocol to protect sensitive data, that has known weaknesses or is considered broken by the cryptographic community. The Common Weakness Enumeration lists this as "CWE-327: Use of a Broken or Risky Cryptographic Algorithm". The OWASP WSTG subsumes this issue under "Weak Cryptography".
The vulnerability may also include custom self-implemented cryptographic algorithms that have not been extensively studied, as it is very difficult, even for cryptographic experts, to design a secure algorithm. New algorithms should be considered unsafe, until they have been extensively reviewed by the cryptographic community for an extensive period of time, without discovering critical vulnerabilities. Additionally, cryptographic algorithms are difficult to implement securely in code, due to many intricacies that need to be considered. Therefore it is not recommended to develop a new implementation of cryptography, but rather to rely on existing ones that are widely used, maintained, and have been extensively tested and developed by cryptographic experts.
Insecure cryptographic algorithms may include:
- Historical algorithms that are considered broken, such as simple substitution ciphers (e.g. Caesar cipher, XOR cipher, Vigenère cipher)
- Deprecated algorithms that have known weaknesses, e.g. the DES cipher or the MD5 hash algorithm.
- Cryptographic protocols that use algorithms in an insecure manner and therefore are vulnerable to certain attacks, e.g. missing or weak padding, bad values for initialization vectors, insecure block cipher mode of operation, etc.
Risk
Broken or Risky Cryptographic Algorithms can be a serious risk, as it may allow an attacker to read or manipulate confidential/sensitive data that may falsely be considered secure, affecting the confidentiality and integrity.
Solution
To mitigate the vulnerability, only well-known cryptographic algorithms that have been standardized and considered secure by the cryptographic community should be used. Additionally, only cryptographic libraries that are actively maintained, have been developed, extensively tested, and audited by cryptographic experts, should be used.