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

Mike Jones <Michael.Jones@microsoft.com> Sat, 06 September 2014 00:29 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 B98A31A06A3; Fri, 5 Sep 2014 17:29:03 -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, 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 qm1_Z9VZUVeT; Fri, 5 Sep 2014 17:29:00 -0700 (PDT)
Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0781.outbound.protection.outlook.com [IPv6:2a01:111:f400:fc10::1:781]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2ECAE1A0670; Fri, 5 Sep 2014 17:29:00 -0700 (PDT)
Received: from CH1PR03CA006.namprd03.prod.outlook.com (10.255.156.151) by BN1PR0301MB0723.namprd03.prod.outlook.com (25.160.78.142) with Microsoft SMTP Server (TLS) id 15.0.1024.12; Sat, 6 Sep 2014 00:28:36 +0000
Received: from BY2FFO11FD022.protection.gbl (10.255.156.132) by CH1PR03CA006.outlook.office365.com (10.255.156.151) with Microsoft SMTP Server (TLS) id 15.0.1019.16 via Frontend Transport; Sat, 6 Sep 2014 00:28:36 +0000
Received: from mail.microsoft.com (131.107.125.37) by BY2FFO11FD022.mail.protection.outlook.com (10.1.15.211) with Microsoft SMTP Server (TLS) id 15.0.1010.11 via Frontend Transport; Sat, 6 Sep 2014 00:28:35 +0000
Received: from TK5EX14MBXC292.redmond.corp.microsoft.com ([169.254.1.60]) by TK5EX14HUBC106.redmond.corp.microsoft.com ([157.54.80.61]) with mapi id 14.03.0195.002; Sat, 6 Sep 2014 00:28:22 +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: AQHPxjXHxo1AOZ59oEC2WFnyXP3ehZvzMhKQ
Date: Sat, 06 Sep 2014 00:28:21 +0000
Message-ID: <4E1F6AAD24975D4BA5B16804296739439AE9DB28@TK5EX14MBXC292.redmond.corp.microsoft.com>
References: <CAHw9_iJqA=frT15_UFCFUCvTkqTsKSOOOyBct-3UeE19ge7AFw@mail.gmail.com>
In-Reply-To: <CAHw9_iJqA=frT15_UFCFUCvTkqTsKSOOOyBct-3UeE19ge7AFw@mail.gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [157.54.51.70]
Content-Type: multipart/alternative; boundary="_000_4E1F6AAD24975D4BA5B16804296739439AE9DB28TK5EX14MBXC292r_"
MIME-Version: 1.0
X-EOPAttributedMessage: 0
X-Forefront-Antispam-Report: CIP:131.107.125.37; CTRY:US; IPV:CAL; IPV:NLI; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019017)(438002)(189002)(377454003)(199003)(43784003)(51914003)(13464003)(51444003)(46102001)(64706001)(20776003)(81542001)(81342001)(2501002)(16236675004)(15395725005)(106466001)(86362001)(81156004)(92566001)(106116001)(2201001)(92726001)(512874002)(54356999)(77982001)(99396002)(79102001)(44976005)(50986999)(97736003)(76482001)(19580405001)(76176999)(6806004)(19580395003)(85306004)(55846006)(71186001)(68736004)(80022001)(19300405004)(83322001)(66066001)(69596002)(33656002)(31966008)(4396001)(26826002)(77096002)(90102001)(230783001)(95666004)(19617315012)(104016003)(19625215002)(74502001)(74662001)(84676001)(84326002)(85806002)(15202345003)(107046002)(86612001)(21056001)(2656002)(87936001)(15975445006)(85852003)(83072002)(372894003); DIR:OUT; SFP:1102; SCL:1; SRVR:BN1PR0301MB0723; H:mail.microsoft.com; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en;
X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;UriScan:;
X-O365ENT-EOP-Header: Message processed by - O365_ENT: Allow from ranges (Engineering ONLY)
X-Forefront-PRVS: 03264AEA72
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/_MgHja4r5cfyUHAVryIKvpzL8vU
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: Sat, 06 Sep 2014 00:29:04 -0000

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; 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