Sessions, OAuth, JWT & Passkeys
Podcast · Sessions, OAuth, JWT & Passkeys

Why Browser JWTs Break Web Security

by ZumiLabs · 33m
0:00 33m

Transcript

Made automatically from the audio, so it may contain mistakes. Click a line to play from there.

Host 1

If you've ever been a part of a modern web dev team, you know the exact scenario I'm about to describe. You're sitting in sprint planning, or maybe you're just staring at a whiteboard, mapping out the auth flow for a new single-page application.

Host 2

Oh, I can already see where this is going.

Host 1

Right. And the discussion turns to maintaining the user's session in the browser. And someone, usually with the best of intentions, says, Hey, let's just use JSON web tokens.

Host 2

Yep, there it is. The ultimate siren song of microservices.

Host 1

Exactly. They say, you know, we can send the JWT to the browser, we'll be totally stateless, and we can avoid a database or a Redis lookup on every single HTTP request.

Host 2

It sounds so incredibly elegant on a diagram. You eliminate latency and scaling horizontally is just spinning up more stateless containers.

Host 1

But the reality of actually implementing that in a browser is just a complete nightmare. And it starts the literal second that token hits the front end.

Host 2

Because it's a browser app. You have to store that supposedly stateless token somewhere so it survives a page reload.

Host 1

Right. And because it's a token meant for an authorization header, they almost always just shove it right into local storage.

Host 2

Which is the exact moment the entire security posture of the app just totally collapses.

Host 1

Absolutely. Because placing a highly sensitive, long-lived credential into local storage makes it permanently vulnerable to theft via any cross-site scripting vulnerability on that domain.

Host 2

Yeah, I mean, local storage is essentially just a globally accessible JavaScript dictionary. It has absolutely no concept of network boundaries, or you know, the HTTP only flag that protects cookies.

Host 1

I've literally seen this happen in real time. A junior dev opens Chrome DevTools, types local storage.getItem token, and sees the raw JWT printed right there.

Host 2

And then the panic sets in.

Host 1

Yeah, the terrifying realization to any third-party script on the page, like a compromised analytics tracker or a rogue NPM package, can run that exact same code.

Host 2

They just read the token and exfiltrate it in the background. And because the token is stateless, the server has absolutely zero idea it's been stolen.

Host 1

It's just a bearer instrument. Whoever holds it is the user. And the server will blindly honor it until that expiration timestamp is hit.

Host 2

Which inevitably leads to phase two of this architectural disaster, the revocation panic.

Host 1

Oh man, the panic. A few months go by, you're in production, and a user reports their laptop was stolen. They ask support to log them out of all devices.

Host 2

And the engineering team looks at the architecture and realizes, we can't.

Host 1

You literally can't. The tokens are stateless. They're valid for the next 12 hours, and there's no central session manager to destroy.

Host 2

So to fix this, they retroactively build a mechanism to track invalid tokens. They build a token revocation deny list.

Host 1

Right. Storing the unique ID of every single revoked token. And if you're checking a list on every HTTP request, it has to be fast.

Host 2

So what do they do? They spin up a massive Redis cluster.

Host 1

Exactly. If you've ever stared at an AWS bill and wondered why you're paying thousands of dollars for a Reddit's cluster just to maintain a quote unquote stateless JWT block list, you are living this exact anti-pattern.

Host 2

The irony is just profound. The team has successfully recreated a stateful session architecture. They're doing a Redis lookup on every single request now.

Host 1

But instead of a lightweight session ID in an encrypted cookie, they're passing around this massive unencrypted JSON web token in the header.

Host 2

Right. Which is what, 10 times larger than a session ID? It chews through bandwidth, and they've introduced massive cryptographic foot guns by manually handling token validation.

Host 1

They've built the exact staple monolith they were trying to avoid. Just heavier, slower, and way less secure. So welcome to the deep dive.

Host 2

Glad to be here.

Host 1

Today we are tearing down the bedrock of legacy authentication. This is Deep Dive Episode 4 of Web Security Concepts.

Host 2

