Secure code review

Auditing password rules, verification and credential storage

Trusted records: terminal, document, eye arranged to illustrate auditing password rules, verification and credential storage.

Authentication assurance includes the entire identity lifecycle, not only the primary login prompt. Understanding password rules and verification and credential storage 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.

As such, this section contains requirements for making sure that passwords are created and handled securely. Most of the requirements are L1 as they are most important at that level. From L2 onwards, multi-factor authentication mechanisms are required, where passwords may be one of those factors.

Why it matters

Consider a realistic failure: a strong sign-in journey is bypassed through a weaker enrolment, recovery or alternative authentication path.

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.

A code audit connects a stated requirement to the implementation responsible for enforcing it. Source review and targeted behavioural checks should explain the same boundary and any relevant exceptions.

How penetration testers check for it

Review the specific control expectations below against the code, deployment and observable application behaviour.

  • Confirm that user set passwords are at least 8 characters in length although a minimum of 15 characters is strongly recommended.
  • Confirm that users can change their password.
  • Confirm that password change functionality requires the user's current and new password.
  • Confirm that passwords submitted during account registration or password change are checked against an available set of, at least, the top 3000 passwords which match the application's password policy, e.g. minimum length.
  • Confirm that passwords of any composition can be used, without rules limiting the type of characters permitted. There must be no requirement for a minimum number of upper or lower case characters, numbers, or special characters.
  • Confirm that password input fields use type=password to mask the entry. Applications may allow the user to temporarily view the entire masked password, or the last typed character of the password.
  • Confirm that "paste" functionality, browser password helpers, and external password managers are permitted.
  • Confirm that the application verifies the user's password exactly as received from the user, without any modifications such as truncation or case transformation.
  • Confirm that passwords of at least 64 characters are permitted.
  • Confirm that a user's password stays valid until it is discovered to be compromised or the user rotates it. The application must not require periodic credential rotation.
  • Confirm that the documented list of context specific words is used to prevent easy to guess passwords being created.
  • Confirm that passwords submitted during account registration or password changes are checked against a set of breached passwords.
  • 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

Implement the required boundary in the component that actually performs the sensitive operation and retain focused regression coverage.

  • Apply consistent verification at trusted boundaries.
  • Protect enrolment, replacement and recovery as carefully as login.
  • 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.

Read about our methodology or contact pentested.com to discuss the security of your application code.

See your first test report this week.

Book a 30 minute demo. We will verify one of your targets with you and run a test against it, so you can judge the results on your own systems.

Book a demo