← field notes

The stolen cookie that walks straight past your password

session-hijacking session-tokens token-binding account-security

The moment you finish logging in to anything that matters, the site hands your browser a small piece of text and asks it to hold on. Nobody shows it to you. Nothing announces it. From that point forward, that string, usually a session cookie, is the thing keeping you signed in. The password you typed and the code you approved have already left the stage.

I run mobile proxy lines on carrier SIMs in Singapore and a rack of Android phones that people rent by the hour, so I spend my working day on networks where sessions get weighed and re-weighed constantly by the systems described below. This machinery decides, several times an hour, whether traffic crossing my lines still belongs to the person who started it. Watching it fire from the network end teaches you where the real value in an account sits, and it is nowhere near the password.

Why the token has to exist

The web forgets. Underneath every page view, each request your browser sends arrives at the server as a stranger knocking, with no memory of the previous knock. Without something carried between those knocks, you would have to prove your identity on every click. Password and second factor, every single time. Nobody would tolerate that for an afternoon.

So the expensive proof happens once, at login, and the server issues a token that stands in for it afterwards. The token stitches thousands of separate requests into one continuous session. Staying logged in, as an experience, is that one small object doing its job over and over in the background.

What it actually proves

A festival wristband is the cleanest picture of it. At the gate, security does the slow work, checking your ticket and your ID and deciding whether you get in at all. They do it once. After that they fasten a band on your wrist, and for the rest of the weekend you flash the band. The band never proves who you are. It proves that someone already checked.

A session token is that band. It represents a finished verdict: whoever holds this already passed every check we run. Your password is a question the server asks. The token is the answer, already accepted and filed. Picture the account as a vault with several locked doors, the password guarding one and the one time code guarding the next, and the token as the thing you are handed after walking through the last of them. It sits behind the locks. That placement is the entire point of it, and the entire danger.

The part your second factor never sees

People pour their worry into the front door. A long password, two factor switched on, a code that dies in thirty seconds. All of that matters at the moment of login, and only at that moment. The token minted afterwards outlives the whole ceremony.

If a token is taken, none of the front door protections come into play, because from the server’s point of view the front door was opened correctly, by you, a moment ago. No login is being attempted, so no second factor fires. The session simply continues, in someone else’s hands. A stolen password still has to face the code on your phone. A stolen token has already been waved past it.

That gap is the whole reason tokens get stolen. The token is plain data sitting on your device, and hostile software on a compromised machine goes hunting for exactly that data, precisely because it is worth more than the password it descends from. Whoever ends up holding a live token can, in principle, resume your session from their own browser without touching a single credential. They walk in wearing the wristband.

Making the copy worthless

Defenders start from an uncomfortable admission: data that exists on a device can be copied off that device. If the machine is fully compromised, the token can be read, and wishing otherwise changes nothing. So the serious defenses stop betting on the token never leaving. They aim instead at making a stolen copy useless the instant it lands anywhere other than your own hands.

The first technique is binding. Rather than issuing a portable claim that works from anywhere, the server ties the token to the context it was born in, to the characteristics of the browser and machine it was issued on, or to properties of the connection it first arrived over. The stronger versions are cryptographic, pairing the token with a secret key held in the device itself, a key that cannot be exported along with it. A thief who copies the token alone is carrying half of something. Dropped into a strange browser on a strange machine, it matches nothing, and the server rejects it without ceremony. The theft still happened. The loot arrives dead.

A body cannot cross an ocean between clicks

The second defense watches behavior. Your session is active in one city. Four minutes later the same session is active from a place two thousand miles away. When one session lights up in two distant places inside a window no traveler could cover, the simplest reading is a single token being used in two hands at once, and systems that spot the pattern, usually filed under the name impossible travel, treat it with corresponding seriousness. A bank card triggers the same instinct when it gets swiped in two countries an hour apart.

The idea generalizes well past geography. A quiet profile accumulates around every account, covering the devices you use, the places you appear from, the rhythm of your ordinary day. A session that stops fitting that shape draws attention even when it never leaves town. A token behaving unlike its owner is the tell defenders trust most.

Tokens that refuse to grow old

The third defense is lifespan. A stolen key matters far less if it stops working within minutes, so sessions are given short lives and constant, silent rotation. The token in your browser gets swapped for a fresh one again and again without you noticing, and any copy a thief captured goes stale almost as quickly as it could be used.

Rotation carries a quieter benefit on top. Suppose the genuine token and a stolen copy are both alive when the server rotates. The legitimate browser moves on to the new token. The retired one should never be seen again, so the moment it reappears, the server learns something definite: two parties are holding what should have been one. It can slam the session shut for both. The thief’s own reuse becomes the evidence that gives them away.

The second wall, and the kill switch

The fourth defense assumes the others have already failed. A session might be riding on stolen goods right now, so being logged in stops counting as blanket permission. Reading and browsing ride on the token alone. Anything dangerous, moving money, changing the password, enrolling a new recovery device, switching off a protection, triggers a demand for fresh proof in the moment: the password again, or an approval on your phone, now rather than an hour ago at login. The industry calls this stepping up. The token is enough to wander and never enough to wreck.

Behind all of it sits the bluntest tool available, revocation. The session exists on the server’s terms, and the server can end it. The button that signs you out of every device at once turns each outstanding token, stolen copies included, into a meaningless string. It is one of the most underrated controls an ordinary account holder owns, and almost nobody presses it until something has already gone wrong.

When the defense catches the wrong person

Every one of these mechanisms works by distrusting change, and honest life is full of change. You land in another country and impossible travel watches your session teleport. You switch on a VPN for perfectly good reasons and appear to change nations between clicks. Your phone hops from wifi to mobile data mid task and the connection underneath your token transforms.

I watch this from the network side daily. A phone roams, a carrier line rotates its address, and a strictly bound session dies on the spot for a user whose only offense was walking out of wifi range. Tighten the binding and stolen copies die faster, along with real sessions belonging to people who merely moved through the world. Loosen it and travelers stay logged in, along with thieves. The tuning between those two failure modes never finishes, and the people doing it live permanently on that knife edge.

The lesson underneath is a quiet reordering of what deserves your worry. Login gets all the ceremony, and login lasts seconds. Everything you actually do inside an account happens afterwards, in the long stretch where you are simply trusted on the strength of a token you have never seen and were never told about. The password you chose so carefully guards one brief moment. The token lives on the far side of it, and the real engineering in account security today is the unglamorous work of making sure that little proof still belongs to you, hour after hour, on whatever network you happen to be standing on.

More on the machinery running underneath the ordinary internet at The Hidden Internet.

Get new guides and videos first — join the Telegram channel.

watch
The Hidden Internet on YouTube

Every field note starts as a short documentary. Watch the systems in this piece explained on screen.

subscribe →
read on
More field notes

The rest of the series on how the modern internet detects, tracks, and sorts the traffic that reaches it.

browse the archive →