When a user’s privilege changes, the application should renew or regenerate the session ID and stop accepting the old one. OWASP names login, password changes, permission changes, and role elevation as common scenarios.
The defensive build rule
Use the framework’s supported session-management functions. Keep authorization and session meaning on the server. Do not encode personal data, role, permission, or other sensitive meaning into the client-side session ID.
Five tests for an owned application
- Pre-change baseline: a synthetic lower-privilege user can reach only the routes permitted to that role.
- Change privilege: perform the authorized role or permission change through the supported application flow.
- Rotate: verify the application issues a new session identifier without exposing its raw value in logs or screenshots.
- Reject old: replay only inside the isolated authorized test harness and prove the previous session ID cannot authenticate or reach sensitive resources.
- Retest new: verify the new session receives exactly the intended permissions—no more and no less.
Evidence without secrets
Record a one-way correlation fingerprint, event time, synthetic user, old-session rejection result, new-session authorization result, route class, expected status, observed status, code version, tester, and remaining exception. Never record raw session IDs, bearer tokens, cookies, real customer data, or private configuration in public copy or a public AI service.
Safe AI use
AI can help draft a local test matrix, generate synthetic users, or review redacted test output. Use only systems you own or are explicitly authorized to test. Keep real secrets local or inside an approved service, and verify generated code against the framework’s current session API and your application’s server-side authorization rules.
Repair, retest, evidence
If the old session remains valid, stop the release. Repair the privilege-change flow, server-side invalidation, or session store behavior; then rerun all five tests in a fresh context. A successful new login is not enough—the old ID must fail.
Primary source
OWASP Cheat Sheet Series — Session Management.
Discover more from Louisville Institute of Technology (LIT) - Louisville, KY
Subscribe to get the latest posts sent to your email.