Re: [OAUTH-WG] New Version Notification for draft-fett-oauth-dpop-03.txt

"Richard Backman, Annabelle" <richanna@amazon.com> Wed, 27 November 2019 20:30 UTC

Return-Path: <prvs=227439623=richanna@amazon.com>
X-Original-To: oauth@ietfa.amsl.com
Delivered-To: oauth@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 258A1120908 for <oauth@ietfa.amsl.com>; Wed, 27 Nov 2019 12:30:07 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -11.8
X-Spam-Level:
X-Spam-Status: No, score=-11.8 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=amazon.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Jq1FEkBsHxL5 for <oauth@ietfa.amsl.com>; Wed, 27 Nov 2019 12:30:04 -0800 (PST)
Received: from smtp-fw-33001.amazon.com (smtp-fw-33001.amazon.com [207.171.190.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 1D0EB120804 for <oauth@ietf.org>; Wed, 27 Nov 2019 12:30:04 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1574886604; x=1606422604; h=from:to:cc:subject:date:message-id:references: in-reply-to:mime-version; bh=zqQYe7XGT6s9XrhAc3IAXoPqsI/hFU11QnNTZjS1WT0=; b=mjUMEU/d7i+iN3KYrqu0wRxM9vmk/2mXeXmq1My5cXJh3vADVCttzuwy sZkz+Y1XIn5rpbcmKBWyrK/Z6W/v9KzxhrbQuCvAbRlDpy+MEvrNFwvR9 yH1xzWFDYX3mH8IEHGEpjG6pOXSnUsP3DQqRwnGgWbKoIZNBlgiaeKjLJ k=;
IronPort-SDR: 6kefIBPbTLT2UxtFbOm8bJBrytiXIV5DUgPsWslI8oyKv09Np8x70Ue+ja3lWcODpPzMDGxj2F hvik2xBkXRDw==
X-IronPort-AV: E=Sophos; i="5.69,250,1571702400"; d="scan'208,217"; a="11667869"
Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-1a-67b371d8.us-east-1.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 27 Nov 2019 20:29:46 +0000
Received: from EX13MTAUWC001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1a-67b371d8.us-east-1.amazon.com (Postfix) with ESMTPS id 1CAAFA2303; Wed, 27 Nov 2019 20:29:44 +0000 (UTC)
Received: from EX13D11UWC003.ant.amazon.com (10.43.162.162) by EX13MTAUWC001.ant.amazon.com (10.43.162.135) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 27 Nov 2019 20:29:44 +0000
Received: from EX13D11UWC004.ant.amazon.com (10.43.162.101) by EX13D11UWC003.ant.amazon.com (10.43.162.162) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 27 Nov 2019 20:29:43 +0000
Received: from EX13D11UWC004.ant.amazon.com ([10.43.162.101]) by EX13D11UWC004.ant.amazon.com ([10.43.162.101]) with mapi id 15.00.1367.000; Wed, 27 Nov 2019 20:29:43 +0000
From: "Richard Backman, Annabelle" <richanna@amazon.com>
To: Neil Madden <neil.madden@forgerock.com>
CC: Brian Campbell <bcampbell@pingidentity.com>, oauth <oauth@ietf.org>
Thread-Topic: [OAUTH-WG] New Version Notification for draft-fett-oauth-dpop-03.txt
Thread-Index: AQHVmt2iG9RAznniNkuvKQ6riy594aeSJFIAgAD4+QCAAhU5gIAA7zqAgADa3AD//9TtAIAA3uqAgAJjuACAAgu/AIABCd+AgACdmgCAAR5qgIAAISqA
Date: Wed, 27 Nov 2019 20:29:43 +0000
Message-ID: <C8A4F5A0-BE4A-46BF-B440-FFE18E039D6C@amazon.com>
References: <3D5C611E-4B03-4A46-A22B-D8AC9FE0AC51@amazon.com> <D7215EC5-E9B5-4C9A-8E2A-1DAE8A5AA4D6@forgerock.com>
In-Reply-To: <D7215EC5-E9B5-4C9A-8E2A-1DAE8A5AA4D6@forgerock.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
user-agent: Microsoft-MacOutlook/10.1d.0.190908
x-ms-exchange-messagesentrepresentingtype: 1
x-ms-exchange-transport-fromentityheader: Hosted
x-originating-ip: [10.43.162.171]
Content-Type: multipart/alternative; boundary="_000_C8A4F5A0BE4A46BFB440FFE18E039D6Camazoncom_"
MIME-Version: 1.0
Archived-At: <https://mailarchive.ietf.org/arch/msg/oauth/aYMGYh78RG4TpLf50a1kX6jh1f8>
Subject: Re: [OAUTH-WG] New Version Notification for draft-fett-oauth-dpop-03.txt
X-BeenThere: oauth@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: OAUTH WG <oauth.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/oauth>, <mailto:oauth-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/oauth/>
List-Post: <mailto:oauth@ietf.org>
List-Help: <mailto:oauth-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/oauth>, <mailto:oauth-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 27 Nov 2019 20:30:07 -0000

> That is true, but is IMO more of a hindrance than an advantage for a PoP scheme. The very fact that the signature is valid at every RS is why you need additional measures to prevent cross-RS token reuse. The other methods you mention require their own additional measures in the form of key exchanges/handshakes. And you still need to prove possession of that shared key somehow. In some cases, “derive a shared key and encrypt this blob” is easier; in some cases “sign this blob declaring your audience” is easier.

> The easiest way to use macaroons with asymmetric crypto is to make the macaroon identifier be an encrypted random HMAC key that the RS can decrypt (or a derived key using diffie-hellman). You can concatenate multiple encrypted keys for multiple RSes. Alternatively in a closed ecosystem you can encrypt the random HMAC with a key stored in a KMS (such as AWS KMS) and grant each RS decrypt permissions for that KMS key.

Is the “random HMAC key that the RS can decrypt” the root key used to generate the macaroon? If so, how would you prevent one targeted RS from using the root key and macaroon identifier to construct an arbitrary macaroon for replay against another targeted RS? If not, how does the targeted RS use the decrypted “random HMAC key” to validate the macaroon? Is there a paper on this approach?

The KMS approach is just symmetric crypto mediated through a third party (and has the same centralization problem as validation at the AS).

> Clients can then later start adding caveats…, while RSes still don't have to make any changes….
> DPoP only effectively prevents cross-RS replay if all RSes implement it, otherwise the ones that don't are still vulnerable.
This is because macaroons bake the proof into the “bearer” token (which is no longer really a bearer token) in the Authorization header, whereas DPoP puts it in a separate header. draft-ietf-oauth-signed-http-request is another way to do this that doesn’t rely on macaroons.

> Your previous point was that they require "non-trivial work to use ... and require developers to learn a new token format".
By “non-trivial work to use” I was referring to work required from the working group, that I did not feel was being acknowledged. Looking back over the thread, I think my objection stems from you referring to macaroons as an “access token format” when they’re really an applied cryptography pattern. The “format” part would need to be defined by the working group. For what it’s worth, I think it’d be interesting to explore if/how the pattern could be applied to the JWT format, or what tweaks would be necessary to make it work. If we could describe a way to create macaroons that reuse the existing work on JWTs, that would be pretty cool.

> That burden is significantly reduced when developers can just add a dependency and call a one-liner to add a caveat.
Libraries can certainly reduce the amount of work required by developers (and here I mean client developers, RS developers, AS developers, and OAuth client and server library developers), but come with their own concerns (e.g., platform availability, licensing, maintenance and reliability, etc.). It becomes one more dependency that developers have to consider.

–
Annabelle Richard Backman
AWS Identity


From: Neil Madden <neil.madden@forgerock.com>
Date: Wednesday, November 27, 2019 at 2:32 AM
To: "Richard Backman, Annabelle" <richanna@amazon.com>
Cc: Brian Campbell <bcampbell@pingidentity.com>om>, oauth <oauth@ietf.org>
Subject: Re: [OAUTH-WG] New Version Notification for draft-fett-oauth-dpop-03.txt

On 27 Nov 2019, at 01:26, Richard Backman, Annabelle <richanna@amazon.com<mailto:richanna@amazon.com>> wrote:

> That’s not proof of possession, that’s just verifying a MAC. PoP requires the other party (client) to provide a fresh proof that they control a key. The client isn’t using any key in this case.

I think we’re operating with slightly different definitions for PoP. My definition is something along the lines of “a possessor of a key generated (or was in possession of) this data blob at some point.” You can probably see why we’re disagreeing over whether or not PoP is fundamental. I don’t think there is any point in continuing this semantic debate. 😃

See https://tools.ietf.org/html/rfc7800 for a definition (section 3.6 in particular).



> That’s not directly attached to the access token. This means that every RS has to know about DPoP.
True, but you could avoid that by embedding the access token in the DPoP proof (similar to draft-ietf-oauth-signed-http-request) and sending that as the sole token. Technically, that’s no longer a bearer token so sending it as “Authorization: bearer <token>” would be wrong, but DPoP already commits that sin.

Also, if the AS is doing all authentication checks, then in a lot of cases the RS will need to provide the AS with additional request metadata along with the macaroon, such as the POST method used, origin (if it’s not inferable from whatever credentials the RS uses when calling the AS), request path, sender IP, client TLS certificate, token binding ID, etc. Obviously there are some caveats that don’t require this (e.g., timestamp). It remains to be seen whether the caveats required to meet DPoP’s use case fall into the former or latter category.

That’s true - and the RS being able to send more contextual info to the token introspection endpoint would be useful regardless of token format.

The current model is that the AS validates the token and checks basic things like the expiry time or audience and then returns any other constraints to the RS such as the scope, any confirmation key, etc. This model can be followed with macaroons - eg the scope returned should be the intersection of the original token scope and any scope caveats on the token.

But for many of the things discussed in this thread, the AS can validate by itself. For example, if the client appends an audience restricting a token to one RS then the AS can validate that because the RS authenticates when it calls the introspection endpoint. If the client appends something like a “jti” caveat (probably renamed), then the AS can centrally record that to prevent replay - this has the same caveats on scalability, but at least can be done once at the AS rather than for each RS.



> Please explain how to achieve the examples I gave of layered attenuation without using macaroons.
> 1. The client adds caveats (eg exp = now+5s) to an access token and sends it to the RS. The RS creates four copies of the token with different scope constraints and sends them to four individual microservices.

For my example below:

  *   Let <at_0> be the access token obtained by the client from the AS
  *   Let JWE be a function that generates a JWE given a key and payload.
  *   Let <EKas> be the public encryption key for the AS.

Client:
<at_1> = JWE(<EKas>, { at: <at_0>, exp: … })


RS:
<at_2> = JWE(<EKas>, { at: <at_1>, scope: scope_a })
<at_3> = JWE(<EKas>, { at: <at_1>, scope: scope_b })
<at_4> = JWE(<EKas>, { at: <at_1>, scope: scope_c })
<at_5> = JWE(<EKas>, { at: <at_1>, scope: scope_d })


Assuming you can only append caveats here, not new claims, then this is functionally equivalent to macaroons. But only the AS can decrypt these layers, so the RS is still forced to call the AS's token introspection endpoint to validate this. So you've gained nothing over HMAC and added considerable CPU and size overhead and a reduction in security.

This is also only secure if the encryption scheme is non-malleable, which (if you want provable security) requires IND-CCA2. Not all JWE encryption schemes provide this, e.g. RSA1_5 would not be secure for this. The ones that are secure largely achieve that by the use of HMAC or another MAC in the authenticated content encryption because they are hybrid encryption schemes - effectively this is equivalent to using a macaroon where the identifier is an encrypted HMAC key, which you can already do with macaroons.

This pattern can be applied to the other scenarios you provided. The difference between macaroons and the above is that the former relies on chained HMACs and the latter on asymmetric crypto. You also lose the ability to inspect caveats or context that are already in the token, which may or may not be important. This is an interesting property of the macaroon pattern that I’m not sure you could replicate without basically implementing the macaroon pattern in a JWT format.

> Validation at the AS is an advantage in most cases…
Most, but not all. DPoP’s use of asymmetric signatures makes it more amenable to distributed validation in those scenarios where it is appropriate.

That is true, but is IMO more of a hindrance than an advantage for a PoP scheme. The very fact that the signature is valid at every RS is why you need additional measures to prevent cross-RS token reuse. This downside of signatures for authentication was pointed out by djb 18 years ago (https://groups.google.com/forum/m/#!msg/sci.crypt/73yb5a9pz2Y/LNgRO7IYXOwJ), which is why most modern crypto protocols either use Diffie-Hellman for authN (https://noiseprotocol.org) or sign a hash of an interactive handshake transcript (TLS 1.3 - https://tools.ietf.org/html/rfc8446#section-4.4.3) so that the signature is tightly bound to a specific interactive protocol run.


Your RS-specific token solution is only applicable to use cases where the RS-specific tokens are appropriate and viable. This is not a restriction that exists for DPoP as written. But you are correct, there are ways to use the macaroon pattern with asymmetric crypto. If that’s your proposal then I suggest specifying that, as most of the documentation I’ve seen (including the vast majority of the paper) focuses on the HMAC approach. While I can see how one could apply the pattern with asymmetric crypto, it wasn’t clear to me from that section of the paper that my thoughts match what they were describing.

The easiest way to use macaroons with asymmetric crypto is to make the macaroon identifier be an encrypted random HMAC key that the RS can decrypt (or a derived key using diffie-hellman). You can concatenate multiple encrypted keys for multiple RSes. Alternatively in a closed ecosystem you can encrypt the random HMAC with a key stored in a KMS (such as AWS KMS) and grant each RS decrypt permissions for that KMS key.




> The AS can start issuing macaroons without either clients or RS being aware….
I’m not entirely sure what value you’re trying to get at here. I think you mean that the token handling/validation logic at the RS and AS isn’t significantly different for non-constrained macaroons versus constrained macaroons, whereas it is for DPoP? True, for DPoP the RS would need to know that it should send the DPoP proof to the AS, but RSes could be configured to always include it if present in the request. On the AS side, regardless of token format the AS will need logic to validate that the sender constraint is fulfilled. This may be very simple (e.g., just a timestamp check), or as relative complex as validating a DPoP token, depending on the needs of the use case and the caveats involved.

My point is that if say Google decided to start issuing macaroon-based access tokens from their AS today, assuming that their RSes are doing token introspection (I've no idea if they do or not), then it's likely nothing would break. OAuth access tokens are opaque and their format unspecified, so only software that is making additional assumptions about the format of access tokens would be impacted. Clients can then later start adding caveats (by choosing to make additional assumptions about the token format), while RSes still don't have to make any changes. The RS would only need to make changes to support things like htu/htm, but these are only applicable if you want to provide defence against more advanced threat models such as TLS compromise.

DPoP only effectively prevents cross-RS replay if all RSes implement it, otherwise the ones that don't are still vulnerable. When you have 1000+ microservices (e.g., https://twitter.com/JackKleeman/status/1190354757308862468) then this is a big deal.



> (Re: asymmetric crypto) That’s not a requirement, it’s a technology choice.
Fair enough, but technology choices are driven by requirements. Based on conversations I’ve had with John Bradley (and others I think?), this one in particular stems in part from the desire to keep the key locked up behind the browser’s crypto API, and not directly exposed to JavaScript. I’m somewhat skeptical of the value of this, since an attacker could just as easily call the crypto API directly, but if we see this as a requirement, then that would seem to require asymmetric crypto. However, as you noted that would not rule out the use of the macaroon pattern.

Right, I don't think this works for browsers. (I don't think anything will work for browsers until they abandon the weak same-origin policy and replace it with a more serious security model, such as https://github.com/Agoric/SES). I think it is a genuine advantage of DPoP for mobile devices though, and I'd support a draft that targeted that use case specifically.



> There are plenty of existing interoperable macaroon libraries…
“Use one of these existing libraries” is not appropriate as normative text in a specification. That format needs to be explicitly defined. Caveat types (e.g., expiry, source IP, client TLS certificate, etc.) need to be defined, probably with an IANA registry. Processing instructions need to be written (e.g., what happens when caveats conflict?). Security considerations around third-party caveats need to be written.

Sure, but that's work for me and the WG (if there's interest in standardizing this). Your previous point was that they require "non-trivial work to use ... and require developers to learn a new token format". That burden is significantly reduced when developers can just add a dependency and call a one-liner to add a caveat.



> HMAC-SHA256 is very widely implemented (and usually securely). That’s all you need.
That’s what people said about SHA-1. Cryptographic agility is a feature, not a bug.

Actually I would bet a lot of money on HMAC-SHA256 not being broken any time during our lifetimes. HMAC-SHA1 is still secure, as is HMAC-MD5, despite both of those hash functions no longer being collision resistant. The reason is that (a) preimage resistance often holds up much better than collision resistance (e.g. the best preimage attacks against MD5 are still not practical), and (b) the security proofs for HMAC require only fairly minimal security properties from the underlying hash function.

HMAC-SHA256 operates at a 256-bit security level which provides a huge margin of safety against advances in cryptanalysis. It's also safe against quantum attacks, as the best known attack (Grover's algorithm) would at best reduce the security level to around a 128-bit level (which is still better than RSA 2048).



Again, I’m not saying we shouldn’t use macaroons, but I think you are underselling the amount of work required and overselling their value.

Compared to DPoP? I've deliberately confined myself to advantages that apply to DPoP in this thread, but they have advantages for other use-cases too.

-- Neil