Join our Newsletter — 33% off our NHI Course
Authentication, Authorisation & Trust

Cookie

← Back to Glossary
By NHI Mgmt Group Updated October 23, 2026 Domain: Authentication, Authorisation & Trust

A cookie is a small piece of data a website stores in a browser to remember a user, session, or preference. In identity and security contexts, cookies often carry session identifiers, so they must be protected against theft, replay, and cross-site attacks that can expose authenticated access.

Cookies are simple browser-side state, but security questions turn on what the cookie represents, how it is scoped, and whether it can be replayed by someone who steals it. A session cookie is effectively a bearer token unless the application adds stronger binding and validation.

The key security idea is that a cookie is not just storage, it is a trust signal. If the browser sends it automatically, the application may treat the request as authenticated, so the confidentiality and integrity of the cookie directly affect account access.

How Cookies Support Authentication and Session State

Web applications use cookies to keep users signed in across requests because HTTP is stateless. After login, the server commonly issues a session identifier in a cookie, and the browser returns it on later requests to prove continuity of the same session.

This design reduces repeated logins, but it also creates a high-value target. If an attacker obtains the cookie, they may not need the password at all, because the session can already be authenticated. That is why cookie handling is part of the broader authentication surface, not just a browser convenience.

Common Security Properties of Cookies

Secure cookie handling depends on a few core attributes: confidentiality in transit, restriction to the right host and path, and limiting when the browser sends the cookie. Security-sensitive cookies should be protected with transport encryption and with flags and scope controls that reduce exposure to script access and cross-site abuse.

Cookie design also matters for session integrity. Long-lived session state increases replay risk, while weak scoping can let unrelated applications or subdomains receive data they should not see. Good practice is to treat the cookie as sensitive authentication material, because it can represent the user’s active session, not just a preference setting.

How Cookies Become a Security Control Problem

Cookies sit at the boundary between the browser and the application, so their security depends on both sides. A well-configured application can still be exposed if the browser session is stolen through malware, injected script, network interception on an unprotected channel, or a cross-site request path that reuses authenticated state.

That is why cookie security is really session security: the cookie is the container for trust, and the trust can be abused if the cookie is replayed, guessed, leaked, or accepted in the wrong context. The application must assume the cookie may be intercepted and design accordingly.

Risk and Threat Considerations

Cookie compromise can lead to immediate account takeover because many applications treat the cookie as proof of an already authenticated session. The main risks are theft, replay, and cross-site abuse, which can expose the user’s existing privileges without breaking the password itself.

Failure mechanism: An attacker captures or forces reuse of a valid session cookie, then sends requests that the application accepts as authenticated because the cookie still maps to an active session.

Impact: The attacker can impersonate the user, access protected data, perform actions on the user’s behalf, and sometimes persist until the session expires or is revoked.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP API Security Top 10 addresses the attack and risk surface, while NIST SP 800-53 Rev 5 and OWASP ASVS set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST SP 800-53 Rev 5IA-2 — Identification and Authentication (Organizational Users)Cookies often carry the session state used after user authentication.
IA-5 — Authenticator ManagementCookie values can function as bearer-like authenticators that must be protected and rotated.
SC-8 — Transmission Confidentiality and IntegrityCookies used in authenticated sessions should be protected in transit from interception.
Recommendation — Protect session cookies as part of user authentication and session handling. Treat session cookies as authentication material and limit their lifetime. Encrypt traffic so session cookies cannot be intercepted in transit.
OWASP ASVSV7 — Session ManagementCookies are the usual carrier for web session state and are governed by session security requirements.
V3 — Web Frontend SecurityBrowser-side cookie exposure intersects with cross-site and script-driven abuse.
Recommendation — Apply session management controls to cookie creation, scope, lifetime, and invalidation. Harden the browser-facing application to reduce cookie theft and cross-site abuse.
OWASP API Security Top 10API2 — Broken AuthenticationIf a cookie carries API session state, theft or replay becomes an authentication failure.
Recommendation — Verify that cookie-backed API sessions cannot be replayed after compromise.

Practitioner Guidance

Why practitioners should care: Cookie security is session security, so the protection level should match the sensitivity of the account or workflow the cookie unlocks. Use short-lived sessions for higher-risk functions, and treat the cookie value as sensitive authentication material rather than harmless browser storage.

What to watch for: Look for cookies exposed to scripts, sent across unencrypted channels, shared across overly broad domains, or reused longer than necessary. Those conditions usually signal that the application is making the session easier to steal or replay than it needs to be.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on October 23, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org