Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 01 · Security · Think Like an Attacker · with code: Python · about 14 min to read

Watch: Auth, end to end: passwords, tokens, OAuth, OIDC, SSO and SAML
▶ VideoPlay it as a journeyTutor comes with a plan

The badge you cannot take back (the session lifecycle)

Authentication
Authentication · Open board

One real login drawn end to end: how the password is checked, and how the browser stays logged in afterwards without sending it again. That second half is a pass the browser carries. This lesson is about everything that happens to the pass after it is handed out: how long it lives, how it is renewed, and how you take it back.

Before you start. Authentication gave you two ways to remember that someone already logged in. A session is a logbook entry kept at the front desk, and the browser carries only a random number pointing at it. Crossing out the entry ends the login at once. A token is a badge stamped with the user and an expiry date in ink only the server can make. Any door can check it without calling the desk, so crossing anything out does nothing until the date on it passes. Whose page is this? (the browser security model) showed the cookie flags that keep a browser from handing the pass to the wrong page. This lesson starts where both leave off: the pass has been copied.

Lesson 7 of 39 in Security

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 25 September 2018: fifty million badges, and nobody’s password
  • Two badges at once: a short access token and a refresh token
  • The revocation window: how long a stolen badge outlives its owner
  • The thief comes back to the desk: refresh-token rotation
  • Logout that ends the session, and the id an attacker chose for you
  • The access token
  • Rotation, reuse and logout
  • A stolen token, timed
  • What real systems add
  • Remove one defence, watch its test fail

Terms it explains: session, token, revocation, access token, refresh token, revocation window, refresh-token rotation, session fixation, family, authentication (authN), authorization (authZ), bcrypt/scrypt/argon2, factors, httpOnly / Secure / SameSite, JWT, MFA, pepper, rainbow table, salt, token/JWT, TOTP, WebAuthn / passkeys, work factor.

Lab

You sign a stolen login out everywhere. How long does the thief's copy keep working?

Drag How long a badge lives from an hour to 15 minutes and watch the refreshes and the thief's window move.

Open The revocation window

A million password hashes have been stolen. How much does a slower hash actually buy you?

Drag The password from 8 letters or digits to the most common ones and watch every row collapse.

Open The slow hash

Related paper

Review Security