Session cookies missing Secure, HttpOnly or SameSite

Last updated November 13, 2026
Steps
- Log in to your own app, open DevTools → Application (or Storage) → Cookies, and look at every cookie that identifies a user: session IDs, auth tokens, refresh tokens. Check the Secure, HttpOnly and SameSite columns, plus Domain and Path.
- Search the code for where those cookies are set: res.cookie, cookies().set in Next.js, Set-Cookie headers, session middleware options (express-session, iron-session, NextAuth/Auth.js), and any document.cookie writes in the frontend.
- Set Secure on every session cookie so it is only sent over HTTPS. OWASP notes that forcing HTTPS on the site is not enough by itself if the cookie lacks Secure.
- Set HttpOnly so JavaScript cannot read the cookie through document.cookie. If the frontend “needs” to read the token, that is a design smell—move the auth check to the server instead.
- Set SameSite explicitly: Strict where it does not break your flows, otherwise Lax. Only use SameSite=None when a cross-site flow truly needs it, and then always with Secure. Keep CSRF tokens or Origin checks too—OWASP calls SameSite defense in depth, not a replacement.
- Narrow the scope: leave Domain unset unless subdomains must share the cookie, and consider the __Host- name prefix for session cookies (it requires Secure, Path=/ and no Domain). MDN notes that browsers without prefix support do not enforce those guarantees.
- Stop setting auth cookies from client-side JavaScript; set them in the server response. Then log out and back in and recheck the attributes in DevTools on the production domain.
Why it matters
Session cookies are the keys to a logged-in account. MITRE files missing Secure on sensitive HTTPS cookies as CWE-614, missing HttpOnly on cookies holding sensitive data as CWE-1004, and a missing or insecure SameSite value as CWE-1275. OWASP’s Session Management Cheat Sheet explains the practical effect: without Secure, an attacker on the network can trick the browser into sending the session ID over plain HTTP; without HttpOnly, one cross-site scripting bug can read the session ID; and SameSite limits when the browser attaches the cookie to cross-site requests. MDN’s Set-Cookie reference documents each attribute and the cookie name prefixes. This page is for checking and fixing cookies on an app you own.
Sources
MITRE CWE-614: Sensitive Cookie in HTTPS Session Without 'Secure' Attribute — https://cwe.mitre.org/data/definitions/614.html
MITRE CWE-1004: Sensitive Cookie Without 'HttpOnly' Flag — https://cwe.mitre.org/data/definitions/1004.html
MITRE CWE-1275: Sensitive Cookie with Improper SameSite Attribute — https://cwe.mitre.org/data/definitions/1275.html
OWASP Cheat Sheet: Session Management — https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html
MDN: Set-Cookie header — https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Set-Cookie
Checked at the source on November 9, 2026.
Related patterns
- JWTs or session tokens stored in localStorage
- Cookie-based login with no CSRF protection on state-changing requests
- Sessions that stay valid after logout, password change or timeout
- CORS that trusts any origin (and sends cookies)
- Missing security headers on a vibe-coded site
- Rendering user or AI output as raw HTML (XSS)
- Dangling DNS records that let someone take over your subdomain
Found a problem you'd rather not fix yourself?
Tell us what's wrong. A StorenTech engineer reviews your app and replies with a fixed quote, so you know the cost before any work starts.
Get it fixed by StorenTechVibe Security Weekly
One email a week with new failure patterns and how to fix them.
By joining you agree we may email you this newsletter. See our privacy policy. Free. Unsubscribe anytime. We'll never sell your email.