Implementing password hashing and credential upgrades
Implementing password hashing and credential upgrades connects a security requirement to the behaviour of a real feature. The relevant controls need to remain effective across custom code, integrations and the production configuration. Understanding password hashing and credential upgrades helps establish which security property the feature needs and where that property is actually enforced.
What does this involve?
Authentication establishes who is making a request and the strength and freshness of that evidence. Enrolment, recovery, alternate channels and changes to authenticators are part of the same boundary. An impressive login screen provides little assurance if another path grants equivalent access with weaker checks.
Passwords should never be stored in plain text. Instead, they must be protected using strong, slow hashing algorithms such as Argon2id, bcrypt, or PBKDF2. A unique salt must be added to each password to prevent attackers from using precomputed lookup tables like rainbow tables. Fast hashing algorithms such as SHA‑256 are not suitable for password storage because they allow attackers to perform large numbers of guesses quickly. Using slow, memory‑hard algorithms makes brute‑force attacks significantly more difficult, expensive, and time‑consuming.
Hashing and encryption can keep sensitive data safe, but in almost all circumstances, Passwords should be securely hashed using modern, adaptive hashing algorithms (e.g., Argon2id, bcrypt, or PBKDF2), rather than encrypted or stored in plaintext.
Why it matters
Consider a realistic failure: a database leak reveals password hashes whose derivation cost and parameters no longer match the application's risk.
Account access can lead to disclosure, unwanted changes or misuse of a trusted identity. The consequence depends on the account's permissions and the actions available after authentication, rather than the appearance of the login mechanism.
Implementation guidance should be applied to a real feature and its deployment. Framework defaults, custom handlers and integrated services all influence whether the intended protection remains effective.
How penetration testers check for it
Trace the relevant feature from its entry point to the data or operation it protects, including custom code and alternate paths.
- Map normal, alternate and recovery authentication journeys.
- Compare verification across supported identities and application states.
- Check expiry, reuse and the binding of challenges to their intended action.
- Follow successful authentication into the operation that trusts it.
How to fix it
Use the appropriate maintained mechanisms and verify the result in the actual production configuration.
- Use Argon2id with a minimum configuration of 19 MiB of memory, an iteration count of 2, and 1 degree of parallelism.
- If Argon2id is not available, use scrypt with a minimum CPU/memory cost parameter of (2^17), a minimum block size of 8 (1024 bytes), and a parallelization parameter of 1.
- For legacy systems using bcrypt, use a work factor of 10 or more and with a password limit of 72 bytes.
- If FIPS-140 compliance is required, use PBKDF2 with a work factor of 600,000 or more and set with an internal hash function of HMAC-SHA-256.
- Require appropriate fresh evidence for sensitive changes.
- Record important authentication events without retaining secrets.
Authentication and authorisation answer different questions. Establishing identity does not grant unrestricted permission to records or privileged functions.
Recheck the changed behaviour against the original failure conditions and the legitimate user journey. Keep enough evidence to show which release and configuration were verified, and include related entry points that depend on the same security decision.
Related issues
- Auditing password rules, verification and credential storage
- Secure credential provider and password manager integration
- Implementing secure password recovery workflows
Read about our methodology or contact pentested.com to discuss secure development and code review.