OAuth and Proof of Possession - The long way round

Dominick Baier (Duende Software)

TROOPERS23 · Day 2 · Defense & Management · Defense & Management

Overview

This article delves into the critical security challenge of Proof of Possession (PoP) in the context of OAuth, a ubiquitous authorization framework. Presented by Dominick Baier, CEO and founder of Duende Software, this talk at TROOPERS explores the historical struggle to integrate strong sender-constraining mechanisms into OAuth, a journey he aptly likens to "the long way round." OAuth's widespread adoption, from e-commerce to highly sensitive financial and healthcare systems, underscores its importance, yet its default use of Bearer tokens introduces a fundamental vulnerability: "Whoever has the token can use the token."

Watch on YouTube · Slides

Visual summary for OAuth and Proof of Possession - The long way round by Dominick Baier
Visual summary for OAuth and Proof of Possession - The long way round by Dominick Baier

Key moments

  1. 0:00 Introduction: The 10-year quest for Proof of Possession
  2. 4:00 Bearer tokens: Understanding the inherent security risk
  3. 14:00 Eran Hammer's protest against OAuth 2.0's simplicity
  4. 19:30 Mutual TLS: Proof of Possession for financial APIs (Fapi)
  5. 26:00 Depop: The new application-layer Proof of Possession standard
  6. 36:00 Depop challenges: Nonces, replay, and practical use cases
  7. 43:00 Q&A: Depop's role in future OAuth standards like FAPI2

OAuth and Proof of Possession - The long way round

Speakers: Dominick Baier, CEO and founder, Duende Software

Conference: TROOPERS

YouTube: https://www.youtube.com/watch?v=iYIdbrsjPpA

Overview

This article delves into the critical security challenge of Proof of Possession (PoP) in the context of OAuth, a ubiquitous authorization framework. Presented by Dominick Baier, CEO and founder of Duende Software, this talk at TROOPERS explores the historical struggle to integrate strong sender-constraining mechanisms into OAuth, a journey he aptly likens to "the long way round." OAuth's widespread adoption, from e-commerce to highly sensitive financial and healthcare systems, underscores its importance, yet its default use of Bearer tokens introduces a fundamental vulnerability: "Whoever has the token can use the token."

Baier, with over two decades of experience in the identity space, meticulously traces the evolution of PoP attempts, from the early days of WS-Security to the current, more promising standards. The talk highlights why this problem exists, the numerous failed attempts to solve it, and the recent breakthroughs driven by critical industry demands. Understanding PoP is paramount for any organization securing APIs with OAuth, especially those handling sensitive data, as it offers a robust defense against token exfiltration and misuse.

The core message is that while OAuth offers a balance of security and usability, its default Bearer token model assumes a level of perfect security that often doesn't exist in the real world. This talk serves as a crucial guide for security architects and developers to navigate the complexities of implementing true Proof of Possession, offering insights into the technical intricacies, trade-offs, and defensive implications of the emerging standards.

Background

▶ Watch: Introduction: The 10-year quest for Proof of Possession (0:00)

OAuth has become the de facto standard for API authorization, used multiple times a day by billions of users. Its popularity stems from its ability to strike a pragmatic balance between security and ease of use. However, this balance comes with a significant compromise: the widespread adoption of Bearer tokens. A Bearer token, as Dominick Baier explains, is akin to cash: "Whoever has the token can use the token." If a Bearer token is leaked or intercepted, an attacker can use it to impersonate the legitimate client and access protected resources without any further authentication. This model inherently assumes a perfectly secure environment, with no token leaks from clients or resource servers, perfect transport security (like TLS), and no man-in-the-middle attacks.

The concept of Proof of Possession (PoP), also known as sender constraining or holder of key tokens, directly addresses this vulnerability. PoP aims to cryptographically bind an access token to the specific client application that obtained it. This means that even if an attacker gains possession of the token, they cannot use it because they lack the cryptographic proof required to demonstrate possession of the associated key. This is analogous to a credit card requiring a PIN – simply having the card isn't enough to use it.

The journey to integrate PoP into modern web standards has been arduous and protracted. The speaker notes that he first gave a talk on the absence of PoP in OAuth a decade ago, shortly after its initial release. Before OAuth, earlier enterprise technologies like WS-Security (around 2004) actually had PoP as their default. These tokens would embed a client-generated secret, encrypted for both the token service and the resource, and the client would sign the message body with this secret. However, this approach suffered from severe complexity, particularly in Key Management and rotation, and was implemented without widespread TLS deployment, making it cumbersome and difficult to maintain.