And for you listening, we're going straight into the mechanics of password storage with Argon 2 ID, settling this session cookie versus GWT debate once and for all.0 security best current practices in RFC 9700, unpacking open ID Connect, and tracing the WebAuthan PASCI ceremonies.

Host 1

Exactly. And just a heads up for you, we are skipping the basics. We know you already understand HTTPS, XSS, and CSRF. We're going deep today.

Host 2

So to understand why we're rethinking sessions, we first have to look at the genesis of the authenticated state, right? The password database.

Host 1

Yeah, because for over a decade, the industry standard was Bcrypt, or maybe PBKDF2. And those were designed assuming attackers would use standard CPUs to crack hashes.

Host 2

Right. You wanted to slow an attacker down, you just increased the iterations, made the CPU work harder.

Host 1

But the adversary isn't a guy with a fast laptop anymore. It's organized syndicates renting massive GPU arrays or building custom ASICs just for hashing.

Host 2

And that hardware evolution fundamentally broke the math of algorithms like PBKDF2. Because PBKDF2 is primarily compute hard.

Host 1

Meaning it just requires a sequence of math operations, which consume CPU cycles.

Host 2

Exactly. But a modern GPU doesn't work like a CPU. A CPU has, say, 16 really complex cores. A GPU is thousands of tiny simple parallel math processors.

Host 1

Arithmetic logic units.

Host 2

Right. So if an algorithm just needs isolated math, an attacker can load billions of independent password guesses concurrently onto a single GPU.

Host 1

They just parallelize the math.

Host 2

That's it. So iterating a hash a hundred thousand times on a CPU might take a hundred milliseconds, but a GPU can do it for thousands of guesses in that exact same time frame. Which is why OWASP guidelines now aggressively point us to Argon 2 ID. It won the 2015 password hashing competition because it defeats this hardware advantage by being memory hard.

Host 1

Not just compute hard.

Host 2

Memory hardness changes the whole economic equation.

Host 1

It does.

Host 2

Argon 2 ID requires three specific cost parameters. First is M, the memory size, usually in Kibabytes, dictating the strict RAM allocated for hash.

Host 1

Okay. What are the others?

Host 2

Second is T, the iterations or passes dictating CPU time. And third is P, the degree of parallelism, which controls how many computational threads fill and read that memory space.

Host 1

Okay, let me visualize that for you.

Host 2

Sure.

Host 1

Think of memory hardness like a physical maze that requires actual acreage, physical RAM to build, rather than just time to run through.

Host 2

That's a really good way to look at it.

Host 1

If you configure Argon 2 IIID for 19 megabytes per hash. Every single guess an attacker makes must allocate that physical space. You just can't cram 10,000 sprawling mazes onto a tiny GPU chip.

Host 2

You can't.

Host 1

The GPU has the processing cores, but it doesn't have the ultra fast localized VRAM to supply 19 megabytes to thousands of concurrent threats.

Host 2

It becomes a physical bottleneck.

Host 1

A million parallel guesses suddenly requires 19 terabytes of high speed memory right next to the cores. It renders brute forcing financially unviable.

Host 2

And the ID variant of Argon 2 is specifically designed to resist side channel timing attacks, too. It operates independently of the data in its initial passes.

Host 1

So an attacker can't measure the microseconds to deduce password length. But here's the reality most teams aren't starting from scratch. They're sitting on databases with millions of legacy bcrypt hashes.

Host 2

The brownfield projects. Yeah. You can't just flip a switch to Argon 2 ID without forcing millions of password resets.

Host 1

And Bcrypt has that really specific historical vulnerability OWASP warns about the 72-byte input ceiling.

Host 2

Right. This comes from B Crypt's underlying architecture, the Blowfish cipher. It has a maximum key size. So most standard bcrypt implementations just silently truncate any input after the 70-second byte.

Host 1

Which is terrifying if you don't know what's happening. If a user has a highly secure 100 character passphrase, Bcrypt just chops off the last 28 characters.

Host 2

So correct horse battery staple and then some more words is cryptographically identical to correct horse battery staple and then some more W.

