Re: [secdir] Review of: draft-ietf-oauth-json-web-token

Mike Jones <Michael.Jones@microsoft.com> Tue, 23 September 2014 23:21 UTC

Return-Path: <Michael.Jones@microsoft.com>
X-Original-To: secdir@ietfa.amsl.com
Delivered-To: secdir@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 554591A8972; Tue, 23 Sep 2014 16:21:12 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.701
X-Spam-Level:
X-Spam-Status: No, score=-0.701 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, J_CHICKENPOX_32=0.6, J_CHICKENPOX_34=0.6, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=no
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 koO6mDIK0foM; Tue, 23 Sep 2014 16:21:08 -0700 (PDT)
Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0142.outbound.protection.outlook.com [65.55.169.142]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 3BDFE1A8973; Tue, 23 Sep 2014 16:21:08 -0700 (PDT)
Received: from BN3PR0301CA0009.namprd03.prod.outlook.com (25.160.180.147) by DM2PR0301MB1216.namprd03.prod.outlook.com (25.160.219.17) with Microsoft SMTP Server (TLS) id 15.0.1034.13; Tue, 23 Sep 2014 23:21:07 +0000
Received: from BY2FFO11FD019.protection.gbl (2a01:111:f400:7c0c::132) by BN3PR0301CA0009.outlook.office365.com (2a01:111:e400:4000::19) with Microsoft SMTP Server (TLS) id 15.0.1034.13 via Frontend Transport; Tue, 23 Sep 2014 23:21:06 +0000
Received: from mail.microsoft.com (131.107.125.37) by BY2FFO11FD019.mail.protection.outlook.com (10.1.14.107) with Microsoft SMTP Server (TLS) id 15.0.1029.15 via Frontend Transport; Tue, 23 Sep 2014 23:21:05 +0000
Received: from TK5EX14MBXC286.redmond.corp.microsoft.com ([169.254.1.23]) by TK5EX14HUBC104.redmond.corp.microsoft.com ([157.54.80.25]) with mapi id 14.03.0195.002; Tue, 23 Sep 2014 23:20:33 +0000
From: Mike Jones <Michael.Jones@microsoft.com>
To: Warren Kumari <warren@kumari.net>, "secdir@ietf.org" <secdir@ietf.org>, "draft-ietf-oauth-json-web-token.all@tools.ietf.org" <draft-ietf-oauth-json-web-token.all@tools.ietf.org>
Thread-Topic: Review of: draft-ietf-oauth-json-web-token
Thread-Index: AQHPxjXHxo1AOZ59oEC2WFnyXP3ehZvzMhKQgBxLLKA=
Date: Tue, 23 Sep 2014 23:20:32 +0000
Message-ID: <4E1F6AAD24975D4BA5B16804296739439BA6F10C@TK5EX14MBXC286.redmond.corp.microsoft.com>
References: <CAHw9_iJqA=frT15_UFCFUCvTkqTsKSOOOyBct-3UeE19ge7AFw@mail.gmail.com> <4E1F6AAD24975D4BA5B16804296739439AE9DB28@TK5EX14MBXC292.redmond.corp.microsoft.com>
In-Reply-To: <4E1F6AAD24975D4BA5B16804296739439AE9DB28@TK5EX14MBXC292.redmond.corp.microsoft.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [157.54.51.78]
Content-Type: multipart/alternative; boundary="_000_4E1F6AAD24975D4BA5B16804296739439BA6F10CTK5EX14MBXC286r_"
MIME-Version: 1.0
X-EOPAttributedMessage: 0
X-Forefront-Antispam-Report: CIP:131.107.125.37; CTRY:US; IPV:NLI; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(438002)(13464003)(51444003)(377454003)(51914003)(199003)(189002)(95666004)(64706001)(77096002)(2656002)(87936001)(2201001)(92726001)(76176999)(46102003)(90102001)(76482002)(19300405004)(21056001)(85806002)(84326002)(106466001)(107046002)(86362001)(33656002)(83072002)(74662003)(230783001)(79102003)(81342003)(99396002)(85852003)(55846006)(92566001)(77982003)(80022003)(81156004)(81542003)(106116001)(512874002)(15202345003)(83322001)(15975445006)(66066001)(31966008)(71186001)(85306004)(15395725005)(16236675004)(4396001)(74502003)(20776003)(104016003)(120916001)(19580395003)(68736004)(54356999)(2501002)(50986999)(6806004)(19625215002)(19617315012)(84676001)(44976005)(19580405001)(69596002)(10300001)(97736003)(86612001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR0301MB1216; H:mail.microsoft.com; FPR:; MLV:sfv; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en;
X-Microsoft-Antispam: UriScan:;
X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB1216;
X-O365ENT-EOP-Header: Message processed by - O365_ENT: Allow from ranges (Engineering ONLY)
X-Forefront-PRVS: 0343AC1D30
Received-SPF: Pass (protection.outlook.com: domain of microsoft.com designates 131.107.125.37 as permitted sender) receiver=protection.outlook.com; client-ip=131.107.125.37; helo=mail.microsoft.com;
Authentication-Results: spf=pass (sender IP is 131.107.125.37) smtp.mailfrom=Michael.Jones@microsoft.com;
X-OriginatorOrg: microsoft.onmicrosoft.com
Archived-At: http://mailarchive.ietf.org/arch/msg/secdir/8pv1XX6CeyLFUoyvCWWRAmaU3wU
Cc: "oauth@ietf.org" <oauth@ietf.org>
Subject: Re: [secdir] Review of: draft-ietf-oauth-json-web-token
X-BeenThere: secdir@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Security Area Directorate <secdir.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/secdir>, <mailto:secdir-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/secdir/>
List-Post: <mailto:secdir@ietf.org>
List-Help: <mailto:secdir-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/secdir>, <mailto:secdir-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Sep 2014 23:21:12 -0000

Thanks again for your review, Warren.  The resolutions discussed below have been applied in the -26 draft.

                                                                -- Mike

From: OAuth [mailto:oauth-bounces@ietf.org] On Behalf Of Mike Jones
Sent: Friday, September 05, 2014 5:28 PM
To: Warren Kumari; secdir@ietf.org; draft-ietf-oauth-json-web-token.all@tools.ietf.org
Cc: oauth@ietf.org
Subject: Re: [OAUTH-WG] Review of: draft-ietf-oauth-json-web-token


Thanks for the useful review, Warren.  I’m cc’ing the working group so they’re aware of the contents of your review.  Replies inline below…



-----Original Message-----
From: Warren Kumari [mailto:warren@kumari.net]
Sent: Monday, September 01, 2014 3:40 PM
To: secdir@ietf.org<mailto:secdir@ietf.org>; draft-ietf-oauth-json-web-token.all@tools.ietf.org<mailto:draft-ietf-oauth-json-web-token.all@tools.ietf.org>
Subject: Review of: draft-ietf-oauth-json-web-token



Be ye not afraid -- I have reviewed this document as part of the security directorate's ongoing effort to review all IETF documents being processed by the IESG.  These comments were written primarily for the benefit of the security area directors.  Document editors and WG chairs should treat these comments just like any other last call comments.



Disclaimer: I know next to nothing about JOSE. In reading this document I also went off and read some other JOSE work / WG documents.

The main thing that I learnt was that them thar JOSE folk sure do like their acronyms.. :-) My unfamiliarity with JOSE means that, unlike what the above boilerplate says, you should treat these less seriously than any other last call comments!