The first iteration of OAuth, OAuth 1.0, championed by Eran Hammer, did include PoP through signature bound tokens. Hammer believed anything less would be too insecure. However, the specification for these signatures was notoriously complex, requiring developers to canonicalize strings, query parameters, and headers across at least 10 pages of intricate instructions. This complexity proved to be its downfall, as average developers found it nearly impossible to implement correctly, leading to its abandonment.

When OAuth 2.0 was being developed, a strong push for simplification emerged from major enterprises like Microsoft and Google, who were weary of the complexity of WS-Security and OAuth 1.0. This movement ultimately led to the controversial decision to drop signature bound tokens and make Bearer tokens the default. Eran Hammer vehemently opposed this, famously stating in 2010 that "Bearer tokens are a terrible idea" and eventually withdrawing his name from the specification in protest, lamenting the resulting reduction in security. Despite his efforts, the simplification movement prevailed, resulting in RFC 6750 (Bearer Token Usage) and the absence of a planned RFC 6751 for PoP. Instead, RFC 6819 (OAuth 2.0 Threat Model and Security Considerations) was released, explicitly detailing the security risks of Bearer tokens.

Subsequent attempts to reintroduce PoP also faltered. Eran Hammer himself attempted to specify HTTP message signing, but it too was deemed too complicated and eventually expired. Later, Token Binding, a TLS extension designed to bind cookies and access tokens to the TLS channel, offered a promising solution, solving issues like cookie and token exfiltration in browsers. However, this initiative was abruptly abandoned when Google decided to remove the technology from Chrome in 2018, effectively killing its widespread adoption.

Despite these setbacks, the need for PoP never truly disappeared. In recent years, critical industries, particularly the financial sector with regulations like PSD2 (Payment Services Directive 2) and the Financial-grade API (FAPI) profiles, along with healthcare and enterprise-mission-tailored OAuth profiles, independently concluded that Bearer tokens were insufficient for sensitive transactions. These industries mandated PoP, leading to a renewed, industry-driven effort to finally standardize practical PoP mechanisms.

Key Findings

▶ Watch: Eran Hammer's protest against OAuth 2.0's simplicity (14:00)

