CYBER LIBRARY
Explore the bootcamp
Adversarial thinkingIntermediate

Sessions and cookies

Follow a browser session from login to logout, and understand cookie protections, expiry, revocation, and server-side permission checks.

3 min readUpdated 12 Oct 202624 connections
Markdown

Remembering a login across requests

A session connects multiple requests to an established application context. After Authentication, the application may issue a session identifier that the browser sends with later requests. The server uses it to recognize the session without requiring the full login procedure for every page.

A cookie is one mechanism for carrying state between a browser and a service. Not every cookie is an authentication credential: some store preferences or other application state. A session cookie can nevertheless be as sensitive as the account access it represents. Someone possessing a usable stolen token may not need the original password.

A fictional booking journey

Imagine Noor signs into a training portal and opens a booking page. The browser sends its session cookie, the server recognizes the session, and the application checks whether Noor may view that booking. Recognition and permission are separate steps.

When Noor changes the booking, the application also needs to protect the action against inappropriate cross-site requests and other misuse. Merely observing that a cookie arrived does not establish that Noor intentionally initiated the action. Cross-site request forgery explains that related risk.

Finally, Noor logs out. The meaningful question is whether the session credential is no longer accepted, rather than whether the browser displays a signed-out page. Removing a cookie from one browser and revoking a credential on the server are different operations.

The Secure attribute restricts transmission of a cookie to secure connections. HttpOnly prevents ordinary page scripts from reading it through the cookie API. SameSite controls cookie sending in cross-site contexts. Scope, lifetime, and other settings also influence where the browser sends a cookie.

These protections have limits. HttpOnly does not make malicious script executing inside an application harmless: it may still cause actions in the user's session. SameSite is useful defense in depth but is not a universal replacement for the application's request protections. Choose settings according to the actual flow rather than copying an unexplained configuration.

Session lifetime is an explicit policy

A service can use idle and absolute time limits, refresh behavior, and revocation mechanisms. Those choices affect both convenience and the useful lifetime of a stolen credential. A browser window closing is not a complete security policy, particularly when browsers can restore browsing state.

Consider Noor resetting a password on a second device. Does that revoke the first device's session? The answer depends on implementation and policy. For suspected compromise, responders need to know the real behavior instead of assuming a password change closes every access route. Incident containment connects that question to incident handling.

Inspect the boundary in a training application

Use developer tools on an application you own to identify which cookie carries the session, which protections are set, and when it changes. Avoid copying real session values into chat, screenshots, or shared notes. Record names and behavior rather than secrets.

Test sign-in, logout, expiry, and a documented account-security change with two test browsers. State what each observation demonstrates and what remains unknown. Continue with HTTP and HTTPS for the request model and Authentication for the identity process that begins the session.

GO TO THE SOURCE

References & further reading

Original explanations, with primary references for deeper study.

OWASP: Web Security Testing GuideOWASP: Session ManagementMDN: Using HTTP cookies
EXPLORE THIS IDEA’S CONNECTIONS

A small part of a bigger picture.

21 notes · 36 connections
100%
Sessions and cookies · depth 1
Drag to pan · Pinch or use +/− to zoom · Click to preview · Double-click to read
Browse notes as a list (21)
FOLLOW ANOTHER THREADExplore the rest of the library
Start with a concept. Follow its connections.
Detection & responseAbuse Elevation Control MechanismElevation-control abuse bypasses or misuses mechanisms governing privileged execution.Making change happenAcceptance criteriaDefine observable conditions for a deliverable to be accepted.Security essentialsAccess controlUnderstand subjects, resources, permissions, and enforcement through a shared-drive example, including how access changes over time.Detection & responseAccess Token ManipulationAccess token manipulation changes or adopts operating-system security contexts.Risk & resilienceAccount Access RemovalAccount access removal disrupts legitimate users by changing, deleting, or restricting their identities.Evidence & investigationAccount DiscoveryAccount discovery enumerates identities available in a system or environment.Detection & responseAccount ManipulationAccount manipulation changes identity settings to preserve or expand access.Adversarial thinkingAcquire InfrastructureInfrastructure acquisition obtains domains, servers, or other resources used to support operations.Adversarial thinkingActive ScanningActive scanning probes target infrastructure to learn reachable services or weaknesses.Security essentialsAdversary in the middleAn intermediary may observe or alter a communication path.Security essentialsAESA symmetric block cipher whose safe use depends on its mode and implementation.Making change happenAgile deliveryUse short feedback cycles to adapt toward a useful outcome.