Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Testing for Session Puzzling
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-03 | ✗→✓ | ▲ Improved | 39% | 0% |
| case-04 | ✗→✓ | ▲ Improved | -16% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 31% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 61% | 0% |
| case-22 | ✗→✓ | ▲ Improved | 46% | 0% |
WSTG-SESS-08
Testing for Session Puzzling (Session Variable Overloading)
Session puzzling occurs when session variables are used for multiple purposes across different application flows. Attackers can manipulate session state in one flow to affect behavior in another, potentially bypassing authentication or authorization controls.
bash# Track session variables across different flows # 1. Login flow # 2. Registration flow # 3. Password reset flow # 4. Account verification flow # Look for common session variables: # - user_id, email, username # - authenticated, verified # - role, permissions # - step, stage, phase
python#!/usr/bin/env python3 import requests class SessionPuzzlingTester: def __init__(self, base_url): self.base_url = base_url self.findings = [] def test_password_reset_bypass(self): """Test if password reset flow can bypass login""" print("[*] Testing password reset flow manipulation...") session = requests.Session() # Start password reset for target account session.post(f"{self.base_url}/forgot-password", data={"email": "victim@example.com"}) # Try to access authenticated areas without completing reset response = session.get(f"{self.base_url}/dashboard") if response.status_code == 200 and 'login' not in response.url.lower(): print("[VULN] Access to dashboard via password reset flow!") self.findings.append({ "issue": "Session puzzling via password reset", "severity": "Critical" }) def test_registration_bypass(self): """Test if registration flow can bypass verification""" print("[*] Testing registration flow manipulation...") session = requests.Session() # Start registration session.post(f"{self.base_url}/register", data={"email": "test@test.com", "password": "pass123"}) # Try accessing without email verification response = session.get(f"{self.base_url}/dashboard") if response.status_code == 200: print("[VULN] Access without email verification!") def test_step_manipulation(self): """Test multi-step flow manipulation""" print("[*] Testing step manipulation...") session = requests.Session() # Skip to final step response = session.post(f"{self.base_url}/checkout/confirm", data={"order_id": "12345"}) if response.status_code == 200: print("[VULN] Checkout step bypass possible") # Usage tester = SessionPuzzlingTester("https://target.com") tester.test_password_reset_bypass() tester.test_registration_bypass() tester.test_step_manipulation()
python# Use separate namespaces for different flows session['auth'] = { 'user_id': user.id, 'authenticated': True } session['password_reset'] = { 'email': email, 'token': token, 'verified': False } # Never share variables between flows # Clear flow-specific data when flow completes or is abandoned
| Finding | CVSS | Severity | | --------------------------------- | ---- | -------- | | Auth bypass via flow manipulation | 9.8 | Critical | | Step bypass in multi-step flow | 7.5 | High |
| CWE ID | Title | | ----------- | ----------------------------------------- | | CWE-488 | Exposure of Data Element to Wrong Session |
[ ] Session variables mapped per flow
[ ] Password reset flow tested
[ ] Registration flow tested
[ ] Multi-step flows tested
[ ] Flow isolation verified
[ ] Findings documentedOther measured skills in the registry, with their headline benchmark lift.