Passwords: rules, storage, attacks and vaults
A password is a secret that a person and a system both know. It is the oldest and most common way to prove an identity, and the most attacked. No background is assumed. A security professional has to know which password rules help, how a system should store passwords, how attackers obtain them and which tools manage them safely.
By the end of this unit you will be able to:
- Choose password rules that follow current NIST guidance and give the reason for each
- Explain how hashing and salting protect stored passwords
- Tell apart brute force, dictionary, rainbow table, credential stuffing and password spraying attacks
- Match each password attack to the control that counters it
- Explain what a credential management system and a password vault do
A strong password that nobody had to guess
An illustrative example
A florist uses one password for the shop's email, its online ordering site and a hobby forum about pressed flowers. The password is twelve characters long with a capital and a symbol.
The forum is broken into, and its list of email addresses and passwords is published. A week later someone signs in to the shop's email at the first attempt. They use the email to reset the ordering site's password and change the bank account that orders are paid into.
Nobody guessed the florist's password. How did a stranger sign in at the first attempt?
Which password rules help and which do not
A password is a secret string of characters that a user memorises. A passphrase is a password made of several words, such as a short sentence. It is long and still easy to remember.
Length does more than variety. Every added character multiplies the number of passwords an attacker must try. Rules that demand a capital, a digit and a symbol make people predictable: Password1! satisfies all of them.
| Rule | What the guidance says |
|---|---|
| Length | At least 15 characters when the password is the only factor, at least 8 when it is used with a second factor, and at least 64 allowed |
| Blocklist | Compare each new password with a list of common, expected and breached passwords, and refuse a match |
| Composition | Do not demand mixtures of character types |
| Expiry | Do not force periodic changes. Force a change when there is evidence of compromise |
| Hints and questions | No stored hints, and no security questions such as the name of a first pet |
| Failed attempts | Limit consecutive failures on an account, to no more than 100 |
Revision 3, which older questions follow, set the minimum at 8 characters. It advised against forced expiry and composition rules without forbidding them.
Older settings are still in wide use and are known by name. Password history refuses the reuse of recent passwords. Maximum password age forces a change after a set number of days. Minimum password age stops a user changing a password several times in one day to get back to an old favourite. Account lockout suspends sign-in once failures reach a set number, the clipping level. Below it, failures are treated as ordinary mistakes. At it, the account is locked or an alert is raised.
A cognitive password is the answer to a personal question, such as a first school. The answers can often be looked up, which is why current guidance forbids them.
How a system checks a password it never keeps
A system should never store the passwords themselves. If the file were stolen, every account would fall at once. It stores a hash of each password: the fixed-length fingerprint that a one-way function produces from it. At sign-in the system what was typed and compares fingerprints. A hash cannot be run backwards to give the password.
Hashing alone leaves two gaps. Two users with the same password have the same hash. And an attacker can hash millions of likely passwords once, in advance, and look stolen hashes up in the result.
A salt closes both gaps. It is a random value, different for every account, that is mixed with the password before hashing and stored beside the hash. The same password now gives a different hash on every account, and a table computed in advance is useless. The salt is not a secret.
A hash function for passwords is made slow on purpose. Its work factor, also called cost factor, sets how much computing each guess takes. One honest sign-in takes a fraction of a second, and billions of guesses take years. Argon2id, scrypt, bcrypt and PBKDF2 are functions built for this job. A pepper is a further secret value, the same for all accounts, kept apart from the password file.
Common misconception
“Stored passwords should be encrypted.”
Anything encrypted can be decrypted by whoever holds the key, and a system never needs a password back. It only needs to check one. A salted, slow, one-way hash does that and gives a thief nothing to decrypt.
How passwords are attacked, and what stops each attack
An attack is online when guesses are sent to the live sign-in page, where the system can count and block them. It is offline when the attacker has stolen the password file and tests guesses on their own machines, at any speed and unseen.
| Attack | How it works | Main counter |
|---|---|---|
| Brute force | Tries every possible combination | Length. Lockout or rate limiting online. Slow salted hashes offline |
| Dictionary | Tries words, names and common passwords from a list | A of common and breached passwords |
| Rainbow table | Looks stolen hashes up in a table of hashes computed in advance | A salt for each account |
| Credential stuffing | Tries user name and password pairs leaked from another site | A different password for every site. |
| Password spraying | Tries one common password against many accounts, staying under the lockout limit | Blocklist. MFA. Watching for many accounts failing from one source |
| Phishing | A fake page or message asks the user for the password | MFA that resists phishing. Training |
| Shoulder surfing | Watching the user type | Hidden characters on screen. Awareness |
| Keylogging | Software or a device records each key pressed | Defences against malicious software. MFA |
The florist's password was long and was never guessed. It was used on three sites, and one of them leaked it. That is credential stuffing, and length is no defence against it.
Common misconception
“Locking an account after a few failures stops password guessing.”
Lockout counts failures on one account. Password spraying makes one or two attempts on each of thousands of accounts and never reaches the limit. An offline attack never touches the sign-in page. An attacker can also use lockout to shut real users out.
Credential management systems and password vaults
A credential is what an identity uses to authenticate: a password, a key, a or a token. A credential management system issues, stores, changes and withdraws credentials, so that the work does not rest on memory and sticky notes.
A password vault, also called a password manager, stores passwords in form behind one strong sign-in. It generates a long random password for each site and fills it in. Reuse stops, because nobody has to remember the passwords. NIST guidance tells systems to accept password managers and pasted passwords.
A vault concentrates . Its own sign-in, the master password, now guards every other secret, so it gets the strongest protection available, including MFA.
Organisations use vaults for shared and administrator passwords as well. The vault releases a password to a named person for a stated task, records the use and changes the password afterwards. Programs hold credentials too. Secrets management keeps the passwords and keys that programs use in a vault and hands them out when the program runs, so none is written into program code.
Two conveniences carry risk. Self-service password reset lets a user replace a forgotten password without the helpdesk. It is only as strong as the proof it asks for, and a reset by security question undoes a strong password. Password synchronisation copies one password to several systems. The user remembers one password, and a thief needs only one.
A question, worked through
An online retailer's monitoring shows 40,000 failed sign-ins overnight from a few hundred addresses. Each customer account received one or two attempts, each with a different password, and many of the user name and password pairs match ones leaked from a games website last month. About 300 sign-ins succeeded at the first try. No account reached the lockout limit of five failures. Passwords are stored as salted hashes, and the password file has not been touched.
Which control would MOST reduce this attack?
Decide on your answer, then open the reasoning
- Identify the attack first. A different password on each account, matching pairs leaked elsewhere, means the attacker arrived with real pairs of user names and passwords. That is credential stuffing.
- Rule out b: slower hashing protects a stolen password file. The file has not been touched, so this attack is online.
- Rule out a: no account came near five failures. A limit of three would not have been reached either.
- Between c and d: a change every 60 days would retire a leaked password in time. Customers answer forced changes with small predictable edits, and current guidance advises against expiry.
- Option c removes passwords that attackers already hold and adds a factor that a leaked password cannot supply. It deals with the cause, so it is the best answer.
Answer: C. Reject passwords found in breach lists and offer customers MFA
Choosing between good answers
- Many accounts each see one or two failed sign-ins
- think password spraying if one common password is tried everywhere, and credential stuffing if leaked pairs are tried. Lockout stops neither.
- A password file has been stolen
- the attack is offline. Choose salting and slow hashing over lockout, which works only at the sign-in page.
- An answer offers complexity rules or regular expiry
- prefer length, a blocklist and MFA. Choose a forced change only where the scenario shows evidence of compromise.
- A question mentions a table of hashes prepared in advance
- the attack is a rainbow table and the counter is a salt.
Check your understanding
5 questions on this unit, easiest first. Confirm an answer to see the reasoning for it, then the right answer, the other options and the rule to reuse. Your answers are kept in this browser and feed readiness and review.
These questions are drafts that no named reviewer has approved yet.
Question 1 of 5
What to remember
- Length protects a password more than variety of characters. Current NIST guidance asks for 15 characters when the password is the only factor, a blocklist and no forced expiry.
- A system stores a salted, deliberately slow hash of each password and never the password.
- A salt is a random value for each account. It defeats rainbow tables and hides which users share a password.
- Credential stuffing uses pairs leaked from another site. Password spraying uses one common password on many accounts. Both pass under a lockout limit.
- A password vault generates and stores a different password for every site. Its master sign-in then needs the strongest protection.
- Secrets management does for programs what a vault does for people.
Say it from memory
What does a credential management system do, and what is a password vault?
A credential management system issues, stores, changes and withdraws credentials such as passwords, keys and certificates. A password vault stores passwords encrypted behind one strong sign-in, generates a different random password for each site and fills it in. For shared and administrator accounts it releases a password to a named person, records the use and changes it afterwards.
What do NIST SP 800-63B revision 4 rules say about password length, composition and expiry?
At least 15 characters when the password is the only factor, at least 8 with a second factor, and at least 64 allowed. Compare new passwords with a blocklist of common, expected and breached passwords. Do not demand mixtures of character types. Do not force periodic changes; force a change on evidence of compromise.
What do a salt, a work factor and a pepper each add to stored password hashes?
A salt is a random value, different for every account and stored beside the hash, so the same password gives different hashes and precomputed tables are useless. The work factor sets how much computing each guess takes. A pepper is a further secret value, the same for all accounts, kept apart from the password file.
How do credential stuffing, password spraying and a rainbow table attack work, and what is the main counter to each?
Credential stuffing tries pairs leaked from another site; the counter is a different password for every site, and MFA. Password spraying tries one common password against many accounts, staying under the lockout limit; counter with a blocklist, MFA and watching for many failures from one source. A rainbow table looks hashes up in a precomputed table; the counter is a salt.
What risks do self-service password reset and password synchronisation carry?
Self-service reset is only as strong as the proof it asks for, and a reset by security question undoes a strong password. Password synchronisation copies one password to several systems, so a thief needs only one.
Sources
- NIST SP 800-63B-4: Authentication and Authenticator Management, NISTMinimum lengths of 15 and 8 characters, a maximum of at least 64, the blocklist, no composition rules, no periodic change, no hints or security questions, the limit of 100 failed attempts, salted hashing with a cost factor, a separately stored secret key, and acceptance of password managers.
- NIST SP 800-63B: Digital Identity Guidelines, Authentication and Lifecycle Management (revision 3), National Institute of Standards and TechnologyThe revision 3 minimum of 8 characters and its advice that composition rules and periodic changes should not be imposed.
- OWASP Cheat Sheet Series: Password Storage, OWASP FoundationWhy passwords are hashed and not encrypted, what a salt and a pepper are, the work factor, and Argon2id, scrypt, bcrypt and PBKDF2 as password hashing functions.
- Brute Force (T1110), MITREBrute force guessing carried out online against a service or offline against stolen password hashes.
- Brute Force: Password Cracking (T1110.002), MITRECracking stolen hashes, including with a rainbow table computed in advance.
- Brute Force: Password Spraying (T1110.003), MITREPassword spraying: one common password tried against many accounts to avoid lockout.
- Brute Force: Credential Stuffing (T1110.004), MITRECredential stuffing: pairs of user names and passwords from an unrelated breach tried against other services.
- Input Capture: Keylogging (T1056.001), MITREKeylogging as a way of capturing credentials as they are typed.
- SP 800-53 Rev. 5, Security and Privacy Controls for Information Systems and Organizations, NISTLimits on consecutive failed sign-ins and temporary lockout, and salted storage of passwords.
- Password Policy (Windows 10 and Windows 11), MicrosoftThe settings named password history, minimum password age and maximum password age.