OWASP WSTG v4.2 Explained

OWASP WSTG: Part 5 - Authentication

WSTG v4.2 section 4.4 explained: credentials over encrypted channels, default credentials, lockout, authentication bypass, remember-me, browser cache, password policy, security questions, password reset and alternative channels, with commands and fixes.

14 min read
views
visits
OWASP WSTG Part 5 - Authentication
OWASP WSTG Part 5 - Authentication

Authentication answers one question: are you really who you claim to be? If it fails, nothing else matters; every authorization rule and every audit log assumes the user is genuine.

Authentication testing (WSTG section 4.4, IDs WSTG-ATHN-*) covers the login form and much more: default accounts, lockout, “remember me”, password reset, security questions, browser caching of sensitive pages, and the alternative channels (mobile apps, APIs, legacy portals) that often authenticate the same users with weaker rules.

Source: WSTG v4.2 §4.4 Authentication Testing (CC BY-SA 4.0), explained and expanded. Only test systems you are authorised to test; brute-force and lockout tests can lock real users out, so agree on dedicated test accounts first.


Key Takeaways

  • Credentials must only ever travel over HTTPS, including on the login page itself and every account-management action.
  • Default and predictable credentials remain one of the fastest ways into admin consoles and devices.
  • Rate-limiting must cover every authentication step: passwords, OTP codes, security answers and reset tokens.
  • Password reset is an authentication mechanism and is attacked as often as the login form.
  • The weakest channel wins: an API or mobile endpoint without MFA or lockout undoes the protections on the website.

The Authentication Tests at a Glance

The category walks the whole login life cycle:

  1. Are credentials protected in transit? (ATHN-01)
  2. Are default or sample credentials still active? (ATHN-02)
  3. Does lockout stop repeated password guessing? (ATHN-03)
  4. Can the login be bypassed without valid credentials? (ATHN-04)
  5. Is “remember me” implemented safely? (ATHN-05)
  6. Does the browser cache sensitive authenticated pages? (ATHN-06)
  7. Is the password policy strong enough? (ATHN-07)
  8. Are security questions weak or guessable? (ATHN-08)
  9. Are password change and reset flows safe? (ATHN-09)
  10. Do alternative channels authenticate more weakly? (ATHN-10)

WSTG-ATHN-01: Credentials Transported over an Encrypted Channel

What it checks: that usernames, passwords and other credentials are only ever sent over HTTPS.

How to test: watch the traffic in Burp/ZAP and confirm that every credential exchange uses https://:

  • The login request (and the login page itself, not just the form action).
  • Account creation and password reset / change.
  • “Keep me logged in” tokens and API keys.
1
2
3
4
# Does the login form post to HTTP, or load over HTTP?
curl -s https://example.com/login | grep -iE 'action=|http://'
# Does the site accept credentials over plain HTTP at all?
curl -si http://example.com/login -d 'user=test&pass=test' | head -5

A form on an HTTPS page that posts to an http:// URL, or a login page reachable over HTTP, both leak credentials to anyone on the network path.

Fix: HTTPS for the entire site, redirect all HTTP to HTTPS, and send HSTS (see Part 3, CONF-07) so browsers refuse plain HTTP.


WSTG-ATHN-02: Default Credentials

What it checks: whether default accounts shipped with the platform, or predictable accounts created by the application, still work.

How to test:

  1. Known product defaults for whatever you fingerprinted in Part 2: Tomcat (tomcat:tomcat), Jenkins, Grafana (admin:admin), routers and appliances, phpMyAdmin, databases.
1
2
3
# Try a small, known default list (authorised targets only)
hydra -L defaults_user.txt -P defaults_pass.txt example.com http-post-form \
  "/login:username=^USER^&password=^PASS^:Invalid"
  1. Predictable new-account passwords: some apps create accounts with a pattern (Welcome1, Changeme123, the username, the company name, or username + 123). Register a few accounts and look for the pattern.
  2. Gray box: read the setup documentation and provisioning scripts for seeded accounts.

Fix: force a password change on first login, ship no default credentials, remove sample accounts before production, and generate initial passwords randomly and uniquely.