Host 1

And the attacker could brute force the truncated version much easier. So to mitigate this for legacy systems, OWASP recommends pre hashing.

Host 2

Yes. Before you pass the plain text password to bcrypt, you hash it using HMAC SHA 384 combined with a secret pepper.

Host 1

And a pepper is like assault, but it's never stored in the database, right?

Host 2

Exactly. It's completely isolated, usually an environment variable or in a hardware security module. So you take the password, hash it with HMAC SHA 384 using the pepper as the key, and pass that to bcrypt.

Host 1

Which solves the length issue because SHA384 output is fixed length. It's always well under 72 bytes.

Host 2

Right. And if the database is dumped via SQL injection, they only get the B crypt hashes. Without the pepper, they can't even begin cracking them.

Host 1

But there is a massive implementation trap here. AWASP mandates you must base 64 encode the raw binary output of that prehash before feeding it to bcrypt. Why is that?

Host 2

It's actually a historical artifact of the C programming language, which the original bcrypt library was written in.

Host 1

Because in C, a string is just an array of bytes.

Host 2

Exactly. It only knows it reached the end of the string when it hits a null byte, 0x00.

Host 1

The null terminator. A 50-year-old memory management decision dictating modern crypto.

Host 2

It's wild. If you take the raw binary output of a SHA 384 hash, there's a one in 256 chance a null byte naturally occurs at any position.

Host 1

So if it lands at the fourth position, the C based B crypt stops reading and only hashes three bytes.

Host 2

Security researchers call this password shucking.

Host 1

Massive collision rates occur. Thousands of different passwords end up evaluating to the exact same B crypt hash. But by base 64 encoding it, you convert it to save ASCII characters, mathematically guaranteeing zero null bytes. So premature truncation is impossible.

Host 2

It perfectly shows how crypto failures are rarely the math itself, but how data structures talk to legacy systems.

Host 1

Absolutely. So we've spent all this energy verifying the user. But HTTP is stateless. The second they click their profile, the server forgets them. We have to persist that state.

Host 2

Which brings us back to the browser and why we don't use local storage.

Host 1

Right, because we have this incredibly resilient edge defense built natively into browsers, the host prefixed session cookie.

Host 2

I'd say the evolution of the session cookie is one of the most underrated security advancements we have. When you name a cookie starting with host dash, it triggers a specialized parsing engine in the browser.

Host 1

The browser acts as an active security perimeter. It strictly enforces a set of invariants before it even accepts the set cookie header.

Host 2

First invariant, it must have the secure flag, guaranteeing it's only transmitted over TLS.

Host 1

So if you accidentally type HTTP, the browser refuses to send the cookie, no plain text leakage.

Host 2

Second, it mandates the path equals attribute.

Host 1

So it's sent for all requests to that origin, preventing complex path-based bypasses.

Host 2

But the third invariant is the big one.

Host 1

It really does.

Host 2

Setting a domain attribute feels like you're locking it down, but the opposite is true.

Host 1

If you set domain equals example.com, you're telling the browser to send that token to every single subdomain underneath it.

Host 2

Blog.example.com, analytics.example.com.

Host 1

Right. And that creates a massive attack surface for subdomain forgery. Imagine an abandoned WordPress blog on marketing-2018.example.com that hasn't been patched in years.

Host 2

An attacker compromises it, and because the main cookie has a domain attribute, the browser blindly sends the admin session token to that compromised WordPress server.

Host 1

Or they'd write a malicious cookie from the subdomain and pass it up to the main app.

Host 2

But by forbidding the domain attribute, the host dash prefix forces the browser to treat it as strictly origin bound. It only goes back to the exact host name that set it.

Host 1

Total isolation. But the container is only as secure as the ID inside it, which is why the OWASP cheat sheet stresses post-login session ID rotation.

Host 2

To prevent session fixation.

Host 1

In a fixation attack, the adversary doesn't steal your session ID. They force a known ID onto your browser before you even log in.

Host 2

