TOPIC 09/6214 MINNOT STARTED

Cookies and sessions

A site remembers who you are with a small code the browser keeps and sends back. Testers check that the code is set, kept, refused when wrong and removed at sign-out.

L1–L4 are part of the Pro pass

L0 Explain simply

Analogy: a cloakroom ticket. You hand in your coat and get a small ticket. The ticket contains only a reference number, but possession of that number can still give access to your coat, and the staff use the number to find your coat on the rail.

Daily List is a to-do list app. When Lily signs in, the server makes a record of her visit and hands her browser a ticket. The ticket is a cookie, a small piece of data that a site stores in the browser. The number on it is the , a code that links Lily's requests to her one signed-in visit.

From then on the browser sends the cookie on requests that match its domain, path, security and browser policy conditions. The server reads the number, finds Lily's record and knows who is asking. Lily does not have to type her password again on each page.

Tom, the tester, deletes the cookie in his browser's tools and refreshes the page, and Daily List asks him to sign in again. That supports the cookie-based design described here; the observation alone does not rule out other sign-in mechanisms or prove server-side revocation.

The picture has a limit. A cloakroom attendant sees your face as well as the ticket. A server sees only the ticket, so anyone who holds a copy of it can look like you. That is why the ticket needs care.

(SYNTHETIC / TRAINING ONLY: Daily List and every person named in this lesson are invented.)

PLAIN WORDS · 2 in this section
cloakroom
a room where coats and bags are left safely
revocation
the act of officially withdrawing something given earlier

PICTURE IT

The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.

THE REAL JOB Checking how a site remembers a visit: the ticket is set, kept, refused when wrong and removed at sign-out.

  1. Set at sign-in
  2. Kept while signed in
  3. Refused when wrong
  4. Removed at sign-out
Four checks

HOW THE PICTURE MAPS

How each part of the picture matches the software
In the pictureIn the software
Cloakroom ticketCookie
The number on the ticketSession identifier
The coat on the railThe visit's details on the server
A drawer of your ownLocal storage

WHERE THIS PICTURE STOPS

  • The attendant sees your face as well as the ticket. A server sees only the ticket.
  • A coat stays on the rail. A visit ends and its details are removed.
  • A ticket cannot be guessed at random. A weak code can be.

HOOK

Set, kept, wrong, removed.

REMEMBER IT THIS WAY

A contrast: two neighbours told apart by one test.

The cookie is the ticket, not the coat, and its opaque reference is still secret. Removing this browser copy does not prove that the server revoked a copied identifier.

What each part of the trick stands for
In the trickWhat it stands for
the ticketThis opaque-ID cookie holds a secret session reference
the coatThe server finds the record of the visit

TELL A FRIEND

A cloakroom ticket carries a reference, but a copy may still claim the coat. This opaque session cookie carries a secret identifier that lets the server find the visit.

OFTEN MIXED UP WITH Reading the network tab. The network tab lesson shows requests and headers. This lesson reads the cookie that travels in them.

PRACTISE AND KEEP

