Secure code review

Auditing authentication enrolment, replacement and recovery

Trusted records: terminal, document, eye arranged to illustrate auditing authentication enrolment, replacement and recovery.

Authentication assurance includes the entire identity lifecycle, not only the primary login prompt. Understanding authentication enrolment and replacement and recovery 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.

Authentication factors may include passwords, soft tokens, hardware tokens, and biometric devices. Securely handling the lifecycle of these mechanisms is critical to the security of an application, and this section includes requirements related to this.

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 system generated initial passwords or activation codes are securely randomly generated, follow the existing password policy, and expire after a short period of time or after they are initially used. These initial secrets must not be permitted to become the long term password.
  • Confirm that password hints or knowledge-based authentication (so-called "secret questions") are not present.
  • Confirm that a secure process for resetting a forgotten password is implemented, that does not bypass any enabled multi-factor authentication mechanisms.
  • Confirm that if a multi-factor authentication factor is lost, evidence of identity proofing is performed at the same level as during enrollment.
  • Confirm that renewal instructions for authentication mechanisms which expire are sent with enough time to be carried out before the old authentication mechanism expires, configuring automated reminders if necessary.
  • Confirm that administrative users can initiate the password reset process for the user, but that this does not allow them to change or choose the user's password. This prevents a situation where they know the user's password.
  • 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