Usually through a phishing link with the ID in the URL, or a minor XSS flaw. You click the link, the attacker's ID is planted, you log in. If the back end just elevates that existing session ID, the trap snaps shut.

Host 1

The attacker uses the ID they planted, and they have full access. So the defense is structural. The app must completely destroy the pre-auth session ID at the exact moment of login.

Host 2

It has to generate a brand new cryptographically secure identifier that severs any malicious state.

Host 1

Okay, so we've rotated the ID, locked it in a dash host cookie. The browser is protecting it. But what about the backend? If our database gets dumped via SQL injection and it has plaintext session IDs, the attacker hijacks everything.

Host 2

Without touching Argonne2 ID. So OWASP outlines the identifier verifier split.

Host 1

Which is brilliant.

Host 2

Instead of one monolithic session ID, the service generates two high entropy strings, a public identifier and a secret verifier. Both get concatenated and sent to the browser in the secure cookie, but the database logic is different.

Host 1

The backend stores the identifier in plain text for fast lookups, but it never stores the secret verifier. It stores the SHA 256 hash of the verifier.

Host 2

So when a request comes in, the server extracts both from the cookie. It looks up the identifier, finds the record, then applies a constant time SHA256 hash to the client's verifier.

Host 1

And compares it to the stored hash. So if the database is breached, the attacker gets public identifiers and cryptographic hashes. They can't reverse the hashes to Forge a Valley Cookie.

Host 2

Active sessions remain entirely secure. It's defense and depth at the highest level.

Host 1

But this all assumes a closed ecosystem, a first-party app talking to a first-party backend. What happens when a user needs to delegate access to a third-party app?

Host 2

We can't give them our host dash cookie or our password.

Host 1

Right. We need OAuth 2.0. And specifically RFC 9700, the best current practices. So let's trace the mechanics of the authorization code grant. The user clicks connect integration on the third-party client. The client redirects the user's browser to the auth server.

Host 2

The user authenticates using our robust Argon2 ID and session mechanics and sees a consent screen detailing the requested scopes. Up to this point, the client app has seen nothing.

Host 1

You click approve, and the auth server does not hand the access token back through the browser. That would expose it to browser history and XSS.

Host 2

Instead, it generates a short-lived authorization code, appends it to the URL, and redirects back to the client.

Host 1

The client extracts the code, then executes a direct back channel HTTPS post request to the auth server.

Host 2

It presents the code and its own client secret to prove its identity. The auth server validates them and issues the actual access token directly to the client's back end.

Host 1

The token never touches the vulnerable browser, but this entire model assumes the client has a back end capable of keeping a client secret confidential.

Host 2

Which completely falls apart for mobile apps. You can't bake a client secret into an iOS or Android app because an attacker just decompiles the binary and extracts it.

Host 1

Exactly. And this exposes mobile apps to the authorization code interception attack, which exploits custom URI schemes.

Host 2

Let's break that down. A legitimate banking app registers a URI scheme, like secure bank. So the OS routes any traffic starting with that to the app.

Host 1

But an adversary develops a malicious calculator app, gets it on the device, and registers the exact same URI scheme, secure bank.

Host 2

Now the OS has a routing conflict. Two apps claiming the same scheme.

Host 1

The user does the OAuth flow. The auth server redirects back to secure bank.callback forward slash code equals XYZ. The OS has to decide where to route it.

Host 2

And it might silently route it directly into the malicious calculator app.

Host 1

The attacker intercepted the authorization code. And since it's mobile, there's no client secret needed. The malicious app trades the code for the access token and gets full access to the bank account.

Host 2

To neutralize this, the IETF developed PKCE, proof key for code exchange, RFC 7636, now mandated by RFC 9700. It introduces cryptographic state binding, eliminating reliance on static secrets.

Host 1

The math here is really specific. It starts on the client device before the initial redirect. The client generates a secret called the code verifier.

Host 2

A high entropy random string, 43 to 128 characters.

Host 1

But it can't send this secret in the initial redirect because it could be intercepted. So it mathematically transforms it into a public representation, the code challenge.

