Skip to content

securitymedium

Session Cookie Audit

125 points · 0 solved

A session cookie without the right attributes can be stolen by scripts or sent along with cross-site requests. The first line is T; each next line is a Set-Cookie value like sid=abc; Path=/; HttpOnly. Attributes are separated by ;, names are case-insensitive, and whitespace around them doesn't matter.

For each cookie print name: followed by the missing protections, in this order and separated by spaces: Secure, HttpOnly, SameSite (SameSite counts only with a value of Strict, Lax or None, any case). Print name: OK if nothing is missing.

2
session=abc; Path=/; HttpOnly
lang=en; Secure; HttpOnly; SameSite=Strict
session: Secure SameSite
lang: OK
Learn the technique/learn/secure-coding-in-practice

main.py