← Web Application Security tutorial

Web Application Security

Authentication & Session Security

Logging in proves who someone is once; a session is how the site remembers that for every request afterward, usually via a cookie containing a session ID. If that cookie leaks, an attacker doesn't need a password at all — they can just reuse the session ID and the site will treat them as the real user.

A few practices that keep sessions from leaking: marking session cookies HttpOnly (so JavaScript, including an XSS payload, can't read them), Secure (so they're only ever sent over HTTPS, never in the clear), issuing a brand new session ID after login rather than reusing a pre-login one, and expiring sessions after a period of inactivity so a stolen cookie doesn't stay valid forever.

Ready to go further?

These free tutorials are a preview, our Cybersecurity cohort covers it in depth, with a real project and a cohort alongside you. Closes Nov 30

Enroll in Cybersecurity

Cookie preferences

Choose what you're comfortable with. You can change this any time from the footer.

Don't miss out

Ready to build something real?

Create a free account to enroll in a track, and get notified the moment a cohort opens.

Create free account