Use of a Broken or Risky Cryptographic Algorithm
|ID: 327||Date: (C)2012-05-14 (M)2018-09-14|
|Type: weakness||Status: DRAFT|
|Abstraction Type: Base|
The use of a broken or risky cryptographic algorithm is an
unnecessary risk that may result in the exposure of sensitive
Extended DescriptionThe use of a non-standard algorithm is dangerous because a determined
attacker may be able to break the algorithm and compromise whatever data has
been protected. Well-known techniques may exist to break the
Likelihood of Exploit: Medium to High
Applicable PlatformsLanguage Class: Language-independent
Time Of Introduction
Related Attack Patterns
|Confidentiality ||Read application
data ||The confidentiality of sensitive data may be compromised by the use of
a broken or risky cryptographic algorithm. |
|Integrity ||Modify application
data ||The integrity of sensitive data may be compromised by the use of a
broken or risky cryptographic algorithm. |
|AccountabilityNon-Repudiation ||Hide activities ||If the cryptographic algorithm is used to ensure the identity of the
source of the data (such as digital signatures), then a broken algorithm
will compromise this scheme and the source of the data cannot be
|Automated Analysis ||Automated methods may be useful for recognizing commonly-used
libraries or features that have become obsolete. ||Moderate || |
|Manual Analysis ||This weakness can be detected using tools and techniques that require
manual (human) analysis, such as penetration testing, threat modeling,
and interactive tools that allow the tester to record and modify an
active session. || || |
|Architecture and Design ||Libraries or Frameworks ||When there is a need to store or transmit sensitive data, use strong,
up-to-date cryptographic algorithms to encrypt that data. Select a
well-vetted algorithm that is currently considered to be strong by
experts in the field, and use well-tested implementations. As with all
cryptographic mechanisms, the source code should be available for
analysis.For example, US government systems require FIPS 140-2
certification.Do not develop custom or private cryptographic algorithms. They will
likely be exposed to attacks that are well-understood by cryptographers.
Reverse engineering techniques are mature. If the algorithm can be
compromised if attackers find out how it works, then it is especially
weak.Periodically ensure that the cryptography has not become obsolete.
Some older algorithms, once thought to require a billion years of
computing time, can now be broken in days or hours. This includes MD4,
MD5, SHA1, DES, and other algorithms that were once regarded as strong.
[R.327.4] || || |
|Architecture and Design || ||Design the software so that one cryptographic algorithm can be
replaced with another. This will make it easier to upgrade to stronger
algorithms. || || |
|Architecture and Design || ||Carefully manage and protect cryptographic keys (see CWE-320). If the
keys can be guessed or stolen, then the strength of the cryptography
itself is irrelevant. || || |
|Architecture and Design ||Libraries or Frameworks ||Use a vetted library or framework that does not allow this weakness to
occur or provides constructs that make this weakness easier to
avoid.Industry-standard implementations will save development time and may
be more likely to avoid errors that can occur during implementation of
cryptographic algorithms. Consider the ESAPI Encryption feature. || || |
|ImplementationArchitecture and Design || ||When using industry-approved techniques, use them correctly. Don't cut
corners by skipping resource-intensive steps (CWE-325). These steps are
often essential for preventing common attacks. || || |
|CWE-327 ChildOf CWE-903 ||Category ||CWE-888 || |
Demonstrative Examples (Details)
- These code examples use the Data Encryption Standard (DES). Once
considered a strong algorithm, it is now regarded as insufficient for many
applications. It has been replaced by Advanced Encryption Standard
- CVE-2008-3775 : Product uses "ROT-25" to obfuscate the password in the registry.
- CVE-2007-4150 : product only uses "XOR" to obfuscate sensitive data
- CVE-2007-5460 : product only uses "XOR" and a fixed key to obfuscate sensitive data
- CVE-2005-4860 : Product substitutes characters with other characters in a fixed way, and also leaves certain input characters unchanged.
- CVE-2002-2058 : Attackers can infer private IP addresses by dividing each octet by the MD5 hash of '20'.
- CVE-2008-3188 : Product uses DES when MD5 has been specified in the configuration, resulting in weaker-than-expected password hashes.
- CVE-2005-2946 : Default configuration of product uses MD5 instead of stronger algorithms that are available, simplifying forgery of certificates.
- CVE-2007-6013 : Product uses the hash of a hash for authentication, allowing attackers to gain privileges if they can obtain the original hash.
For more examples, refer to CVE relations in the bottom box.
White Box Definitions None
Black Box Definitions None
|CLASP || ||Using a broken or risky cryptographic
algorithm || |
|OWASP Top Ten 2004 ||A8 ||Insecure Storage ||CWE_More_Specific |
|CERT Java Secure Coding ||MSC02-J ||Generate strong random numbers || |
|CERT C++ Secure Coding ||MSC30-CPP ||Do not use the rand() function for generating pseudorandom
numbers || |
|CERT C++ Secure Coding ||MSC32-CPP ||Ensure your random number generator is properly
seeded || |
- Bruce Schneier .Applied Cryptography. John Wiley & Sons. Published on 1996.
- Alfred J. Menezes Paul C. van Oorschot Scott A. Vanstone .Handbook of Applied Cryptography. Published on October 1996.
- C Matthew Curtin .Avoiding bogus encryption products: Snake Oil
- Information Technology Laboratory, National Institute of
Standards and Technology .SECURITY REQUIREMENTS FOR CRYPTOGRAPHIC
- Paul F. Roberts .Microsoft Scraps Old Encryption in New Code. 2005-09-15.
- M. Howard D. LeBlanc .Writing Secure Code 2nd Edition. Microsoft. Section:'Chapter 8, "Cryptographic Foibles" Page
259'. Published on 2002.
- Michael Howard David LeBlanc John Viega .24 Deadly Sins of Software Security. McGraw-Hill. Section:'"Sin 21: Using the Wrong Cryptography." Page
315'. Published on 2010.
- Johannes Ullrich .Top 25 Series - Rank 24 - Use of a Broken or Risky
Cryptographic Algorithm. SANS Software Security Institute. 2010-03-25.
- Mark Dowd John McDonald Justin Schuh .The Art of Software Security Assessment 1st Edition. Addison Wesley. Section:'Chapter 2, "Insufficient or Obsolete Encryption", Page
44.'. Published on 2006.