Summary:

Needs some work, nothing major.



Notes:

In a number of places the document says things like: "If any of the listed steps fails then the JWT MUST be rejected for processing." - does it actually *mean* to reject a JWT? What should an application do when it rejects a JTW (yes, I realize that this is somewhat application specific, but a general "Explode, killing everybody inside" vs "Simply pretend you didn't notice this" would be helpful).



As you point out, what it means to reject the JWS is actually application specific, so it’s not clear what else to say in this regard in the specification.  I suppose that we could say that it must be rejected by the application and leave it at that.  Would that work for you?



I'm a little confused by something in the Terminology section (Section 2):

Plaintext JWT

A JWT whose Claims are not integrity protected or encrypted.



The term plaintext to me means something like "is readable without decrypting / much decoding" (something like, if you cat the file to a terminal, you will see the information). Integrity protecting a string doesn't make it not easily readable. If this document / JOSE uses "plaintext" differently (and a quick skim didn't find anything about

this) it might be good to clarify. Section 6 *does* discuss plaintext JWTs, but doesn't really clarify the (IMO) unusual meaning of the term "plaintext" here.



I’ve discussed this with the other document editors and we agree with you that “plaintext” is not the most intuitive wording choice in this context.  Possible alternative terms are “Unsecured JWT” or “Unsigned JWT”.  I think that “Unsecured JWT” is probably the preferred term, since JWTs that are JWEs are also unsigned, but they are secured.  Working group – are you OK with this possible terminology change?  (Note that the parallel change “Plaintext JWS” -> “Unsecured JWS” would also be made in the JWS spec.)



MACed does not seem to be a well known term - surprisingly enough even MAC doesn't have an asterisk at https://www.rfc-editor.org/rfc-style-guide/abbrev.expansion.txt



Do you have another suggestion to replace “MACed” and “MACing”, other than verbose formulations like “that have a MAC applied to them”?  Given that in English usage it’s common to “verb a noun” (e.g., usage of the verb “Google”), I don’t think there’s actually any ambiguity as to the intended meaning.



Section 4:

"...  recipients MUST either reject JWTs with duplicate  Claim Names or use a JSON parser that returns only the lexically last  duplicate member name..."



This somewhat made me itch - some implementations will reject a given JWT, some will accept it -- I know very little about parsing JSON, but could you suggest which an implementation should prefer? Can I instruct standard parsers to do X in this case?