The talk meticulously charts the "long way round" to achieve Proof of Possession (PoP) in OAuth, highlighting several key findings that underscore both the persistent need for this security feature and the challenges in its implementation:

  1. Bearer Tokens are Insufficient for High-Security Scenarios: Despite OAuth's popularity, its default use of Bearer tokens poses significant risks in sensitive contexts like banking, healthcare, and critical infrastructure. The inherent vulnerability – "whoever has the token can use it" – has been a recognized problem for over a decade, leading to industry-specific demands for stronger security.
  2. Historical Attempts at PoP Were Too Complex or Failed: Early PoP implementations in WS-Security and OAuth 1.0 (signature bound tokens) were technically sound but overly complex, making them impractical for widespread adoption. Subsequent efforts like HTTP message signing and the promising TLS-based Token Binding ultimately failed due to complexity or lack of critical browser support (Google's removal of Token Binding from Chrome).
  3. Industry Demand Drove New PoP Standards: The critical need for enhanced security, particularly from the financial sector (driven by PSD2 and FAPI requirements), forced the IETF to finally produce viable PoP solutions. Banks initially missed compliance deadlines due to the absence of standardized PoP technology.
  4. Two Primary PoP Mechanisms Have Emerged:
  • OAuth Mutual TLS (MTLS PoP), formalized in RFC 8705, was developed as a stopgap solution primarily for industries with existing PKI and MTLS infrastructure. It binds access tokens to x509 certificates.
  • Demonstrating Proof of Possession (DPoP), currently in the final stages of standardization (RFC editor draft), is positioned as the future application-layer standard. It aims to achieve PoP without requiring specialized network infrastructure, using JSON Web Tokens (JWTs) and ephemeral key pairs.
  1. PoP Comes with Inherent Complexity: While DPoP aims to be simpler than its predecessors, the talk clearly demonstrates that there is no "easy" solution to PoP. DPoP introduces new challenges, such as robust replay protection, handling client clock skew, and the potential need for server-issued nonces, all of which add significant implementation complexity across clients, token servers, and APIs.
  2. PoP is Not Universally Required, But Critical Where Needed: The speaker emphasizes that not every API or website requires the elevated security of PoP. However, for systems handling highly sensitive data (e.g., healthcare's "Ping of Death" API, financial transactions, or powerful cloud infrastructure portals), PoP is a vital defense against token leakage and misuse, justifying its increased implementation cost and complexity.

Technical Deep Dive

▶ Watch: Mutual TLS: Proof of Possession for financial APIs (Fapi) (19:30)

The core of Dominick Baier's talk lies in its detailed exploration of the various technical approaches to Proof of Possession, from historical failures to emerging standards.

The Challenges of Early PoP: WS-Security and OAuth 1.0

The speaker briefly revisits WS-Security (circa 2004) to illustrate early PoP attempts. In this model, the client would generate a secret (symmetric or asymmetric key), encrypt a token request with the Security Token Service (STS)'s public key, and send the secret along. The STS would then create a SAML assertion containing the secret, encrypt it with the resource's public key, and send it to the client. The client, upon receiving the SAML assertion, would sign the XML body of the request to the resource with its secret. The resource would then decrypt the SAML assertion, extract the secret, and validate the signature. While cryptographically sound, this approach was plagued by Key Management issues (pre-shared public keys, no easy rotation) and the lack of widespread TLS at the time, making it impractical.

OAuth 1.0 then attempted to solve PoP with signature bound tokens. Eran Hammer, its architect, mandated this as the only way to secure OAuth. The specification, however, was notoriously complex, requiring intricate canonicalization of HTTP methods, URLs, query strings, and headers across "at least 10 pages of instructions." This made it nearly impossible for average developers to implement correctly, leading to its abandonment in favor of the simpler, though less secure, Bearer tokens of OAuth 2.0.

The Rise of Modern PoP: MTLS and DPoP

Driven by the demands of regulated industries, two primary PoP mechanisms have gained traction: OAuth Mutual TLS (MTLS PoP) and Demonstrating Proof of Possession (DPoP).

OAuth Mutual TLS (MTLS PoP) - RFC 8705

MTLS PoP was developed as a "stopgap solution" for industries that already possess robust Public Key Infrastructure (PKI) and utilize Mutual TLS (MTLS). The mechanism leverages x509 client certificates to bind the access token to the client.

  1. Client Certificate Generation: The client application uses an x509 certificate and its corresponding private key.
  2. Token Request via MTLS: The client opens an MTLS channel to the Token Server. This channel performs both server and client authentication, ensuring the client is who it claims to be and that it possesses the private key for its x509 certificate.
  3. Token Issuance: The Token Server, after successful MTLS client authentication, issues an access token. This token is a JSON Web Token (JWT), and critically, it includes a cnf (confirmation) claim. This cnf claim contains the SHA-256 hash of the client's x509 certificate's public key, often represented as x5t#S256.
  4. Resource Access via MTLS: When the client wants to access an API, it opens another MTLS channel to the resource server, using the same x509 certificate. The access token, now containing the cnf claim, is sent in the authorization header.
  5. Resource Validation: The resource server performs two key validations:
  • It validates the access token itself (signature, expiry, audience, etc.).
  • It extracts the cnf claim (the x509 certificate thumbprint hash) from the access token.
  • It then compares this hash with the thumbprint of the client certificate presented during the MTLS handshake. If they match, the client has successfully proven possession of the private key associated with the token.

Advantages: If the access token is leaked, an attacker cannot use it without also possessing the corresponding private key of the x509 certificate, which is highly unlikely to be leaked alongside the token. This makes MTLS PoP very secure.

Disadvantages: MTLS PoP requires significant infrastructure: a fully functional PKI, MTLS-enabled network components (e.g., reverse proxies like Nginx for certificate forwarding), and a complex setup that makes it unsuitable for environments like mobile applications on random networks or large-scale cloud deployments where guaranteeing end-to-end MTLS can be challenging.

Demonstrating Proof of Possession (DPoP) - RFC (Editor Draft)

DPoP aims to provide an application-layer PoP solution that avoids the network infrastructure complexities of MTLS. It leverages ephemeral key pairs and signed JWTs to bind tokens to the client. This specification is currently an RFC editor draft and is expected to become an RFC soon.

  1. Client Key Pair Generation: The client application generates an ephemeral public/private key pair for each session or for a short period.
  2. Proof Token Creation: For every HTTP request, the client creates a Proof Token. This is a JWT with a specific structure:
  • Header: Contains the client's public key (jwk parameter) and the signing algorithm (alg).
  • Payload: Includes claims such as:
  • htm: HTTP method of the request (e.g., "POST").
  • htu: HTTP URL of the request (excluding query parameters).
  • iat: Issued at timestamp.
  • jti: Unique JWT ID for replay protection.
  • Signature: The entire Proof Token is signed with the client's private key.
  1. Token Request with DPoP Header: When requesting an access token from the Token Server, the client sends the Proof Token in a special DPoP HTTP header. The Token Server verifies the Proof Token's signature, validates its claims (e.g., htm, htu), and confirms the client knows the private key.
  2. Access Token Issuance: The Token Server issues an access token (again, a JWT) that includes a cnf claim. In DPoP, this cnf claim contains the base64 URL encoding of the JWK SHA-256 thumbprint of the public key provided in the client's Proof Token. This binds the access token to the client's ephemeral public key.
  3. Resource Access with DPoP: When accessing an API, the client sends the access token using the DPoP authorization scheme (not Bearer). Crucially, for every single HTTP request, the client generates a new Proof Token and sends it in the DPoP header. This new Proof Token is signed with the same private key and includes an additional claim:
  • ath: The SHA-256 hash of the access token itself. This creates a two-way cryptographic binding between the Proof Token and the access token, ensuring they are used together.
  1. Resource Validation: The resource server validates both the access token and the Proof Token. It checks:
  • The Proof Token's signature and claims (htm, htu, iat, jti, ath).
  • That the public key in the Proof Token's jwk matches the thumbprint in the access token's cnf claim.
  • That the ath in the Proof Token matches the hash of the presented access token.
  • It also performs replay protection using the jti claim.

DPoP Complexities and Issues:

While DPoP is designed for simplicity, it introduces its own set of challenges:

  • Limited Signing Scope: Initially, DPoP only mandated signing the HTTP method (htm) and URL (htu). This was deemed sufficient to prove key possession but left room for manipulation of query strings, headers, or body. Expanding the signing scope, however, reintroduces the canonicalization complexity that plagued OAuth 1.0.
  • Replay Protection: The jti and iat claims are crucial for replay protection. Every recipient (Token Server, API) must implement a replay cache to store jti values and reject tokens seen twice within a certain timeframe (e.g., 1 minute). This can be complex to manage at cloud scale.
  • Future Token Generation: A significant vulnerability discovered by Microsoft engineers was the ability for an attacker with access to the client's key material to generate Proof Tokens with a future iat timestamp. This could be used for delayed replay attacks.
  • Client Clock Skew: The iat claim relies on the client's clock, which can be inaccurate (e.g., mobile phones with incorrect date/time settings). This can lead to legitimate tokens being rejected.
  • Server-Issued Nonces: To address the iat and replay issues, DPoP introduced server-issued nonces. If a recipient (Token Server or API) is unhappy with a Proof Token (e.g., iat is off, potential replay), it can return a 400 error with a DPoP-Nonce header containing a random value. The client must then repeat the request, including this nonce in the jti claim of its new Proof Token. This adds state management complexity on both the server and client.

DPoP Pros: No special network infrastructure required, uses widely available crypto and JWT tooling.

DPoP Cons: New standard, requires significant code changes across all components (client, token server, APIs), mandatory implementation of replay caches, and potentially complex nonce handling.

Demo / Proof of Concept

▶ Watch: Depop challenges: Nonces, replay, and practical use cases (36:00)

Dominick Baier explained that he had an MTLS-enabled token server running locally. He showed how the token server's metadata would expose mtls_endpoint_aliases to indicate a separate subdomain requiring Mutual TLS. While he could have run a live demonstration to show an access token containing the x509 thumbprint in its cnf claim, he opted not to, stating it would be "very very unexciting" as it would primarily involve displaying a JWT with the embedded claim. The core concept was sufficiently explained through diagrams and the technical deep dive, illustrating how the presence of the cnf claim and the requirement for MTLS would enforce Proof of Possession.

Defensive Implications

▶ Watch: Q&A: Depop's role in future OAuth standards like FAPI2 (43:00)

The advent of standardized Proof of Possession mechanisms like MTLS PoP and DPoP provides crucial tools for defenders, but their adoption requires careful consideration of trade-offs.

Firstly, it's important to recognize that PoP is not a universal panacea for all OAuth deployments. As Baier notes, for many applications, the existing Bearer token model, when combined with TLS and short token lifetimes, offers "good enough" security. The "sky did not fall" over the past decade without widespread PoP. Implementing PoP introduces significant complexity and cost, and this overhead may not be justified for applications handling non-sensitive data or having a lower security profile.

However, for high-security scenarios, PoP becomes indispensable. Defenders must seriously consider implementing PoP in contexts such as:

  • Banking and Financial Systems: Mandated by regulations like PSD2 and FAPI, PoP is critical for securing financial transactions and API access where the compromise of an access token could lead to substantial financial losses.
  • Healthcare Systems: For APIs handling sensitive patient data or critical operations (like the "Ping of Death" API mentioned, which notifies the government of a death), token leakage could have severe, real-world consequences. PoP provides a vital layer of protection.
  • Cloud Infrastructure Portals: If powerful access tokens are stored in browser local storage or similar vulnerable locations for managing cloud resources, PoP ensures that even if these tokens are exfiltrated, an attacker cannot use them without the corresponding private key.

Defenders now have a choice between MTLS PoP and DPoP, each with distinct implications:

  • MTLS PoP (RFC 8705): This is ideal for organizations that already have a mature PKI and MTLS infrastructure in place. It leverages existing security investments and provides strong cryptographic binding at the transport layer. However, it's less suitable for mobile or highly distributed cloud environments where establishing end-to-end MTLS can be challenging or impossible.
  • DPoP (RFC Editor Draft): This offers a more flexible, application-layer solution, avoiding the network infrastructure demands of MTLS. It's potentially better suited for mobile apps, web applications, and cloud-native services. However, DPoP places a heavier burden on application developers, requiring extensive code changes across clients, token servers, and APIs. Defenders must ensure robust implementation of:
  • Replay Protection: Every API and token server must implement and maintain a replay cache for JWT IDs (jti) to prevent attackers from reusing Proof Tokens. This can be complex to scale.
  • Nonce Handling: Clients and servers must be prepared to handle server-issued nonces to mitigate clock skew and future token generation attacks, adding state management and retry logic.

In summary, defenders should perform a thorough risk assessment to determine if their application's security requirements warrant the adoption of PoP. If so, they must be prepared for the increased complexity and investment in development and infrastructure. The choice between MTLS PoP and DPoP will depend on the organization's existing capabilities, target environments, and tolerance for application-level versus infrastructure-level complexity. PoP does not come for free, but for critical systems, its security benefits far outweigh the implementation challenges.

Key Takeaways

  • Bearer tokens, while easy to use, are inherently vulnerable to leakage and unauthorized use, making them unsuitable for high-security applications.
  • Proof of Possession (PoP) provides a crucial security enhancement by cryptographically binding access tokens to the client, preventing misuse if tokens are stolen.
  • The journey to standardize PoP has been long and fraught with challenges, with early attempts in WS-Security and OAuth 1.0 failing due to excessive complexity, and Token Binding being abandoned.
  • Recent industry demands, particularly from financial regulations like PSD2 and FAPI, have driven the development of modern PoP standards.
  • OAuth Mutual TLS (MTLS PoP), formalized in RFC 8705, binds tokens to x509 client certificates and is suitable for environments with existing PKI and MTLS infrastructure.
  • Demonstrating Proof of Possession (DPoP) is an emerging, application-layer standard that uses ephemeral key pairs and JWTs to provide PoP without requiring specialized network infrastructure.
  • DPoP, while simpler in concept, introduces its own complexities, including the need for robust replay protection, handling client clock skew, and potentially implementing server-issued nonces.
  • PoP is not necessary for all OAuth deployments, but it is critical for high-security applications in sectors like finance, healthcare, and sensitive cloud management, where the cost of a token compromise is severe.

About the Speaker(s)

Dominick Baier is a highly experienced professional in the identity space, with over 20 years of dedicated work in security and identity management. Throughout his career, he has been deeply involved in the evolution of various security token services and protocols, starting with older technologies like Kerberos, WS-Security, WS-Trust, and WS-Federation, and progressing to modern standards such as OpenID Connect and OAuth. He is currently the CEO and founder of Duende Software, a company known for its product IdentityServer, which is a widely adopted framework for building OAuth and OpenID Connect token servers. His extensive background and direct involvement in the development and implementation of these protocols make him a leading authority on the intricacies of OAuth security.

Reviews

Dr. Zero (Offensive Security Researcher) — SOLID

Bearer tokens are just long passwords we shove in HTTP headers. Baier drops a brutal, honest history of why fixing this with Proof of Possession (PoP) has been a 15-year nightmare, and what you actually have to build today to stop token exfiltration.

Heather Calloway (CISO) — STRONG ACCEPT

A deeply pragmatic look at why default OAuth bearer tokens are no longer sufficient for high-trust environments. Baier outlines the emerging standards for Proof of Possession (MTLS and DPoP), detailing the severe engineering trade-offs required to stop token theft. It is mandatory viewing for identity architects and highly relevant for security leadership navigating regulatory mandates.

→ Top-rated talks at TROOPERS23

All talks from TROOPERS23