Sources for this topic — 9 sources
  1. Market practice

    Using HyperText Transfer Protocol (HTTP) cookies (Mozilla developer docs) ↗ — Mozilla (developer documentation) · After sign-in the server sets a cookie holding a session identifier and the browser sends it back with later requests; a cookie with no expiry is a session cookie; setting the expiry in the past removes a cookie; a new session cookie should be sent at sign-in to stop session fixation (search excerpt, page not opened)

    Per the search excerpt, after sign-in the server sets a cookie holding a session identifier and the browser sends it back with later requests. Without an expiry a cookie is a session cookie. A cookie is removed by setting its expiry in the past. The page advises sending a new session cookie at sign-in to stop session fixation. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  2. Market practice

    Session management cheat sheet (Open Worldwide Application Security Project) ↗ — Open Worldwide Application Security Project (OWASP) · The session identifier must be renewed after any change in privilege such as sign-in, and the old one destroyed, which prevents session fixation (search excerpt, page not opened)

    Per the search excerpt, the session identifier must be renewed after any change in privilege such as sign-in, and the old one destroyed; this prevents session fixation. Practitioner guidance, not a standard. · Checked 2026-11-06

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

    Verification supplement, 6 November 2026: Actual introduction/session-ID properties opened: authenticated session identifier is itself a secret capable of impersonation; opaque does not mean secret-free.

  3. Market practice

    Testing for cookies attributes (Open Worldwide Application Security Project Web Security Testing Guide) ↗ — Open Worldwide Application Security Project (OWASP) · Session cookies should carry the Secure and HttpOnly attributes, and a tester can check them in the browser's cookie view or with an intercepting proxy (search excerpt, page not opened)

    Per the search excerpt, session cookies should carry the Secure and HttpOnly attributes, and a tester can check them in the browser's cookie view or with an intercepting proxy. Practitioner guidance, not a standard. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  4. Market practice

    Window: localStorage property (Mozilla developer docs, Web APIs) ↗ — Mozilla (developer documentation) · Local storage keeps key and value pairs for a site, has no expiry time, survives closing the browser and stores only strings (search excerpt, page not opened)

    Per the search excerpt, local storage keeps key and value pairs for a site, has no expiry time, survives closing the browser, and stores only strings. Session storage is cleared when the page session ends. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  5. Market practice

    Insufficient session expiration (Open Worldwide Application Security Project Periodic Table of Vulnerabilities) ↗ — Open Worldwide Application Security Project (OWASP) · Insufficient session expiration: a session that stays valid too long, or after logout, lets someone reuse it (registry entry)

    Per the search excerpt, the root cause is a missing inactivity timeout or absolute timeout, a timeout that is too long, or a logout that does not end the session. The page is an archived wiki entry. Practitioner guidance, not a standard. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Archived wiki page. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  6. Market practice

    Session management cheat sheet (Open Worldwide Application Security Project) ↗ — Open Worldwide Application Security Project (OWASP) · Session-ID properties and introduction: session identifier is a secret capable of impersonation; logout revocation and cached disclosure require distinct observations (actual relevant primary passages opened 6 November 2026).

    Per the search excerpt, the session identifier must be renewed after any change in privilege such as sign-in, and the old one destroyed; this prevents session fixation. Practitioner guidance, not a standard. · Checked 2026-11-06

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

    Verification supplement, 6 November 2026: Actual introduction/session-ID properties opened: authenticated session identifier is itself a secret capable of impersonation; opaque does not mean secret-free.

  7. Market practice

    Using HyperText Transfer Protocol (HTTP) cookies (Mozilla developer docs) ↗ — Mozilla (developer documentation) · Complete substantive cookie article read7November2026 (live page modified17September2026): scoped sending, expiration/session restore, matching deletion, attributes. Browser lifetime differs from server session validity; not binding legal guidance.

    Per the search excerpt, after sign-in the server sets a cookie holding a session identifier and the browser sends it back with later requests. Without an expiry a cookie is a session cookie. A cookie is removed by setting its expiry in the past. The page advises sending a new session cookie at sign-in to stop session fixation. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  8. Market practice

    Session management cheat sheet (Open Worldwide Application Security Project) ↗ — Open Worldwide Application Security Project (OWASP) · Complete Introduction, Session ID Content, Renew Session ID After Any Privilege Level Change, Session Expiration with all subsections and Limits of Logout on Browser Close, actually read7November2026. ID is secret; revoke session IDs server-side; distinguish cached display and continuing access.

    Per the search excerpt, the session identifier must be renewed after any change in privilege such as sign-in, and the old one destroyed; this prevents session fixation. Practitioner guidance, not a standard. · Checked 2026-11-06

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

    Verification supplement, 6 November 2026: Actual introduction/session-ID properties opened: authenticated session identifier is itself a secret capable of impersonation; opaque does not mean secret-free.

  9. Market practice

    Window: localStorage property (Mozilla developer docs, Web APIs) ↗ — Mozilla (developer documentation) · Complete article read7November2026, modified12October2026: origin-bound strings, ordinary persistence, private session lifetime, policy exceptions; no guarantee of indefinite availability.

    Per the search excerpt, local storage keeps key and value pairs for a site, has no expiry time, survives closing the browser, and stores only strings. Session storage is cleared when the page session ends. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.