Host 2

Using the S256 method.

Host 1

So they apply base64 URL encoding.

Host 2

And it's crucial to distinguish base64 URL from standard base 64. Standard uses the plus sign and forward slash.

Host 1

A plus sign in a URL parameter is interpreted as a space by the server.

Host 2

So base64 URL mathematically substitutes the plus with a minus and the slash with an underscore and strips the trailing equal signs used for padding.

Host 1

Giving you a perfectly URL safe code challenge.

Host 2

The client appends this to the initial redirect. The auth server saves it, issues the auth code.

Host 1

Now replay the interception attack.

Host 2

It demands the plain text code verifier. The malicious app is paralyzed. It doesn't know the local random string.

Host 1

When the legitimate app makes the trade request, it includes the plain text code verifier. The auth server does the SHA 256 and base64 URL math on it and compares it to the saved code challenge.

Host 2

If they match the server has mathematical proof that the entity redeeming the code is the exact instance that started the request, the interception is useless.

Host 1

So PKCE secures the exchange. The client gets an access token and critically a refresh token. The keys to the kingdom. Because if an attacker steals a refresh token, they maintain persistent access for months. Rotation turns the token into a cryptographic tripwire.

Host 2

Under rotation, it's a single use credential. Every time the client uses it, the server invalidates it and issues a brand new one.

Host 1

But the brilliance is the reuse detection. If an attacker steals a valid refresh token.

Host 2

And the legitimate user interacts with the app first.

Host 1

The legitimate client uses the token, the server rotates it. The stolen token is now technically invalid.

Host 2

But the attacker doesn't know that.

Host 1

They try to use it. The auth server checks its database, sees the specific token was already used and rotated.

Host 2

The tripwire is tripped.

Host 1

The server knows a cryptographic copy exists, so it instantly revokes the entire lineage of tokens for that grant.

Host 2

It destroys the active token held by the legitimate client and rejects the attacker. The persistent access is severed.

Host 1

The legitimate user just has to log in again. Minor friction, huge security win. But OAuth only handles authorization. It doesn't communicate identity.

Host 2

Right. It provides an opaque access token, but it doesn't tell the client who the user is. For identity, we layer on open ID Connect or OIDC.

Host 1

Which introduces the ID token.

Host 2

And understanding the separation of duties between the access token and ID token is paramount. The ID token is a signed JWT strictly for the relying party, the client app. It proves identity and has claims like ISS for issuer, sub for subject, and AUD for audience, which must match the client ID.

Host 1

You must never send an ID token in an authorization header to a back end API. The access token is for the resource server.

Host 2

The physical security analogy is perfect here. The ID token is your verified passport. You show it to the front desk so they know exactly who you are.

Host 1

But knowing who you are doesn't let you wander the building.

Host 2

You take that to the warehouse manager. They don't care about your name. They just read the envelope which authorizes you to access a specific crate.

Host 1

If you hand the warehouse manager your passport, the ID token, they reject it because it has no authorization scopes. If an API accepts an ID token as proof of authorization, it's a massive vulnerability. You might grant admin privileges just because it verified your name without checking scopes.

Host 2

So we've layered all these defenses over a single vulnerability, the shared secret. We used memory hard argon 2 ID, host dash cookies, PKCE.

Host 1

But what if we execute a paradigm shift and eliminate the shared secret entirely? That brings us to WebAuthN and pass keys.

Host 2

It's a fundamental shift to asymmetric origin bound public key cryptography at the edge. The server never receives a password or a hash, just a public key.

Host 1

The private key is permanently locked in the device's secure hardware. So let's trace the registration ceremony.

Host 2

The back end sends a challenge, a random string to the browser. The front end calls the navigator.credentials.create API, waking up the authenticator, like a Yubi key or secure enclave.

Host 1

The browser passes the challenge, but also the relying party identifier, the RPID. The browser strictly enforces that this matches the effective domain of the TLS certificate.

Host 2

And this is the anti-phishing magic. If an adversary tricks you into visiting secure dash bank dash login.com, the browser tells the authenticator that's the RPID.

