Key stretching is one of the new topics in the SY0-401 Security+ exam so if you plan on taking it, you should have a basic understanding of key stretching. It’s also a topic in the CompTIA Advanced Security Practitioner Certification Exam Objectives (CAS-002) exam.
Key Stretching Sample Question
As an example, you should be able to answer this sample question from the CompTIA Security+: Get Certified Get Ahead: SY0-401 Study Guide.
Q. An application requires users to log on with passwords. The application developers want to store the passwords in such a way that it will thwart rainbow table attacks. Which of the following is the BEST solution?
A. SHA
B. Blowfish
C. ECC
D. Bcrypt
Do you know the answer? Ideally you should know why the correct answer is correct, and why the incorrect answers are incorrect. The answer is at the end of this post.
Key Stretching Purpose
Key stretching is a technique used to increase the strength of stored passwords and prevent the success of some password attacks such as brute force attacks and rainbow table attacks.
Using complex passwords goes a long way toward preventing brute force attacks and rainbow table attacks but doesn’t prevent them all. A better method is to salt the passwords with additional random bits to make them even more complex. Key stretching techniques use salts.
Two common key stretching techniques are bcrypt and Password-Based Key Derivation Function 2 (PBKDF2):
- Bcrypt. Based on the Blowfish block cipher, bcrypt is used on many Unix and Linux distributions to protect the passwords stored in the shadow password file. Bcrypt salts the password by adding additional bits before encrypting it with Blowfish.
- PBKDF2. Many algorithms such as Wi-Fi Protected Access II (WPA2), Apple’s iOS mobile operating system, and Cisco operating systems use PBKDF2 to increase the security of passwords. PBKDF2 adds a salt of at least 64 bits.
Password attacks attempt to discover or bypass passwords used for authentication on systems and networks, and for different types of files. Although there are many attack methods, they fall into two generic categories: online password attacks and offline password attacks.
An online password attack attempts to discover a password from an online system. For example, an attacker trying to log on to an account by trying to guess a user’s password is an online attack.
Offline password attacks attempt to discover passwords from a captured database or captured packet scan. For example, when attackers hack into a web site causing a data breach, they can download entire databases. They then perform offline attacks to discover the passwords contained within the databases.
Key stretching techniques provide significant protection against offline password attacks.
Remember this
Bcrypt and PBKDF2 are key stretching techniques that help prevent brute force and rainbow table attacks. Both salt the password with additional bits.
Key Stretching Sample Question Answer
Q. An application requires users to log on with passwords. The application developers want to store the passwords in such a way that it will thwart rainbow table attacks. Which of the following is the BEST solution?
A. SHA
B. Blowfish
C. ECC
D. Bcrypt
D is correct. Bcrypt is a key stretching technique designed to protect against brute force attempts and is the best choice of the given answers. Another alternative is Password-Based Key Derivation Function 2 (PBKDF2). Both salt the password with additional bits.
Passwords stored using Secure Hash Algorithm (SHA) only are easier to crack because they don’t use salts.
PBKDF2 is based on Blowfish, but Blowfish itself isn’t commonly used to encrypt passwords.
Elliptic curve cryptography (ECC) is efficient and sometimes used with mobile devices, but not to encrypt passwords.
Pass the Security+ exam the first time!
CompTIA Security+: Get Certified Get Ahead: SY0-401 Study Guide
2 thoughts on “Key Stretching”