I understand the itchy feeling. ☺



Unfortunately, the intentional laxness in the spec in this regard is a reflection of the semantics of the actual JSON specifications and implementations.  For instance, http://tools.ietf.org/html/rfc7159#section-4 says:


   An object whose names are all unique is interoperable in the sense
   that all software implementations receiving that object will agree on
   the name-value mappings.  When the names within an object are not
   unique, the behavior of software that receives such an object is
   unpredictable.  Many implementations report the last name/value pair
   only.  Other implementations report an error or fail to parse the
   object, and some implementations report all of the name/value pairs,
   including duplicates.



This topic has been heavily discussed by the working group, and while the specs used to just say that objects with duplicate member names MUST be rejected, working group members, including Tim Bray (the editor of the JSON spec), prevailed on us to weaken this so that parsers that implement the ECMAscript behavior of returning only the last member name may be legally used.  (The argument was made that there was more security downside in effectively requiring people to write and debug their own strict parsers than in using laxer, but well-supported and debugged parsers.)



However, we also intentionally require that producers use only one instance of each member name, so that legally produced objects will never exercise the ambiguities that are present in real JSON parsers.  That seemed to be the most practical solution to the working group.



Section 4.1.4. "exp" (Expiration Time) Claim (and other time based Claims:

What should my behavior be if I simply don't know what the time is?

(I'm just a dumb device, and my RTC is claiming it is Jan1st, 1970) - I'm assuming I must not process this JWT? Does this create bootstrapping issues?



The use of all claims is optional.  It’s up to applications which ones make sense for them to use.  In use cases in which participants don’t know the time, either this claim would not be used by the application or the application would need to define application-specific behaviors for what to do in those cases.



5.3. Replicating Claims as Header Parameters This section scares me, and I hope I'm simply not understanding what is being proposed. If you send the unencrypted version of some encrypted Claims some implementations will make important security decisions based upon those unencrypted claims, even if you tell them in a serious voice not to. http://xkcd.com/1181/



For what it’s worth, the context in which this arose was when application used intermediate software that inspected the audience of an encrypted JWT in order to route it to the correct recipient.  Only the recipient has the key to decrypt the JWT and look at the encrypted audience value.  But by placing an unencrypted copy of the audience in the header, the routing software could inspect it and route it correctly.  This seemed to the working group like a legitimate use case, and so we decided to support it.  This feature was proposed and discussed in this thread: http://www.ietf.org/mail-archive/web/oauth/current/msg11315.html.



Also, the SHOULD in "If such replicated Claims are present, the application receiving them SHOULD verify that their values are identical, ..." - why is this not a MUST? And if an application *does* compare them and they are not identical, what should it do?  Perhaps a much stronger justification for carrying 2 copies of the data is in order.



The text right after this in the spec already answers this question: “unless the application defines other specific processing rules for these Claims”.  It’s a “SHOULD” because applications might need to do this.



Editorial:

The intro is almost identical to the abstract. Making the abstract more abstract, or the intro more introductory (I have no idea what many of the acronyms were!) would be nice. Something short explaining what a JWT is, why I'd like one,what they get used for, why I should keep reading this document would be very helpful - basically a background type section...



Specific wording suggestions would be welcomed.  As for not knowing what the acronyms are, I’m told that the style guides don’t allow references to be put in the abstract.  Otherwise, for instance, there would be a reference there to RFC 7159 so people who don’t know what JSON is know where to look to go find out.



Nits:

Abstract

O: is a compact URL-safe means

P: is a compact, URL-safe means



Thanks



3.  JSON Web Token (JWT) Overview

O: The contents of the JOSE Header describe

P: Spell out JOSE; first use in document as far as I could see



Actually, the first use of the term “JOSE Header” is in Section 2 (Terminology), where it is incorporated into this specification by reference.



5.2 "cty" (Content Type) Header Parameter

O: normal case where nested signing

P: normal case in which nested signing



Thanks



8.  Implementation Requirements

O: For instance, an application might require support

   for encrypted JWTs and Nested JWTs; another might require support

P: For instance, one application might require support [...], while another might require support [...]



Thanks



11. Security Considerations

O: The entire list of security considerations is beyond the scope of

   this document, but some significant considerations are listed here.

P: The entire list of security considerations is beyond the scope of this document.

R: A few of the considerations are already listed above; we don't need to restate that they are listed here -- and if we do, the assumption is that said list would follow, not be above.



Several reviewers have objected to this sentence.  Its removal is planned.



11.2 Signing and Encryption Order

O: While syntactically, the signing and encryption operations for Nested

   JWTs may be applied in any order,

P: While syntactically the signing and encryption operations for Nested

   JWTs may be applied in any order,



Thanks



--

I don't think the execution is relevant when it was obviously a bad idea in the first place.

This is like putting rabid weasels in your pants, and later expressing regret at having chosen those particular rabid weasels and that pair of pants.

   ---maf



                                                                Thanks again, Warren,

                                                                -- Mike