Skip to content
Tutorials Center
My learning

Topics

Lesson 25 of 38 ยท Authentication and Sessions Testing

Testing Login and Lockout Defences

Learn how to test a login form on your own test system: username enumeration, rate limiting, lockout, and password policy, with a safe loopback simulation in Python.

The login form is the front door of most applications, so it deserves careful testing. In an authorised assessment you check whether the door resists guessing: does the site reveal which usernames exist, does it slow down or lock out repeated failures, and does it accept weak passwords? This lesson shows what to look for and how to use Burp's Repeater and Intruder in a controlled way.

Test logins only on systems you own or have written permission to test, and only with accounts created for the test. Never run guessing attacks against real users, third-party sites, or production accounts. A lockout test can lock a real person out of their account.

Burp is a desktop application and cannot run here, so the Burp screens are labelled example output. The runnable block builds a tiny login model in memory (no network at all) so you can see the behaviours you are testing for.

What you are testing

Question Why it matters
Do error messages differ for a wrong user and a wrong password? Differences reveal which accounts exist (username enumeration)
Do response time or length differ? Side channels leak the same information
Is there a limit on failed attempts? Without one, guessing is cheap
Does the lockout hurt legitimate users? Permanent lockout is a denial-of-service tool
Are weak passwords accepted at registration or reset? Policy gaps make guessing succeed
Do password-reset and registration pages leak existence? Enumeration through other doors

Checking for username enumeration

Submit a login in Repeater twice: once with a username you know exists (your test account) and a wrong password, once with a username that cannot exist. Compare the status code, body, headers, length and timing.

TEXT
Example (labelled): two Repeater responses
Request A  user=testuser  pass=wrong   -> 200, length 3,412, "Invalid password"
Request B  user=nouser99  pass=wrong   -> 200, length 3,398, "Unknown user"
Verdict: the messages differ, so valid usernames can be enumerated.

The fix is a generic message ("Invalid username or password") with the same code, the same body and similar timing. Timing matters because hashing a password takes measurable time: servers that skip hashing for unknown users answer faster. A safe design hashes a dummy value for unknown users.

Burp's Comparer

Use the Comparer tab (right-click, Send to Comparer) to diff two responses word by word, which catches tiny differences such as a hidden error code. Pair it with Logger to compare response lengths across many requests.

Rate limiting and lockout with Intruder (on a lab)

Intruder can send a small list of attempts and show the status and length of each. In a legitimate test against your own test account, you might send 15 wrong passwords and observe: does the server start returning 429 Too Many Requests? Does the message change to "account locked"? Does the lock expire?

TEXT
Example (labelled): Intruder attack results, 12 attempts against lab account "tester1"
#   Payload      Status  Length  Note
1   wrong-01     200     3412
...
5   wrong-05     200     3412
6   wrong-06     200     3470    "Too many attempts, wait 5 minutes"
7   wrong-07     429     310
8   (correct pw) 429     310     lockout holds even for the right password

Good lockout is temporary and per account and per source, backed by an increasing delay, so it blocks guessing without letting a stranger permanently lock your users out. Watch for these weaknesses:

  • Limit counts per IP only: an attacker rotates addresses.
  • Limit counts per account only: one attacker locks everyone out (denial of service).
  • Limit resets when you add a header like X-Forwarded-For, because the app trusts it blindly.
  • Counter resets after a successful login on any account, allowing slow interleaved guessing.
  • Only the web form is protected but an API login endpoint is not.

Simulate the behaviour in Python

This in-memory stand-in implements a login with a counter, a window and a lockout. It makes real network calls to nothing. Use it to reason about what you are measuring: how many guesses an attacker gets per window.

Python A lockout policy model (stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The first run shows that attempt 6 onwards is rejected, even with the correct password at the end. The second run shows why per-source counting alone is weak: each source address gets its own five free guesses.

Password policy checks

Test where passwords are created: registration, change and reset. Try a short password, a common one (Password1), one that equals the username, and a very long one (a 10,000-character password can reveal denial-of-service via slow hashing). Modern guidance (NIST SP 800-63B) prefers length and a blocklist of known-breached passwords over arbitrary complexity rules, allows long passphrases, and avoids forced periodic changes.

Other login-adjacent checks

  • Password reset: is the token long, random, single-use, and expiring? Does the reset email or page reveal whether an address exists?
  • Remember-me cookies: random and revocable, not a Base64 of the username.
  • Multi-factor: can you skip the second step by calling the next URL directly, or by reusing a code?
  • Session after login: is a new session ID issued (preventing session fixation)? Check with Sequencer and compare cookies before and after.

Safe habits

Agree attempts per hour in advance, use only dedicated test accounts, record everything in Logger, and stop at the first proof of weakness. You do not need to find the password to prove there is no lockout.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What is username enumeration?

    Different messages, lengths or timings for valid and invalid users reveal which accounts exist.
  2. 2. Which login error message is best?

    A generic message avoids revealing whether the username exists.
  3. 3. Why is a permanent lockout after five failures a risk?

    Temporary, escalating delays block guessing without letting anyone lock out others permanently.
  4. 4. A limit is counted only per IP address. What is the weakness?

    An attacker with many sources gets a fresh allowance from each.
  5. 5. Which test do you need before running login attempts?

    Guessing attacks are only legitimate with permission, on accounts made for the test.

Summary

  • Compare responses (code, body, length, timing) to find username enumeration; fix with generic messages and similar timing.
  • Test rate limits and lockout on your own test account, and look for per-IP-only or header-trusting limits.
  • Good lockout is temporary, escalating and per account and source.
  • Check password policy, reset tokens, remember-me cookies, MFA bypass and session fixation.
  • Get authorisation first; the Burp screens are labelled examples and the Python is an offline model.

Next: Session handling rules and macros