---
title: "Catching Compromised Cookies"
description: "Slack detects stolen session cookies by spotting session forking: a last-access timestamp is stored in both the cookie and the database, and a mismatch on a later request means more than one copy of the cookie is in use."
url: "https://swe.quest/articles/catching-compromised-cookies-83776372ceccd1c9"
canonical: "https://slack.engineering/catching-compromised-cookies/"
source: "Slack Engineering"
published: "2024-06-24"
difficulty: "medium"
kind: "Case study"
reading_minutes: 10
tags: ["identity-auth","threat-detection","appsec","system-design"]
---

# Catching Compromised Cookies

A post on [Slack Engineering](https://swe.quest/sources/slack.md), published 2024-06-24, 10 min read, Case study. Original: [https://slack.engineering/catching-compromised-cookies/](https://slack.engineering/catching-compromised-cookies/)

## Summary

Slack detects stolen session cookies by spotting session forking: a last-access timestamp is stored in both the cookie and the database, and a mismatch on a later request means more than one copy of the cookie is in use. Early false positives from clients that never received refreshed cookies were cut by matching IP addresses and by a two-phase, idempotent "session candidate" cookie that is promoted only after the client proves it stored the new value. In-flight request races are handled by ignoring timestamps right after an update. Database reads are skipped while a cookie is freshly issued. High-risk detections, scored using device and network signals, go to the audit log for customers' SIEMs.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Identity & auth](https://swe.quest/tags/identity-auth.md) (Security)
- [Threat detection](https://swe.quest/tags/threat-detection.md) (Security)
- [Application security](https://swe.quest/tags/appsec.md) (Security)
- [System design](https://swe.quest/tags/system-design.md) (Architecture & design)

## Prerequisites

- HTTP cookies and sessions
- Session hijacking basics

## Keywords

Slack, session cookies, session forking, audit log

## Related posts

- [Proactive Measures Against Password Breaches and Cookie Hijacking](https://swe.quest/articles/proactive-measures-against-password-breaches-and-cookie-hijacking-c53a75efe0f4bdb5.md): Slack Engineering · 2024-06-28 · Easy · 6 min read · Identity & auth, Threat detection, Security
  Slack automatically invalidates user credentials that show up in threat intelligence feeds from breaches, dark web forums, botnets and infostealer malware.
- [Slack Audit Logs and Anomalies](https://swe.quest/articles/slack-audit-logs-and-anomalies-9433e81574c3d83d.md): Slack Engineering · 2024-12-09 · Medium · 8 min read · Threat detection, Observability, Security
  Slack Enterprise Grid audit logs record platform actions and include anomaly events that flag unusual behaviour such as new user agents, excessive downloads, unexpected scraping, IP address changes and session fingerprint mismatches.
- [Testing cookie behavior across hundreds of web surfaces with our in-house auditor](https://swe.quest/articles/testing-cookie-behavior-across-hundreds-of-web-surfaces-with-our-in-house-474b16dbccccd373.md): Dropbox Tech · 2026-08-31 · Medium · 9 min read · Privacy, Testing, Browsers
  Dropbox built an automated cookie auditor that uses Playwright to visit its 200+ web surfaces as a fresh, privacy-conscious visitor, running separate US, EU and Global Privacy Control scenarios that record cookies before interaction, decline non-essential cookies via the underlying consent controls (across 22 languages), reload, and verify the preference persists.
- [Incident Report: March 30th, 2026 — Authenticated user data cached](https://swe.quest/articles/incident-report-march-30th-2026-authenticated-user-data-cached-6873088e4b983942.md): Railway · 2026-03-30 · Easy · 2 min read · Incidents & postmortems, Caching, CDN & edge, Privacy, Deployment
  A CDN configuration change meant to enable Surrogate Keys for per-domain caching accidentally turned on edge caching for about 0.05% of Railway domains that had CDN disabled.
- [When protections outlive their purpose: A lesson on managing defense systems at scale](https://swe.quest/articles/when-protections-outlive-their-purpose-a-lesson-on-managing-defense-systems-at-7fcb8ad566ecf603.md): GitHub Engineering · 2026-01-15 · Medium · 5 min read · Incidents & postmortems, Resilience, Observability, Threat detection
  Emergency protection rules added during past GitHub abuse incidents were left in place and began rate-limiting legitimate logged-out users with "Too many requests" errors.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