WSTG-ATHN-03: Weak Lock-Out Mechanism

What it checks: whether the application limits repeated failed authentication attempts, and whether the unlock process can be abused.

How to test (with permission and test accounts):

  • How many wrong passwords trigger a lockout? Is there a limit at all?
  • Does the counter cover all authentication steps: password, 2FA/OTP codes, security answers?
  • After lockout, how is the account unlocked (time delay, email link, admin)? Can an attacker trigger lockouts of other users as a denial of service?
  • Is the limit per account, per IP, or both? Per-IP-only limits are bypassed with rotating IPs; per-account-only limits enable mass lockout of users.
  • Does a CAPTCHA appear, and can it be bypassed (missing server-side check, reusable token)?

The guide ranks unlock mechanisms from weakest to strongest: time-based auto-unlock, self-service email unlock, manual admin unlock, and manual admin unlock with positive identification.

Fix: balance security and usability: a short automatic lockout after a handful of attempts, rate-limiting plus CAPTCHA, limits on both account and source, and protection for every credential-checking endpoint, not only the main login.


WSTG-ATHN-04: Bypassing the Authentication Schema

What it checks: whether a user can reach authenticated functionality without valid credentials.

Common techniques to test:

  • Direct page request (forced browsing): navigate straight to /dashboard or /admin/home while logged out. If the page loads, authentication is enforced only by the login redirect, not on the page itself.
  • Parameter modification: a response or cookie contains authenticated=no, isAdmin=0, loggedIn=false. Flip the value.
1
2
GET /dashboard HTTP/1.1
Cookie: SESSION=abc; authenticated=no        ->  change to authenticated=yes
  • Session ID prediction: if session tokens are sequential or guessable, an attacker predicts a valid one (see Part 7).
  • SQL injection in the login form: classic ' OR '1'='1' -- style payloads in the username or password turning the query always-true (full detail in Part 8, INPV-05).
  • Forced-token / JWT issues: an alg:none JWT or one signed with a guessable secret lets an attacker forge an authenticated token.

Fix: enforce authentication on the server for every protected resource, never trust client-side flags, use strong unpredictable session tokens, use parameterised queries, and verify token signatures properly.


WSTG-ATHN-05: Vulnerable “Remember Password” / Remember-Me

What it checks: that “keep me logged in” does not store or expose credentials insecurely.

How to test:

  • Inspect cookies and browser storage after ticking “remember me”. The value should be a random server-side token, never the password or the username/password encoded.
1
2
# A remember-me cookie that decodes to credentials is a finding
echo 'dXNlcjpQQHNzdzByZA==' | base64 -d        # -> user:P@ssw0rd  (bad)
  • Can the remember-me token be reused forever, or does it expire and rotate? Is it invalidated on logout and on password change?
  • Is the cookie Secure, HttpOnly and SameSite (see Part 7, SESS-02)?

Fix: store only an opaque, random, expiring token server-side; never store credentials client-side; set secure cookie attributes; and revoke the token on logout and password change.


WSTG-ATHN-06: Browser Cache Weaknesses

What it checks: whether sensitive authenticated pages are stored in the browser cache or history, where the next person on a shared computer could read them with the Back button.

How to test:

1
2
3
# Sensitive pages should forbid caching
curl -sI https://example.com/account/statement | grep -iE 'cache-control|pragma|expires'
# Want: Cache-Control: no-store   (and no long max-age)

After logging out, press Back: if account pages still render from cache, that is the finding. Also check that credentials are not kept in the URL (they end up in history and logs).

Fix: send Cache-Control: no-store (and no-cache) on authenticated pages, do not put sensitive data in URLs, and expire the session fully on logout.


WSTG-ATHN-07: Weak Password Policy

What it checks: whether the application resists guessing by enforcing reasonable password rules.

How to test: try to set passwords that should be rejected and see what gets through:

  • Very short passwords, single characters, 123456, password, the username, the site name.
  • The top entries of common breach lists (rockyou.txt, SecLists).
  • Check whether the policy blocks known-breached passwords (the modern NIST SP 800-63B recommendation) rather than forcing arbitrary complexity.

