☼
⌃
☰

Insecure Authentication Mechanism

Table of Contents

A class of vulnerability where the mechanism used to authenticate users is flawed in its design or implementation — not merely that credentials are weak, but that the authentication process itself can be bypassed, forged, or subverted. Distinct from weak credentials; the mechanism itself is the failure point.

Common in React SPA and API-backend architectures because authentication logic is split across the client and the server, creating mismatches in what each side enforces.

Related: Broken Authentication JWT Attacks OAuth 2.0 Web Application Testing Methodology API Testing Methodology SPA Penetration Testing

1. Classification Guidance

Exam context: Insecure Authentication Mechanism vs. Broken Authentication

These two classifications overlap. Use this heuristic under exam conditions:

Scenario Preferred classification
Token can be forged or signature not verified Insecure Authentication Mechanism
No account lockout / brute force possible Insecure Authentication Mechanism
Client-side auth check only, none server-side Insecure Authentication Mechanism
Credentials transmitted in plaintext Insecure Authentication Mechanism
Predictable or enumerable session token Insecure Authentication Mechanism
Default or weak credentials used to log in Default Software Configuration
Token valid but grants wrong privileges Broken Access Control

The distinguishing question: Is the authentication process itself broken, regardless of the strength of the credentials? If yes, classify as Insecure Authentication Mechanism.

2. How It Manifests in React SPA / API Architectures

React SPAs introduce specific patterns that produce this class of vulnerability. The frontend and API backend are separate applications — mismatches in what each enforces are common.

2.1 Client-Side Authentication Enforcement Only

The React frontend conditionally renders protected routes based on a flag (e.g. isLoggedIn, role) stored in component state or localStorage. The API endpoints themselves perform no token validation.

Indicators:

  • Navigating directly to /dashboard or /admin bypasses the login redirect
  • Removing or manipulating a localStorage value changes what the UI renders without a server round-trip
  • API calls succeed without an Authorization header

Test:

SHELL
# Call the API directly without a token
curl http://$IP/api/v1/users/profile
curl http://$IP/api/v1/admin/dashboard

# If either returns 200 with data, the mechanism is absent server-side

2.2 Token Presence Checked but Signature Not Verified

The server checks that a JWT is present in the Authorization header but does not cryptographically verify the signature. Any structurally valid JWT — including self-signed — is accepted.

Test:

SHELL
# Decode existing token to read structure
echo "<payload_segment>" | base64 -d

# Craft a token with modified payload, sign with arbitrary secret
python3 jwt_tool.py <token> -T

# Or test none algorithm
python3 jwt_tool.py <token> -X a -t http://$IP/api/v1/profile

See JWT Attacks for full technique detail.

2.3 Token Stored in Accessible Location with No Integrity Check

Tokens stored in localStorage are readable by any JavaScript on the page. Combined with XSS, this becomes full session takeover. Additionally, if the token payload is trusted client-side without server-side verification, an attacker modifies the payload directly.

Check storage in browser DevTools → Application → Local Storage / Session Storage / Cookies.

2.4 Predictable or Sequential Session Tokens

Non-JWT session identifiers (plain session tokens, API keys) that are sequential, short, or follow a discernible pattern allow enumeration.

Test:

SHELL
# Register/login multiple times, capture tokens, compare
# Look for sequential IDs, timestamps, or UUIDs with fixed segments
echo "token1: abc-0001-xyz"
echo "token2: abc-0002-xyz"
# Pattern: increment middle segment → enumerate other sessions

2.5 No Token Expiry Enforced Server-Side

The server accepts tokens regardless of the exp claim value, or issues tokens with no expiry at all.

Test:

SHELL
# Capture a token, wait (or modify exp to a past timestamp)
# Reuse it — if still accepted, expiry is not enforced server-side
python3 jwt_tool.py <token> -T  # tamper exp field

2.6 Credentials Transmitted Without TLS

Username and password sent over HTTP rather than HTTPS. Visible to any network-level observer.

Test by observing the scheme in Burp Suite — if the login POST goes to http://, this is Insecure Authentication Mechanism.

2.7 Multi-Factor Authentication Bypass

MFA enforced in the UI but not the API. After the first factor, the API session token grants full access before the second factor is verified.

Test:

SHELL
# Authenticate first factor, capture the intermediate token
# Attempt API calls with that token before completing MFA
curl -H "Authorization: Bearer $INTERMEDIATE_TOKEN" \
  http://$IP/api/v1/users/profile

3. Identification Methodology for SPAs

Follow this sequence on any React SPA / API target before moving to other vulnerability classes.

  1. Open browser DevTools (Network tab) and log in normally. Observe: what token is issued, where it is sent, what header.
  2. Open Application tab. Check localStorage, sessionStorage, and Cookies for token storage. Note the storage location.
  3. Copy the session token. Decode it — is it a JWT? If so, inspect header and payload for alg, exp, role, iss.
  4. Make a raw API call to a protected endpoint with the token: confirm the endpoint requires it.
  5. Make the same call without the token: if it succeeds, client- side enforcement only is the finding.
  6. If JWT, run jwttool attack suite. See JWT Attacks.
  7. Navigate directly to protected frontend routes without logging in (clear storage first). If accessible, the route protection is client-side only.
  8. If a role or privilege flag exists in the JWT payload, tamper with it and replay. If the server accepts it, the signature is not verified.

4. Reporting Template

Finding: Insecure Authentication Mechanism

Severity: High (adjust per CVSS; token forgery typically CVSS ≥ 8.0 due to authentication impact on confidentiality and integrity)

Description: The application's authentication mechanism was found to be insecure. [Specific mechanism: e.g. the API endpoint at /api/v1/profile accepted requests without validating the signature of the JWT in the Authorization header.] An attacker able to construct or modify a token can authenticate as any user, including administrative accounts, without possessing valid credentials.

Evidence: [Include the specific request and response demonstrating the bypass. Capture in Burp Suite and include the raw HTTP request/response.]

GET /api/v1/profile HTTP/1.1
Host: target.com
Authorization: Bearer <forged_token>

HTTP/1.1 200 OK
{"user":"admin","email":"admin@target.com"}

Impact: An unauthenticated or low-privilege attacker can gain access to all functionality and data of any user account on the platform, including administrative functions. This constitutes a complete authentication bypass.

Remediation:

  • Validate JWT signatures server-side on every protected request using a cryptographically secure library
  • Reject tokens with alg: none explicitly
  • Enforce token expiry (exp claim) server-side
  • Store tokens in HttpOnly cookies rather than localStorage where possible
  • Implement server-side session validation rather than relying on client-side state

5. CVSS Indicative Scoring

Signature not verified (unauthenticated access to all accounts):

AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N
Base Score: 9.1 (Critical)

Client-side enforcement only (authenticated user escalates to admin):

AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
Base Score: 8.1 (High)

See CVSS for full scoring guidance.

Tips

  • On the exam, if you can access any protected resource without valid credentials, or can escalate privilege by modifying a token, the primary finding is Insecure Authentication Mechanism
  • The tell in a React SPA: the UI redirects you to login, but a direct curl to the API endpoint succeeds without a token
  • Always test both the frontend route (browser) AND the backing API endpoint (curl/Burp) — they are separate code paths
  • Missing signature verification is the highest-severity variant; document it with a forged token demonstrating impact
  • Client-side-only route guards are a UI concern — the real vulnerability is the unprotected API; frame your finding around the API endpoint, not the React router