pentesting, updated
Testing Browser Storage
Check what sensitive data ends up in localStorage, sessionStorage or IndexedDB, where it's readable by any script on the page.
Goal
Confirm tokens and sensitive data aren’t stored in a location any injected script can read.
How to test
Inspect what the app writes client-side (DevTools → Application → Storage, or):
console.log(JSON.stringify(localStorage));
console.log(JSON.stringify(sessionStorage));
What to look for
A session token, API key, or PII sitting in localStorage/sessionStorage — any XSS anywhere on the origin can read it directly (unlike an HttpOnly cookie).
Notes
This is why HttpOnly cookies are generally preferred for session tokens over localStorage — note it as a design recommendation even without a concrete XSS to pair it with.
References
- OWASP WSTG-CLNT-11 — Testing Browser Storage.