AI pentesting guides / Vulnerability classes

Identity flaws

Broken authentication testing

Broken authentication testing checks whether an attacker can log in as someone else, keep or reuse a session they should not have, or skip authentication entirely. It covers login, session management, tokens and recovery flows, and is classified mainly as CWE-287 (Improper Authentication), OWASP Top 10 2021 A07 (Identification and Authentication Failures) and OWASP API Security Top 10 2023 API2 (Broken Authentication).

Authentication flaws tend to be high impact because they lead directly to account takeover. They also hide in the less-tested paths: password reset, email change, remember-me tokens and API endpoints that were never wired to the main login.

Classification

  • CWE-287 Improper Authentication; related CWE-307 (excessive authentication attempts), CWE-384 (session fixation), CWE-640 (weak password recovery).
  • OWASP Top 10 2021: A07 Identification and Authentication Failures.
  • OWASP API Security Top 10 2023: API2 Broken Authentication.

What to test

  • Unauthenticated access to endpoints that should require login, including debug and legacy routes.
  • Login bypass: SQL or NoSQL injection in credentials, logic flaws in multi-step login, MFA steps that can be skipped.
  • Password reset: predictable or reusable tokens, tokens not bound to the account, host header influence on reset links.
  • Sessions: fixation, no rotation on login, no invalidation on logout or password change.
  • Tokens: JWT signature and algorithm handling, long expiry, missing revocation.
  • Brute-force and credential-stuffing protection on login and OTP endpoints.

Proof

Proof is access: a request that returns a protected resource or performs an action as another user, made without that user's credentials. For a NoSQL login bypass, the evidence is an operator-object credential succeeding where wrong string credentials fail. For a reset flaw, it is a password change on a test victim account. For missing authentication, it is the protected data returned to a request with no session at all.

Remediation

Use a well-maintained authentication framework instead of custom code. Enforce authentication by default on every route, opting out explicitly. Make reset tokens single-use, short-lived and bound to the account. Rotate sessions on login and invalidate them on logout and password change. Type-check credential fields so objects are never passed to database queries. Add MFA and rate limiting on login and OTP endpoints.

With Pentest-Swarm

How Pentest-Swarm tests authentication

Broken authentication, JWT flaws and authentication bypass are among the classes Pentest-Swarm reports, with several proven by oracles.

  • NoSQL authentication bypass proven differentially: an operator-object credential succeeding where wrong string credentials are denied.
  • Access-control bypass (403 to 200) through path-normalisation and override-header variants, proven differentially.
  • JWT testing with jwt_tool and unauthenticated endpoint discovery; the VAmPI chain finds an unauthenticated debug endpoint that dumps passwords.
  • BFLA chains such as cross-user password reset leading to account takeover.

Where it falls short

Pentest-Swarm does not currently test brute-force or credential-stuffing resistance (rate limiting), MFA bypass logic, session fixation or SSO/OAuth flows automatically. Those depend on flow-specific reasoning and careful handling of account lockouts, so include them in a manual test, especially for customer-facing login.

Questions

Is weak password policy broken authentication?

It is part of A07. It is usually reported as a lower-severity finding unless combined with missing rate limiting that makes guessing practical.

Why test password reset separately?

Reset is an alternative login path, often built later and tested less, and a flaw there is a direct account takeover.

Is MFA enough to fix broken authentication?

No. MFA helps against stolen passwords but not against session, token or reset flaws, or endpoints that skip authentication.

Sources

  1. CWE-287
  2. OWASP A07:2021
  3. OWASP API2:2023 Broken Authentication