[OAUTH-WG] WGLC review of OAuth 2.0 Security Best Current Practice by Mike Jones

Mike Jones <Michael.Jones@microsoft.com> Wed, 20 November 2019 03:40 UTC

Return-Path: <Michael.Jones@microsoft.com>
X-Original-To: oauth@ietfa.amsl.com
Delivered-To: oauth@ietfa.amsl.com
Received: from localhost (localhost []) by ietfa.amsl.com (Postfix) with ESMTP id 6BCFF12002E for <oauth@ietfa.amsl.com>; Tue, 19 Nov 2019 19:40:40 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 1.595
X-Spam-Level: *
X-Spam-Status: No, score=1.595 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, HTML_OBFUSCATE_05_10=0.26, RCVD_IN_SBL_CSS=3.335, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=microsoft.com
Received: from mail.ietf.org ([]) by localhost (ietfa.amsl.com []) (amavisd-new, port 10024) with ESMTP id 1ov6TXYaiX48 for <oauth@ietfa.amsl.com>; Tue, 19 Nov 2019 19:40:37 -0800 (PST)
Received: from NAM06-DM3-obe.outbound.protection.outlook.com (mail-dm3nam06on071e.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe56::71e]) (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 AAB62120288 for <oauth@ietf.org>; Tue, 19 Nov 2019 19:40:37 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iTpCPA+Mpl1n3mshDWIM2INu7D63kORBQVQjycqa3R/SkB3/0GBgNrcY4FPFZmpUoyuM2Mfn68x22skZbh7nMO9OGTSV/zyppHOe1fs4m6yCfngANO44Llli+5XPR+m1xHcwVZ1bUqiRk1vEqDZZQ6zB9ce5MKsmB+NsYJs3tDYJmI4hckoXZgoJJgaO7fvUhmYyREG3sG/1VMlYrGCcYzNpAhHJY48QtpacmX/rivZATxqWKvAGaTNrNshLQ9kr26JFaIZlCRL2rK9XH/gYVBYKRHrJqeISlflekWeftXChB1/p4Fcc8notOEQNO1eEUypaSk/JsSr0ygg0Wlk+tw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9hESJc0ISrkt1LfxCQ1lTWhs07ruJ0DiwU4krQXDwdY=; b=K4A7j77yPTTTYDXgTuL9XHDvThHILhX26lYTI3cTS9IqP1dohmmEsr45uWVziidnM+YTS8T5VROdvgoHBg7IJqaNECVzY6aYdkxQiVV8JFIH243tac6PrW8F0FB4hXvtpFH9LZ3OBcukcpw5e9U+1JiibEY8QRsxbM0VOMNJhGKIYvhzAxZEKfcSbGzhgJqx2fuqFjTRlkClcb2zbLi8RaacxSWBKmWKKHanPH3WB2bBpdBIinrK4XcLhXbUd7iBn/eUIzKsMbzRO9gIfSSzbL/2fXnDJpFm5H5EgXPP2KNZuohpk9Tk4jOVnGfPHn/Y/IKcIIV/uOl5sv4296RbmA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9hESJc0ISrkt1LfxCQ1lTWhs07ruJ0DiwU4krQXDwdY=; b=c0b2e5gmQm7m7u0U5OlcOiCzhi9NlZhKGTR5UNVkKpJmHT/2+34bM0swdvCQy8AVlgL/4Z9/WZZgm/idcEdqMnRaGoTI95nSvl5Ug2iFlCxIWxU7Y2bQjHkQ3gBHfPlJl1ungqxdqdmN/i6Zu2SSET6xbYvuGwFQsGqJX5bnaTI=
Received: from BN8PR00MB0563.namprd00.prod.outlook.com ( by BN8PR00MB0625.namprd00.prod.outlook.com ( with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2511.0; Wed, 20 Nov 2019 03:40:35 +0000
Received: from BN8PR00MB0563.namprd00.prod.outlook.com ([fe80::7153:fb4c:4bda:a31e]) by BN8PR00MB0563.namprd00.prod.outlook.com ([fe80::7153:fb4c:4bda:a31e%9]) with mapi id 15.20.2512.000; Wed, 20 Nov 2019 03:40:35 +0000
From: Mike Jones <Michael.Jones@microsoft.com>
To: "oauth@ietf.org" <oauth@ietf.org>
CC: "torsten@lodderstedt.net" <torsten@lodderstedt.net>, "ve7jtb@gmail.com" <ve7jtb@gmail.com>, 'Andrey Labunets' <isciurus@fb.com>, Daniel Fett <fett@danielfett.de>
Thread-Topic: WGLC review of OAuth 2.0 Security Best Current Practice by Mike Jones
Thread-Index: AdWevCfGnMmwe7mHRl6H8n/9kHkRog==
Date: Wed, 20 Nov 2019 03:40:34 +0000
Message-ID: <BN8PR00MB056369C04536770FF5B90512F54F0@BN8PR00MB0563.namprd00.prod.outlook.com>
Accept-Language: en-US
Content-Language: en-US
msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=985aa433-b8e7-454b-b6a4-0000e9f5e36d; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2019-11-19T09:31:22Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47;
authentication-results: spf=none (sender IP is ) smtp.mailfrom=Michael.Jones@microsoft.com;
x-originating-ip: []
x-ms-publictraffictype: Email
x-ms-office365-filtering-ht: Tenant
x-ms-office365-filtering-correlation-id: 03953eb3-33f9-4a30-c921-08d76d6b66f7
x-ms-traffictypediagnostic: BN8PR00MB0625:
x-microsoft-antispam-prvs: <BN8PR00MB062564EBAD3FB1E5968F762FF54F0@BN8PR00MB0625.namprd00.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:10000;
x-forefront-prvs: 02272225C5
x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(346002)(39860400002)(396003)(136003)(366004)(189003)(199004)(4326008)(25786009)(64756008)(52536014)(66946007)(66476007)(606006)(66446008)(66556008)(7696005)(486006)(76116006)(66066001)(8990500004)(2420400007)(15650500001)(3846002)(6116002)(7736002)(6916009)(790700001)(7110500001)(71190400001)(14444005)(256004)(71200400001)(86362001)(74316002)(5660300002)(2906002)(2351001)(10090500001)(66574012)(5640700003)(186003)(81166006)(33656002)(102836004)(8676002)(6436002)(966005)(8936002)(81156014)(1730700003)(6506007)(22452003)(99286004)(10290500003)(54896002)(6306002)(236005)(9686003)(2501003)(26005)(14454004)(54906003)(316002)(476003)(478600001)(55016002); DIR:OUT; SFP:1102; SCL:1; SRVR:BN8PR00MB0625; H:BN8PR00MB0563.namprd00.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1;
received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: /9iWixnQTlM0rcEU7dJ3k/1TdHpAboYm6Vu1unXPuznx8t3dpREIOoz0OgrEP9kN0TwF8/Y+pSHUBvjjEK9pcUscA7Wiz9I3ubhDwE1FnfbG6K4L9CMT76zjGof9kDrJ/aNhfCXYgxxGEZxFiALS9m9D/N/MTMTVI4LqBIPIb04P/RAJgdRefSlUyuUF92SmBEbd/4d408nqGNk07cYD55x7LGiWH5XjERs4y9rR9BfWKWKWyKT1BimxBLsVkIgSWRv/9MgLOcACgoR4F+nDX07+q7IaomiBH+86s0OucggoI0bmhgZeyaNjkTj3SU4UPeCy5k/Qobr0TMhljPbue6naTS1cBYfv5fXmQNiz/utoXryj6vLKSo2pnRxVSjZC+em6XkKNp/BF7YXdvWLGwCsBuz5yn/PZAJfqO2hdR+UJUCPI2YML/U+SLNxRH6XUIXJSW+GrqCUIW2nUgriYWyy1EVF+QEuUCGvZmpaRMyo=
x-ms-exchange-transport-forked: True
Content-Type: multipart/alternative; boundary="_000_BN8PR00MB056369C04536770FF5B90512F54F0BN8PR00MB0563namp_"
MIME-Version: 1.0
X-OriginatorOrg: microsoft.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 03953eb3-33f9-4a30-c921-08d76d6b66f7
X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Nov 2019 03:40:35.0259 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: 0EWEw1HQTIt4HFPZq3+1tRWTRCJy0zx4U4GwSZd1H94e8A5fphcYgHmXctkdsVle+r++xkSb3u0WW7v/xZH8og==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR00MB0625
Archived-At: <https://mailarchive.ietf.org/arch/msg/oauth/EGp_W1r-6x4oJm-gOLHuP259_VM>
Subject: [OAUTH-WG] WGLC review of OAuth 2.0 Security Best Current Practice by Mike Jones
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, 20 Nov 2019 03:40:40 -0000

I did a complete read of draft-ietf-oauth-security-topics-13<https://tools.ietf.org/html/draft-ietf-oauth-security-topics-13>.  My review comments follow, divided into substantive and editorial sections.


2. Attacker Model, (A1) - Attacker description (A1) actually describes two kinds of attacks - the Web Attackers attack at the start of the bullet and the phishing attack, whose description starts with "It must also be assumed that web attackers can lure the user".  Separate these two distinct attacks in the description, labelling the phishing attack (A2).

3.1 Protecting Redirect-Based Flows, paragraph 3 - Please state that the use of "nonce" as defined in OpenID Connect is another means of preventing CSRF attacks (similar to how state can be used for this).

3.1.1. Authorization Code Grant - This starts by saying that "Clients utilizing the authorization grant type MUST use PKCE" but later contradicts this MUST by saying "OpenID Connect clients MAY use the "nonce" parameter of the OpenID Connect ... for the same purpose".  At the very least, reword the second to say "Alternatively, OpenID Connect clients...", making it clear that MUST does not apply to Connect clients.  Or consider other editorial ways to make this distinction even clearer.

3.1.2. Implicit Grant - The statement "no viable mechanism exists to cryptographically bind access tokens issued in the authorization response to a certain client" isn't actually true.  Please describe how the OpenID Connect ID Token achieves this for the "id_token token" and "code id_token token" response types via the "at_hash" claim in this paragraph, and appropriately qualify the unconditional statement cited.

3.3. Access Token Privilege Restriction, last paragraph - This paragraph is essentially talking about placing audience restrictions on access tokens, but fails to use the standard "audience" term.  Please revise to explicitly describe utilizing audience restrictions for access tokens.

4.1.3. Proposed Countermeasures, second bullet - Please explain how "Clients MAY drop fragments" in such a way that the recommendation is actionable without having to go and read the reference.

4.3.2.  Access Token in Browser History - Strengthen the prohibition on passing access tokens in query parameters along the following lines: "Clients MUST NOT pass access tokens as a URI query parameter in the way described in Section 2.3 of [RFC 6750]."  (As background, note that the OpenID Certification testing software treats doing so as a FAILURE, preventing certification.)

4.4.1. Attack Description - Item 2 says "The attacker intercepts this request and changes the user's selection to "A-AS"."  Please expand this description to say *how* the attacker accomplishes this.  (Most readers of this spec will not be security experts, so this should be spelled out for them.)

4.4.1. Attack Description - Item 4 says "Now the attacker intercepts this response and changes the redirection such that the user is being redirected to H-AS."  Like the previous comment, please expand this description to say *how* the attacker accomplishes this.

4.4.1. Attack Description - The last bullet cites attacks on OpenID Connect.  Again, to make this description more accessible to readers, it would be useful to include a one-sentence description of each of the pertinent attacks here, saying how they work and what they accomplish.

4.5.1. Attack Description - Item 3 says "The attacker injects the stolen authorization code in the response of the authorization server to the legitimate client".  As per pervious comments, please expand this description to say *how* the attacker accomplishes this.

4.5.1. Attack Description, item 4 - Clearly say whether the client_id and client_secret used are those of the attacker's client or those of the client being attacked.  If the latter, say how these values for the client being attacked were obtained by the attacker.

4.5.3. Proposed Countermeasures - The draft uses the term "pre-warmed secrets" without defining the term or providing a citation for it.  Please do both.

4.7.1. Proposed Countermeasures - Change "Alternatively, PKCE provides CSRF protection" to "Alternatively, PKCE or the "nonce" provide CSRF protection".

4.7.1. Proposed Countermeasures - Change "If an authorization server does not support PKCE, "state" MUST be used for CSRF protection" to "If an authorization server does not support PKCE, "state" or "nonce" MUST be used for CSRF protection".

4.7.1. Proposed Countermeasures, last paragraph - Expand the oblique phrase "standard CSRF defenses" to give examples of such defenses and citations for them.  As currently written, this countermeasure won't be comprehensible or actionable by many readers. Metadata - This section suggests the use of a "resource_servers" metadata value.  This isn't defined by RFC 8414 nor do I see it the IANA OAuth Authorization Server Metadata registry at https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtml#authorization-server-metadata.  Is this something that's been standardized elsewhere?  If so, please add a citation.  If not, please clearly say that this metadata value is not standardized, and is therefore unlikely to be interoperable. Metadata - This section suggests the use a "access_token_resource_server" token response value.  Please likewise clearly say that this parameter isn't a standard. Sender-Constrained Access Tokens - List DPoP as one of the possibilities for demonstrating proof of possession. Audience Restricted Access Tokens, next to last paragraph - When you list MTLS, also please state that the MTLS key can be used as a correlation handle, since it is the same for connections to all sites.

4.12. Refresh Token Protection - The draft says "refresh tokens belonging to the same grant may share a common id".  Augment this description to say what this ID is and where it is located, and if there's a pertinent standard or other reference for this ID, please include a citation.


1. Introduction - The wording "and, as the foundation of OpenID Connect [OpenID<https://tools.ietf.org/html/draft-ietf-oauth-security-topics-13#ref-OpenID>], identity providing" is awkward.  Change to "and as the basis for federated login using OpenID Connect [OpenID]".

1. Introduction - Change "While OAuth was used in a variety of scenarios and different kinds of deployments, the following challenges could be observed" to "While OAuth is used in a variety of scenarios and different kinds of deployments, the following challenges can be observed".

1. Introduction, bullet 1 - Add citations for the first uses of the terms "CSRF" and "referer header".

Many locations - You have misspelled the "referer" header name as "referrer" throughout the document.  (Yes, "referrer" is the correct English spelling.  The header name uses an English misspelling.)

1. Introduction, last paragraph - Change "such as [RFC7591<https://tools.ietf.org/html/rfc7591>] and [RFC8414<https://tools.ietf.org/html/rfc8414>]" to "such as the OAuth 2.0 Dynamic Client Registration Protocol [RFC7591<https://tools.ietf.org/html/rfc7591>] and OAuth 2.0 Authorization Server Metadata [RFC8414<https://tools.ietf.org/html/rfc8414>]".

1. Introduction, last paragraph - Delete "As a challenge to the community", as it doesn't add any value to the exposition.

2. Attacker Model, (A3) - Add a citation for the first use of the term "mix-up attack" (and consider deleting "so-called").

3.1.1. Authorization Code Grant - Change "authorization grant type" to "authorization code grant type".

3.1.2. Implicit Grant - The canonical order of composite response types is alphabetical.  Therefore, please change "token id_token" to "id_token token" and "code token id_token" to "code id_token token".

3.1.2. Implicit Grant, last paragraph - Add ", such as the "code id_token" response type" at the end of the first sentence.

3.3. Access Token Privilege Restriction, last paragraph - This paragraph is essentially talking about placing audience restrictions on access tokens, but fails to use the standard "audience" term.  Please revise to explicitly describe including audience restrictions for access tokens.

3.4. Resource Owner Password Grant - Include citations where you currently say (WebCrypto, WebAuthn).

4.1. Insufficient Redirect URI Validation - Add citations for the "Several successful attacks..." mentioned. Sender-Constrained Access Tokens - Delete "so-called".

Many locations - You use the term "id", which should always be spelled "ID".  (The English word "id" has a completely different meaning than "ID".)  Be sure to also change instances of "ids" to "IDs". Audience Restricted Access Tokens - Delete "basically".

Many locations - The draft often uses the word "which" when you mean "that".  For instance, in 4.9.2, please change "which could" to "that could" and in 4.11 change "which are" to "that are".  There's lots of places to look up the difference in meaning, but a rule of thumb that's usually right is that if you don't have a comma before the "which", it should probably be "that".

4.12. Refresh Token Protection - Change "legit" to "legitimate".

May locations - The spelling of ID Token is inconsistent in the draft - sometimes using "token" and sometimes using "Token".  I would suggest consistently using the spelling from OpenID Connect, which is "ID Token".

5.  Acknowledgements - If you choose to add me to the acknowledgements, please add me as "Michael B. Jones".  (Mike Jones is way too common a name.)

Thanks for taking these comments into account.

                                                       -- Mike