Fix: follow NIST SP 800-63B: a minimum length around 8–12, allow long passphrases and all characters, block breached and common passwords (e.g. Have I Been Pwned’s Pwned Passwords API), drop forced periodic rotation and composition rules, and offer MFA.


WSTG-ATHN-08: Weak Security Question Answers

What it checks: security questions used for recovery or as a second factor, which are often weaker than passwords.

How to test:

  • Pre-set questions (“mother’s maiden name”, “first school”, “favourite colour”) have few possible answers and are often discoverable through OSINT or social media.
  • Self-generated questions: users pick easy ones (“1+1?”).
  • Brute-forcible answers: is the number of answer attempts limited? Favourite colour has about a dozen realistic answers.

Fix: avoid security questions as a sole recovery method; prefer email/SMS tokens or MFA. If they must exist, treat answers like passwords (rate-limited, stored hashed) and let users write their own question with a free-form answer.


WSTG-ATHN-09: Weak Password Change and Reset Functionality

What it checks: the self-service password change and reset flows, both heavily targeted because they can hand over an account directly.

Password reset (“forgot password”) tests:

  • User enumeration: does the response differ for known vs unknown emails? (see Part 4, IDNT-04)
  • Token quality: is the reset token long and random, or is it a short number, a timestamp, or a weakly-encoded value that can be predicted or brute-forced? Does it expire quickly and work only once?
  • Host-header poisoning: if the reset email is built from the Host header, an attacker changes it so the link points to their server, capturing the token when the victim clicks.
1
2
3
4
5
POST /forgot-password HTTP/1.1
Host: attacker.example                      <- reset link may use this host
Content-Type: application/json

{"email":"victim@example.com"}
  • Token leakage via the Referer header to third parties, or a token that stays valid after use.

Password change tests:

  • Does it require the current password? If not, a session-riding or CSRF attack can change it.
  • Is there CSRF protection (see Part 7, SESS-05)?
  • Can you change another user’s password by changing a user or id parameter? (an IDOR, Part 6)

Fix: uniform responses, long single-use expiring tokens, build reset links from a fixed server-side URL (never the Host header), require the current password to change it, protect with anti-CSRF, and re-authenticate for sensitive changes.


WSTG-ATHN-10: Weaker Authentication in Alternative Channels

What it checks: that every way to authenticate the same accounts is equally strong. Applications often have more than one: the main website, a mobile app, a REST/GraphQL API, a legacy portal, an IVR phone line, a partner SSO.

How to test:

  1. Map the primary mechanism (policy, lockout, MFA) on the main site.
  2. Find the other channels: mobile app endpoints (decompile or proxy the app), api.example.com, m.example.com, legacy.example.com, admin portals.
  3. Compare each channel against the primary one: does the API enforce the same lockout, MFA and password policy? Does a mobile endpoint skip the second factor? Does an old portal still accept credentials the main site has retired?
1
2
3
4
5
# Does the API enforce lockout that the website enforces? (authorised test account)
for i in $(seq 1 20); do
  curl -s -o /dev/null -w '%{http_code}\n' https://api.example.com/v1/login \
    -H 'Content-Type: application/json' -d '{"email":"testacct@example.com","password":"wrong'$i'"}'
done

What a finding looks like: the website enforces MFA and lockout, but api.example.com/login accepts unlimited password attempts with no second factor, so attackers simply use the API.

Fix: apply one consistent authentication policy across every channel, ideally through a shared authentication service, and decommission legacy channels that cannot meet it.


Worked Example: Password-Reset Poisoning via the Host Header (ATHN-09)

A reset link should be built from a value the server controls. When it is built from the incoming Host header instead, an attacker changes that header so the victim’s reset token is delivered to the attacker’s server.

Vulnerable (Python/Flask) — the link uses request.host:

