
- by x32x01 ||



What Exactly is Cookie Toasting?


It’s like reheating expired food

Step-by-Step Example
Login Phase
User logs into a web app.Server creates a session cookie (e.g., session_id=abc123).
Cookie Expiry
After a set time (say 30 minutes), the cookie should expire.Normally, the server must refuse this cookie afterwards.
Attacker Intercepts
Using tools like Burp Suite / OWASP ZAP, the attacker captures the expired cookie.Instead of discarding it, they try replaying it.
Server Misconfiguration
If the server validates only the cookie value and not its expiry properly, it grants access again.
Why is Cookie Toasting Dangerous?
Attackers can stay logged in indefinitely.Perfect for account takeover in banking, e-commerce, and SaaS apps.
Defeats logout, session timeout, and token expiry features.
Can be combined with cookie theft (XSS, MITM, malware) for persistent hijacking.
🛡 Strong Defence Against Cookie Toasting
Server-Side Session Management
Don’t trust cookie expiry alone.Always validate session on the server using DB/Redis.
Invalidate Expired Sessions
Delete session data after logout or timeout.Don’t just mark it as expired, remove it.
Short-Lived Tokens + Refresh Tokens
Keep access tokens valid for a short time.Use refresh tokens with rotation and strict revocation.
Secure Cookie Flags
HttpOnly → Prevent JS theft.Secure → Only send over HTTPS.
SameSite=Strict → Stop CSRF attacks.
Session Binding
Link session to IP address, device fingerprint, and user agent.If reused elsewhere → invalidate immediately.
Monitoring & Alerts
Detect unusual cookie reuse patterns.Alert users when expired tokens are reattempted.
Real-World Case
In some bug bounty programs, hackers earned $$$ by proving that expired cookies could still be replayed. Attackers just kept reusing the same cookie, bypassing re-login. This showed how dangerous weak session handling can be. 


Cookie Toasting = Expired Cookie ≠ Safe
If servers don’t validate sessions properly → Attackers can enjoy “permanent login” without credentials.

