Device Bound Session Credentials in Go: stolen cookies stop working in minutes
A copied session cookie usually works for weeks. Here is how to make it stop in minutes, in Go.
On this page
Why a stolen cookie works anywhere
After you sign in, a website gives your browser a session cookie. Each request carries it, and the server treats whoever sends it as you. The cookie is a bearer credential: it proves nothing about the computer that sends it.
That is why infostealer malware copies cookies. It reads the browser’s cookie store, sends the file to an attacker, and the attacker loads the cookies into their own browser. They skip the password, the passkey, and the second factor, because the session already passed all three. The copy works until the cookie expires, and session cookies often last 30 days. Chrome’s own DBSC example uses max-age=2592000, which is 30 days, for the long-lived cookie it protects (Chrome for Developers).
Move the slider to see how long a thief keeps your session.
With a plain cookie, a thief keeps the session for up to 30 days. With a device-bound cookie, for up to 10 minutes: the plain cookie gives them 4,320 times as long.
How Device Bound Session Credentials work
Device Bound Session Credentials (DBSC) add a key pair to the session. The browser makes the key in secure hardware, such as the Trusted Platform Module (TPM) on Windows, and the private key never leaves it. The session cookie then lives only a few minutes. To get the next one, the browser must sign a challenge from the server with that key (W3C explainer).
The W3C specification adds two endpoints on the server and a handful of HTTP headers. A session runs in four steps:
- Registration. The sign-in response carries
Secure-Session-Registration. It lists the signature algorithms the server accepts,ES256andRS256, the path to register at, and a challenge. - Binding. The browser makes a key pair and posts a signed JSON Web Token (JWT) with the public key in
Secure-Session-Response. The server stores the key and answers with the session’s rules: its identifier, the refresh URL, and which cookie to keep alive. - Short cookie. The server sets a cookie that expires in minutes.
- Refresh. When that cookie expires, the browser holds back the request, calls the refresh URL with
Sec-Secure-Session-Id, gets aSecure-Session-Challenge, and answers with a proof signed by the key. The server checks the signature and sets a fresh cookie. Then the browser sends the held request.
At sign-in
- From the browser to the server: Sign in with a passkey
- From the server to the browser: Signed in, and bind this session
Secure-Session-Registration: (ES256 RS256);path="/auth/dbsc/start";challenge="…" - From the browser to the device key: Make a key pair
- From the device key to the browser: The public key, and the challenge signed
- From the browser to the server: POST /auth/dbsc/start
Secure-Session-Response: <dbsc+jwt with the public key> - From the server to the browser: A cookie for 10 minutes, and the refresh URL
refresh_url: "/auth/dbsc/refresh"Cookie, 10 min
When the cookie expires, every 10 minutes
- From the browser to the server: POST /auth/dbsc/refresh
Sec-Secure-Session-Id: <session id> - From the server to the browser: 403, and a fresh challenge
Secure-Session-Challenge: "…";id="<session id>" - From the browser to the device key: Sign the challenge
- From the device key to the browser: The proof
- From the browser to the server: POST /auth/dbsc/refresh
Secure-Session-Response: <proof>Signature checked - From the server to the browser: A fresh cookie for 10 minutesCookie, 10 min
A thief who copies the cookie gets a few minutes at most. When it expires, their browser can’t sign the challenge, because the key is still in your TPM. Try it:
30 dayssince the theft
- 0 min. Malware copies both of alice's session cookies to the attacker's laptop. Both copies work.
- 10 min. The bound cookie expires. alice's Chrome signs a challenge with its key and gets a fresh cookie. The copy has no key, so the server refuses it.
- 30 days. The plain copy still works. It stops only when the cookie expires.
What DBSC does not stop
DBSC limits what a stolen cookie is worth. It doesn’t clean an infected computer. The explainer says so plainly: DBSC won’t stop access to a session while the attacker still has access to the device. Malware that keeps running can ask the browser for fresh cookies the same way the page does. What changes is the attacker’s model: they can’t take the session away and use it for weeks. They must stay on the device to keep using it.
Two other limits matter when you plan a rollout:
- Devices without secure hardware. When a device has no secure key storage, Chrome falls back to standard behavior and sign-in keeps working (Chrome for Developers). The explainer puts TPM coverage at about 60% of Windows users.
- Browsers without DBSC. A browser that doesn’t know the
Secure-Session-Registrationheader ignores it and keeps the ordinary cookie.
Privacy is part of the design. Each session gets its own key, so sites can’t link your sessions to one device, and the browser clears the keys with the rest of the site’s data (Google Security Blog, W3C explainer).
Cookie theft with and without DBSC
| Question | Plain session cookie | Device-bound session |
|---|---|---|
| What a thief copies | The cookie | The cookie, but not the key, which stays in the TPM |
| How long the copy works | Until the cookie expires: often 30 days | Until the short cookie expires: 10 minutes by default in tensile-auth |
| What renewal needs | Nothing beyond the cookie | A fresh signature from the device’s key |
| Malware still on the device | Has the session | Still has the session while it runs |
| Browsers without support | No change | No change: they keep a plain cookie |
| Work on the server | None | A registration endpoint and a refresh endpoint |
Which browsers support DBSC
DBSC is a Chrome-led standard that Google designed with Microsoft. In November 2026 it works in Chromium browsers on Windows, and in no other engine.
| Browser | Support |
|---|---|
| ChromeWindows | From 145. Public from 146. |
| ChromemacOS | Reported from 147. Unverified. |
| Microsoft EdgePlatforms not named | From 145. |
| ChromeLinux, ChromeOS, Android | Not announced. |
| FirefoxAll platforms | No support. Mozilla's position is negative. |
| SafariAll platforms | No support. WebKit has no position. |
- Chrome on Windows. Chrome’s developer blog announced DBSC in Chrome 145 on Windows (Chrome for Developers). Google’s security blog of 9 April 2026 describes public availability for Windows users on Chrome 146 (Google Security Blog). The two posts name different versions: 145 is the first version that can have DBSC, and 146 is the version Google calls public.
- Chrome on macOS. In April 2026 Google said macOS would follow in an upcoming release. Secondary reports quote Chrome’s enterprise release notes for a gradual macOS rollout from Chrome 147, with the key in the Secure Enclave. I couldn’t confirm that version on a Google page, so treat it as unverified.
- Microsoft Edge. The Edge 145 release notes, for the release of 12 February 2026, list device-bound session credentials. They don’t name platforms.
- Firefox. Mozilla’s standards position on DBSC is negative.
- Safari. WebKit’s standards position has no stance, and the issue is labelled with usability concerns.
- Chrome on Linux, ChromeOS, and Android. None of the sources above announce support.
The specification is an Editor’s Draft of the W3C Web Application Security Working Group, dated 9 November 2026 (W3C).
Device Bound Session Credentials in Go with tensile-auth
tensile-auth added DBSC in v0.2.0, and this site describes v0.2.2. It is off by default. To turn it on, set DeviceBound in authroutes.Config. This is the integration guide’s one-call setup with DBSC turned on:
authroutes.Mount(mux, authroutes.Config{
Passkeys: pk,
TOTP: twoFactor,
Recovery: codes,
DeviceBound: true,
})
After sign-in, browsers that support DBSC bind the session to a hardware key. Then the cookie lives 10 minutes, set by DeviceBoundLifetime, and renews only with a proof signed by that key. Other browsers keep a plain cookie, and nothing changes for them.
The library does the protocol work for you:
- Proofs on the standard library. It checks
ES256proofs on the P-256 curve andRS256proofs with keys of at least 2,048 bits, withcrypto/ecdsaandcrypto/rsa. A proof must be a compact JWS of typedbsc+jwt, at most 8 KiB. - One binding per session. A session gets at most one registration challenge, so two racing requests can’t both bind it, and a stolen cookie can’t move the session to the thief’s key.
- Separate challenges. Registration and refresh challenges live in separate namespaces. Each works once and expires after 5 minutes.
- Every way a token arrives. A bound session’s token is refused once it is older than its lifetime plus 1 minute of clock leeway, whether it comes in the cookie or in an
Authorization: Bearerheader. - An audit trail. Bindings, refreshes, and unbindings are recorded as
device_bound,device_refreshed, anddevice_unbound. A failed proof answers401with the codedevice_proof_rejected, and the person signs in again.
Without authroutes, pass authhttp.WithDeviceBound(prefix, lifetime) to authhttp.NewMux, and serve authhttp.DeviceBound(svc) at that prefix, with the refresh route public.
How to turn DBSC off without signing anyone out
Turning a security feature off often means signing everyone out. In tensile-auth it doesn’t. When DeviceBound is false, authroutes keeps the refresh route and uses authhttp.WithDeviceBoundRetired. It binds no new sessions. Each bound browser proves its key one last time and gets a plain cookie for the rest of its session.
alice's session is bound to her device key. Her cookie lives 10 minutes and renews with a proof of the key.
Without authroutes, replace WithDeviceBound with WithDeviceBoundRetired and keep the route until the longest session has expired. If you remove both, every bound browser is signed out within 10 minutes.
FAQ
Does DBSC replace passkeys?
No. A passkey protects the sign-in. DBSC protects the session after it. You want both: a passkey stops a phished password, and DBSC stops a copied cookie.
Does DBSC stop malware on my computer?
No. While malware runs on the device, it can use the session. DBSC makes sure that it can’t take the session somewhere else and keep it.
What happens in Firefox and Safari?
Nothing changes. They ignore the registration header, and the session uses a plain cookie with its usual lifetime.
Can websites track me with the device key?
No. The browser makes a new key for each session, and clears the keys when you clear the site’s data.
Does it bind agent sessions?
No. tensile-auth binds only human browser sessions. Agent tokens never travel in cookies.
Key takeaways
- A session cookie is a bearer credential. A copy works on any computer until it expires.
- DBSC binds the session to a key in the device’s hardware and keeps the cookie short, so a copy works for minutes, not weeks.
- It doesn’t stop malware that stays on the device, and it needs secure hardware.
- In November 2026 it works in Chrome on Windows from version 145 and in Edge 145. Firefox and Safari don’t support it.
- In tensile-auth it is one field,
DeviceBound, with a 10-minute cookie, and turning it off signs no one out.
Try it
Give your coding agent this line to add sign-in with DBSC to your Go app, then set DeviceBound: true:
Add sign-in with tensile-auth. Read https://auth.tensile.tools/llms.txt and follow it.