The cryptographic scheme can be broken down into these components:
PBKDF2 - PBKDF2 is a password based key derivation function certified by NIST and approved for use in FIPS 140.2 validated
applications. It is designed specifically to resist brute force attacks.
Your Password - The plaintext password passed into the function. Password length and randomness still matter.
SHA-512 - A 512-bit one way hashing algorithm.
$salt - The salt is a unique value derived per user, from information stored in the database. It consists of the registration
timestamp and registration IP. May be obtained by an attacker via exploitation of SQLi/XSS vulnerabilities.
PBKDF2PEPPER - A unique site-wide value, stored in the configuration file. Set this to any value you would like, the longer and more
random the better. May be obtained by an attacker via exploitation of Remote File Include and other system-level vectors. May not be obtained by an
attacker via exploitation of SQLi/XSS vulnerabilities.
PBKDF2ITERATIONS - A unique integer, stored in the configuration file. May be obtained by an attacker via exploitation of RFI and
other system-level vectors. May not be obtained by an attacker via exploitation of SQLi/XSS vulnerabilities. OWASP recommends a minimum of 310000
iterations. NIST's year 2000 guidance was 1000. The higher the better, performance impact is negligible except during login.
SHA512(
Plaintext Password + Salt + Pepper) x Number of Iterations =
SHA512 Password Hash
Password re-use is a huge problem in information security. By securely storing passwords, you make it computationally more expensive for an attacker
to exhaustively search the keyspace. This protects your users within your community and even on their other information products.
New vulnerabilities are frequently discovered in web applications, web server software, server OSes and the underlaying hardware. This schema would
require multiple serious vulnerabilities/failures to collect the pieces required to mount a feasible brute force attack. This where the strength of
individual plaintext passwords becomes paramount.
Here are some Hashcat benchmarks:
Code: |
[b]Hashmode: 0 - MD5[/b]
Speed.#1.........: 65079.1 MH/s (41.37ms) @ Accel:32 Loops:1024 Thr:1024 Vec:1
[b]Hashmode: 12100 - PBKDF2-HMAC-SHA512 (Iterations: 999)[/b]
Speed.#1.........: 1431.6 kH/s (38.64ms) @ Accel:2 Loops:499 Thr:1024 Vec:1
|
Device #1: NVIDIA GeForce RTX 3090, 24005/24259 MB, 82MCU
This GPU just devastates md5 with a whopping 65 billion hashes per second. Without salting, they could even be cracked in parallel without a real
performance impact for the attacker.
Our above code stands up nicely, allowing the attacker to compute roughly 1.4 million hashes per second. This number decreases as you increase the
iterations of the key derivation function. Because of the entropy salt/pepper, an attacker is unable to crack more than one hash at a time. Every time
a hash is cracked, the whole process has to start all over again.
This GPU can crack md5 over 43000x faster, and in parallel.
Unfortunately although it hardens a server and provides excellent post-attack mitigation, it is likely to do little in actually preventing attacks.
For instance, if the attacker's goal is simply to gain access and deface your community, they don't actually need to crack your password. If their
intent is to dump your database and try email/user/password sets in various banking applications they will need the plaintext password which is where
this really shines.