Number of iterations used for key derivation is 1
Firefox's stored master-key password check was derived with only one key-derivation iteration instead of the intended 10,000, so the encrypted password-check value in key4.db could be brute-forced far more cheaply. An attacker with a copy of the profile file could try candidate master passwords much faster than intended.
Originally disclosed on Mozilla
- Fixed in 18 days
- Paid in 30 days
- Disclosed after 18 days
Created attachment 9194775
ver84.0.1.pdf
Firefox version 84.0.1, 64-bit
Windows 10, ver. 2004, 64-bit / Ubuntu 20.04.1 - 64-bit
There is only 1 hash iteration in KDF for master key before it is used in encryption of "password-check".
But by default it should be 10000 due to previous fix( https://bugzilla.mozilla.org/show_bug.cgi?id=1562674#c11 ).
The lower value allows to bruteforce user's passwords.
Steps before:
1.Install Firefox 84.0.1, 64-bit
2.Start and set master-key for profile
3.Add login and password for example-web
4.key4.db file in profile folder now contains necessary infomations
In the first image in the .pdf are parts of sequence from key4.db, it shows "field-1" has value 1, which is count
of iteration.
Values in green box are used in hash and encryption of "password-check", blue underlined value is
encrypted "password-check", which is also stored in key4.db.
There is example url, login and password at the bottom of 1.image, which is received by decryption using only 1 iteration in kdf for master key.
2. image shows parts which used for check, that 1 iteration in kdf is really used(sha1, hmac_sha256,aes_256_cbc).
3. image: encryption of the check phrase with 1 iteration - which has same value as at 1. image - blue underlined value.
4. image: 10.000 iteration - which should be default value. Not equal to our value from 1.image.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a regression where the iteration count written into key4.db defaulted to 1 instead of the 10,000 set by an earlier fix.
Impact
The lower iteration count allows brute-forcing the user's master password from a copied key4.db, though the attacker still needs local access to the profile file.
What the attacker needed
Local access to the profile's key4.db; master password set on the profile
How it was found
- Install Firefox 84.0.1, 64-bit
- Start and set master-key for profile
- Add login and password for example-web
- key4.db file in profile folder now contains necessary infomations
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Firefox can store your saved logins behind a master password. To check a typed password without storing it, it saves a scrambled 'check' value made by repeatedly hashing the password many times, which makes guessing slow. Here the number of repeats was only one, so guessing a password became much quicker for anyone who copied the profile file.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.