Host 1

The authenticator dutifully generates a new key pair bound to that malicious domain.

Host 2

Then a week later, you go to the real securebank.com. The browser says the RPID is securebank.com. The authenticator sees it has no keys for that and silently refuses.

Host 1

The credentials for the phishing site are mathematically isolated. The human vulnerability of visual lookalikes is neutralized by the cryptographic reality of the origin.

Host 2

Once registered, the authenticator returns the public key and an attestation object proving the hardware's provenance. The server stores the public key.

Host 1

Fast forward to authentication. The server sends a challenge. The front end calls navigator.credentials.get. What happens under the hood?

Host 2

The browser constructs a client data JSON object. It contains the challenge and the exact origin from the TLS stack. The browser hashes this with SHA 256 and passes it to the authenticator.

Host 1

The authenticator prompts for local verification, face IDE fingerprint, ensuring human presence. Then it retrieves the private key for that RP ID.

Host 2

It signs the hash of the client data JSON and returns the signature to the server.

Host 1

When the server validates the signature with the public key, it proves two things. Proof of possession, they control the private key. And proof of presence. The origin is baked into the signed data.

Host 2

So if a man in the middle attacker intercepts and forwards it to a different domain, the origin won't match. Signature fails.

Host 1

It sounds perfect. Flawless mathematical defense. But we don't operate in pure theory. We have overworked engineering teams and flexible open source libraries.

Host 2

Right, which brings us to the trade-offs in failure modes. Let's look at those JWT cryptographic foot guns we mentioned earlier.

Host 1

Because in cryptography, flexibility is the enemy of security.

Host 2

Which leads to algorithm confusion.

Host 1

A JWT has a header with an AUG field, maybe specifying RS256 for asymmetric, or HS256 for symmetric HMAC.

Host 2

The vulnerability is when libraries use a generic verify token comic key function. They decode the untrusted header, read ALG, and use a switch statement.

Host 1

If the server expects RS256, it passes its public RSA key. But an attacker intercepts their token, changes the header to HS256, and alters the payload. They don't have it. But they download the server's public RSA key, treating its raw bytes as the HMAC secret.

Host 2

They sign the forge token.

Host 1

The server sees HS256, switches to HMAC mode, and uses the provided key, which the developer said is the public RSA key as the symmetric secret.

Host 2

The math perfectly aligns.

Host 1

The signature is validated and the forged token grants admin access. The flexibility completely subverted the crypto.

Host 2

It's a staggering flaw. And header injections are worse. The specification allows JKU or JWKS URI parameters, pointing the server to fetch the public key.

Host 1

If an API blindly trusts that JKU header, it creates a server-side request forgery. The attacker hosts their own key set, points the JKU to their URL, and signs the token with their private key. Letting the client dictate rules also breaks OAuth deployments. RFC 9700 addresses redirect URI mismatches. The redirect URI dictates where the auth code goes.

Host 2

If an auth server uses loose regular expressions for URI matching, an attacker might register legitimate-client.com.attacker.com.

Host 1

The port regex matches the prefix, sends the code to the attacker. RFC 9700 mandates exact literal string matching, no wildcards.

Host 2

Then there's the mix-up attack when a client uses multiple identity providers. Google, Microsoft, Corporate SSO.

Host 1

An adversary uses a malicious provider to trick the client into sending credentials intended for a legitimate provider to the attacker's server.

Host 2

By confusing the client's internal state machine. So the guidelines introduce the ISS issuer response parameter.

Host 1

The auth server appends ISS to the redirect. The client verifies it exactly matches the intended identity provider before trading the code. If not, it aborts.

Host 2

And we also have to talk about federated linking dangers based on unverified email claims.

Host 1

No, this logic flaw is everywhere. A team adds OIDC SSO to their legacy app. The OIDC ID token returns an email claim.

Host 2

The app queries the local database, finds a matching email, and automatically links the SSO identity to the local account.

Host 1

Assuming the identity provider cryptographically verified that email, but OIDC claims are just text strings.