1
2
3
4
5
6
7
8
9
10
@app.post("/forgot-password")
def forgot():
    user = User.query.filter_by(email=request.form["email"]).first()
    if user:
        token = secrets.token_urlsafe(32)
        save_reset_token(user, token)
        # the attacker controls request.host -> they control the link
        link = f"https://{request.host}/reset?token={token}"
        send_email(user.email, f"Reset your password: {link}")
    return "If an account exists, we've sent a link."   # (good: no enumeration)

Exploit — set the Host header to a server the attacker controls:

1
2
3
4
5
POST /forgot-password HTTP/1.1
Host: evil.attacker.site
Content-Type: application/x-www-form-urlencoded

email=victim@corp.com

The victim receives https://evil.attacker.site/reset?token=.... If they click, the attacker’s server logs the token and resets the victim’s password. Some stacks also honour X-Forwarded-Host, so test that too.

Fixed — build absolute URLs from configuration, and validate the Host against an allow-list:

1
2
3
4
5
6
7
8
9
10
11
BASE_URL = "https://app.corp.com"          # from config, never from the request

@app.post("/forgot-password")
def forgot():
    user = User.query.filter_by(email=request.form["email"]).first()
    if user:
        token = secrets.token_urlsafe(32)   # long, random, single-use, short expiry
        save_reset_token(user, token, ttl_minutes=15)
        link = f"{BASE_URL}/reset?token={token}"
        send_email(user.email, f"Reset your password: {link}")
    return "If an account exists, we've sent a link."
1
2
3
4
5
# defence in depth: reject unexpected Host headers at the edge
server {
    server_name app.corp.com;
    if ($host != app.corp.com) { return 421; }   # Misdirected Request
}

Also make the token long, random, single-use and short-lived, and never leak it through the Referer header to third-party resources on the reset page.

Real-world case. Host-header password-reset poisoning has been reported against numerous production applications (and is a staple of bug-bounty write-ups) because frameworks make request.host the path of least resistance. The same class of bug also enables web-cache poisoning (Part 8, INPV-17).


Hands-on Practice

  • PortSwigger Academy — Authentication and Host header attacks labs include password-reset poisoning and brute-force/2FA bypass.
  • Juice Shop — “Reset the password of Bender”, “Login Bender”, and the 2FA challenges.
  • DVWA — the brute-force module (with lockout off) for safe rate-limit practice.

Checklist: Authentication

ID Test Main tools
WSTG-ATHN-01 Credentials over an encrypted channel Burp/ZAP, curl
WSTG-ATHN-02 Default credentials hydra, Burp Intruder, vendor default lists
WSTG-ATHN-03 Weak lock-out mechanism Burp Intruder, custom scripts (test accounts)
WSTG-ATHN-04 Bypassing authentication schema Burp, forced browsing, sqlmap, jwt_tool
WSTG-ATHN-05 Vulnerable remember-me Burp, cookie/storage inspection
WSTG-ATHN-06 Browser cache weaknesses curl, browser Back button
WSTG-ATHN-07 Weak password policy SecLists, Pwned Passwords
WSTG-ATHN-08 Weak security question answers OSINT, Burp Intruder
WSTG-ATHN-09 Weak password change / reset Burp, token analysis, Host-header tests
WSTG-ATHN-10 Weaker authentication in alternative channels Burp, mobile proxying, API testing

Previous: Part 4 - Identity Management · Next: Part 6 - Authorization


References

Further reading

Comments

Questions, corrections or another approach? Comment with your GitHub account.

Open Research & Community Labs
صدقة جارية • Ongoing Charity

Empowering the Cybersecurity Community

All research, lab walkthroughs, and technical series on this platform remain 100% free. You can support server hosting, research environments, and lab infrastructure.

Support & Wall of Honor
اللهم اجعل هذا العمل علمًا نافعًا وصدقةً جارية، واكتب لي به الأجر والقبول، وانفع به كل من قرأه أو تعلّمه.
اللهم احفظ لي والديّ وأهلي، وبارك في أعمارهم وصحتهم، وأدم عليهم نعمة الصحة والعافية، ولا تريني فيهم بأسًا يبكيني.
Dedicated as ongoing charity and beneficial knowledge. May Allah bless my parents and family, protect them, and grant them lasting health and happiness.