ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 286 - PT0-002 discussion

Report
Export

A penetration tester discovered a code repository and noticed passwords were hashed before they were stored in the database with the following code? salt = '123' hash = hashlib.pbkdf2_hmac('sha256', plaintext, salt, 10000) The tester recommended the code be updated to the following salt = os.urandom(32) hash = hashlib.pbkdf2_hmac('sha256', plaintext, salt, 10000) Which of the following steps should the penetration tester recommend?

A.
Changing passwords that were created before this code update
Answers
A.
Changing passwords that were created before this code update
B.
Keeping hashes created by both methods for compatibility
Answers
B.
Keeping hashes created by both methods for compatibility
C.
Rehashing all old passwords with the new code
Answers
C.
Rehashing all old passwords with the new code
D.
Replacing the SHA-256 algorithm to something more secure
Answers
D.
Replacing the SHA-256 algorithm to something more secure
Suggested answer: A

Explanation:

The penetration tester recommended the code be updated to use a random salt instead of a fixed salt for hashing passwords. A salt is a random value that is added to the plaintext password before hashing it, to prevent attacks such as rainbow tables or dictionary attacks that rely on precomputed hashes of common or weak passwords. A random salt ensures that each password hash is unique and unpredictable, even if two users have the same password. However, changing the salt does not affect the existing hashes that were created with the old salt, which may still be vulnerable to attacks. Therefore, the penetration tester should recommend changing passwords that were created before this code update, so that they can be hashed with the new salt and be more secure. The other options are not valid steps that the penetration tester should recommend. Keeping hashes created by both methods for compatibility would defeat the purpose of updating the code, as it would leave some hashes vulnerable to attacks. Rehashing all old passwords with the new code would not work, as it would require knowing the plaintext passwords, which are not stored in the database. Replacing the SHA-256 algorithm to something more secure is not necessary, as SHA-256 is a secure and widely used hashing algorithm that has no known vulnerabilities or collisions.

asked 02/10/2024
Andrey Bozhko
32 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first