Host 2

An attacker registers an account at a poorly configured provider using the victim's email.

Host 1

Completes the OIDC flow, the app sees the email string and instantly grants the attacker full access to the victim's local account. Account takeover without cracking a password.

Host 2

You must require an active, authenticated session with the existing local account before binding any federated identities.

Host 1

We have to discuss the divergence between enterprise attestation and consumer synchronization.

Host 2

It's a huge trade-off. Enterprise pass keys prioritize strict non exportability. They are hardware bound to a TPM or secure enclave.

Host 1

The private key can never be read by the OS. If an employee loses their laptop, the identity is lost. The server verifies the attestation object to guarantee physical possession of a corporate device.

Host 2

But that UX is unacceptable for consumers. If they drop their phone in a lake, they lose access to their bank. So Apple, Google, and Microsoft pioneered synced pass keys.

Host 1

The OS intercepts the private key, end-to-end encrypts it, and syncs it across iCloud or Google Password Manager.

Host 2

Providing seamless continuity to new devices.

Host 1

But doesn't that fundamentally shift the vulnerability? We're not cracking hashes. But haven't we just made the user's Google account the single catastrophic point of failure? If that's hijacked, the attacker has copies of every proof of identity.

Host 2

That is the deliberate compromise. They prioritize availability over the strict guarantee of hardware possession. Yes, they use massive security to protect those walls.

Host 1

But the security of a synced pass key is bottlenecked by the synchronization fabric. It's infinitely better than a password, but it's not a hardware-bound token.

Host 2

Which brings us to the synthesis of the whole deep dive. How do we architect an app that leverages these strengths while mitigating the vulnerabilities?

Host 1

The modern standard is the backend for front end or BFF pattern.

Host 2

Built on zero trust toward the client. The browser is inherently hostile, so we completely decouple it from the token architecture.

Host 1

The front end JS doesn't touch JWTs or execute OAuth. It only talks to a dedicated back end server, the BFF.

Host 2

We use opaque HTTP only host prefix cookies to manage state between the browser and the BFF.

Host 1

The browser authenticates via pass key. The BFF establishes the session, generates the identifier verifier split, stores the hash, and sets the secure cookie. The browser's ignorant of the identity architecture.

Host 2

But the BFF has to talk to internal microservices. This is where we use stateless tokens safely.

Host 1

The BFF X is a confidential client. It gets the cookie, verifies the session, and internally mints a short-lived, asymmetric JWT.

Host 2

It injects this JWT into the headers of downstream requests to internal microservices. And because this is all behind the firewall, XSS risk is eliminated.

Host 1

The microservices operate statelessly, verifying the RSA signature, odd and is claims in milliseconds without a database lookup.

Host 2

And it solves the revocation problem. If the user logs out, we destroy the session record in the BFF.

Host 1

The next time the cookie comes in, the BFF rejects it and ceases to mint downstream JWTs. It's brilliant. It's an armor-plated exterior, lightweight interior architecture.

Host 2

Heavy, stateful cookie armor facing the internet, and fast stateless token passports behind the firewall.

Host 1

Exactly. Host hash cookies defend browser state. OAuth PKCE handles delegation. Scoped JWTs handles internal authorization, and Argon2 ID or pass keys secure the handshake.

Host 2

The objective is proving identity with mathematical certainty while exposing the smallest attack service.

Host 1

As we wrap up this deep dive into the architecture of identity, I think there's a fascinating philosophical shift happening here.

Host 2

With synced pass keys becoming the default, escrowing keys across cloud ecosystems, we really have to reevaluate the definition of security. Right.

Host 1

Does the traditional possession factor in MFA, something you have, simply become a test of who controls your cloud account?

Host 2

We are actively blurring the line between local physical hardware and ephemeral cloud identity forever. We're fundamentally changing what it means to actually have a cryptographic credential.

Host 1

Something to carefully consider the next time you tap your screen to log in, keep questioning the defaults, keep auditing the architecture, and we will see you on the next deep dive.

Save to playlist

Manage playlists →

Share