Authentication Bypass

CWE-288, CWE-289, CWE-290, CWE-302, CWE-305

Vulnerabilities that allow bypassing authentication entirely

Real-World Attack Scenarios

Scenario 1: Alternate Path Bypass

Attacker accesses protected resource through different URL path:

Protected: /admin/dashboard
Bypass: /Admin/dashboard (case variation)
Bypass: /admin//dashboard (double slash)
Bypass: /admin/./dashboard (dot slash)
Bypass: /ADMIN/dashboard (uppercase)

Web server treats /admin/dashboard as protected and requires authentication. But /Admin/dashboard bypasses protection due to case-insensitive filesystem.

# Denied
curl http://example.com/admin/dashboard
# 401 Unauthorized

# Succeeds!
curl http://example.com/Admin/dashboard
# 200 OK - admin panel loads

Finding it: Try case variations, double slashes, URL encoding variations.


Scenario 2: Alternate Name Bypass

Authentication check looks for specific username format:

Attacker uses alternate format:

Some might pass:

Finding it: Try username variations. Check if system has multiple admin accounts.


Scenario 3: Spoofing Bypass

Attacker impersonates trusted entity:

Attacker simply sends the header:

Or by IP spoofing:

  • Spoof source IP to appear as internal network

  • Bypass IP-based authentication

Finding it: Try trusted headers (X-Forwarded-For, X-Real-IP). Test IP spoofing.


Scenario 4: Immutable Data Modification

Application assumes user ID can't change:

But attacker modifies their user_id between authentication and use:

Finding it: Check if IDs can be modified mid-request. Use race conditions.


Scenario 5: Weak Primary Authentication

Primary authentication weak, but assumed strong:

If primary auth (password check) is weak:

  • Logic error

  • Timing attack

  • Default credentials

  • SQL injection

Then attacker bypasses entire system.

Finding it: Test authentication mechanism thoroughly. Look for weaknesses in primary auth.


Mitigation Strategies

Normalize URLs

Strict authentication checks

Never trust client headers for auth

Validate immutable data

Strong primary authentication

Ensure primary authentication is:

  • Not bypassable

  • Tested thoroughly

  • Uses strong hashing

  • Resistant to timing attacks


Last updated