Cookie without the Secure flag: two protections your login cookies lack
Last reviewed
Your login cookies are missing two simple protections.
A cookie without the Secure flag is a small piece of login data your site stores in the browser that may also travel over unencrypted connections. HttpOnly is a second flag that hides the cookie from scripts running on the page. When session cookies lack both, someone on the same network or a malicious script has an easier route to taking over a logged-in account.
Why an unprotected session cookie costs you customers
Session cookies are what keep a customer or staff member signed in. If one is copied, whoever holds it can act as that person without a password, whether that means viewing orders, changing bookings or reaching your admin area. The flags cost nothing to set, and their absence is a routine item on the security reviews larger clients run on their suppliers.
What usually causes an unprotected session cookie
- The platform or framework sets session cookies without these flags by default
- A plugin or custom login feature creates its own cookie and skips them
- The switch to HTTPS happened, but nobody revisited the cookie settings
- A developer switched the flags off while testing and never switched them back
- A proxy or caching layer rewrites cookies and strips their attributes
How to check for an unprotected session cookie yourself
- In Chrome, visit your site and sign in if it has a login area. Then right-click anywhere, pick "Inspect" and switch to the Application tab.
- Under Storage, expand Cookies and click your domain to see every cookie set for it in a table.
- Find the cookies whose names suggest a session or login, and look at the Secure and HttpOnly columns. An empty cell there means the flag is missing.
- Glance at the SameSite column as well. Lax or Strict is a good sign, while a blank or None is worth a question to your developer.
How to fix an unprotected session cookie
- Your developer lists every cookie that holds session or login data and notes which flags each one lacks.
- Your developer turns on Secure for those cookies so browsers only send them over HTTPS, usually with one setting in the platform or server.
- Your developer adds HttpOnly to the same cookies so page scripts cannot read them, and sets SameSite to Lax or Strict unless a feature genuinely needs cross-site use.
- You log out and back in, then repeat the browser check to confirm the flags now appear on each session cookie.
- Your developer sets the flags in shared configuration rather than page by page, and adds the check to the review for any new plugin or login feature.
How Prsona catches an unprotected session cookie
Prsona looks at the cookies your homepage sets, without logging in, and flags any session cookie that lacks Secure or HttpOnly protection, naming each cookie so your developer knows exactly which settings to change.
Prsona looks for an unprotected session cookie as part of website security monitoring.
See whether the cookies that keep people logged in carry the right protections.
Questions about an unprotected session cookie
What is the difference between the Secure and HttpOnly cookie flags?
Secure controls how a cookie travels: the browser only sends it over an encrypted HTTPS connection. HttpOnly controls who can read it: scripts running on the page cannot touch it, only the server can. They guard against different attacks, interception on the network and theft by script, so session cookies should carry both.
What does SameSite do on a cookie?
SameSite tells the browser whether to send the cookie when a request starts on another website. Lax, which Chrome applies when no value is set, sends it on ordinary link clicks but not on most background requests from other sites, blocking a family of forged-request attacks. Strict never sends it cross-site, and None always does, which then requires the Secure flag.