Subject: [OAUTH-WG] Benjamin Kaduk's Discuss on draft-ietf-oauth-jwt-bcp-06: (with DISCUSS and COMMENT)

From: Benjamin Kaduk via Datatracker <[email-masked]>
Date: Mon, 24 Jun 2019 16:20:15 -0700

Benjamin Kaduk has entered the following ballot position for
draft-ietf-oauth-jwt-bcp-06: Discuss

When responding, please keep the subject line intact and reply to all
email addresses included in the To and CC lines. (Feel free to cut this
introductory paragraph, however.)

Please refer to https://www.ietf.org/iesg/statement/discuss-criteria.html
for more information about IESG DISCUSS and COMMENT positions.

The document, along with other ballot positions, can be found here:
https://datatracker.ietf.org/doc/draft-ietf-oauth-jwt-bcp/

----------------------------------------------------------------------
DISCUSS:
----------------------------------------------------------------------

Thank you for assembling this document; it will be very valuable to the
community.  I intend to ballot Yes once the following items are
resolved:

Section 2.6 notes:
   Previous versions of the JSON format such as the obsoleted [RFC7159]
   allowed several different character encodings: UTF-8, UTF-16 and UTF-
   32.  This is not the case anymore, with the latest standard [RFC8259]
   only allowing UTF-8.  [...]

The actual situation is a bit more subtle than this text makes it seem;
interoperable JSON can only use non-UTF-8 with explicit mutual
prearrangement in a closed ecosystem.  So, while this statement is true
for Internet JWT usage, it may not be true for *all* JWT usage.
(I do see that in Section 3.7 of this document we do mandate UTF-8 for
JWT, which makes things unambiguous, even if this text here is not
correct.)

Section 3.2 notes:
   JWT libraries SHOULD NOT generate JWTs using "none" unless explicitly
   requested to do by the caller.

I couldn't find anywhere where we have matching guidance about "SHOULD
NOT consume JWTs using 'none' unless explicitly requested"; this seems
important enough to get called out explicitly.

----------------------------------------------------------------------
COMMENT:
----------------------------------------------------------------------

I also have some non-Discuss-level substantive comments in the section-by-section notes,
in addition to the usual editorial nits.

Section 1

   and/or encrypted.  The JWT specification has seen rapid adoption
   because it encapsulates security-relevant information in one, easy to
   protect location, and because it is easy to implement using widely-

nit: "one easy-to-protect location".

Section 2.2

I'd consider rewording the text here to make it more poignant; perhaps:

  In addition, some applications use a keyed MAC algorithm such as
  "HS256" to sign tokens, but supply a weak symmetric key with
  insufficient entropy (such as a human memorable password).  Such keys
  are vulnerable to offline brute-force or dictionary attacks once an
  attacker possesses such a token.

Section 2.4

I'd suggest noting that the compression attacks are particularly
powerful when there is attacker-controlled data in the same compression
space as secret data.

Section 3.2

   Therefore, applications MUST only allow the use of cryptographically
   current algorithms that meet the security requirements of the
   application.  This set will vary over time as new algorithms are
   introduced and existing algorithms are deprecated due to discovered
   cryptographic weaknesses.  Applications MUST therefore be designed to
   enable cryptographic agility.

This seems to have high overlap with BCP 201; a reference is probably in
order.

Section 3.4

   Some cryptographic operations, such as Elliptic Curve Diffie-Hellman
   key agreement ("ECDH-ES") take inputs that may contain invalid
   values, such as points not on the specified elliptic curve or other
   invalid points (see e.g.  [Valenta], Sec. 7.1).  Either the JWS/JWE
   library itself must validate these inputs before using them or it
   must use underlying cryptographic libraries that do so (or both!).

side note: A phrasing like "JWS/JWE libraries MUST ensure that such
input validation occurs" would leave the same wiggle room for the
validation to occur at the underlying crypto layer, while leaving it
crystal clear what entity is responsible for ensuring that the checks
occur".  But since I don't expect a change of this nature to actually
cause different behavior by implementors, I'm not very tied to it.

Section 3.8

When we say "[o]ther applications may use different means of binding
keys to issuers", is there any value in noting that certification by a
trusted authority is a common way to perform this binding (in some
contexts)?

Section 3.9

   If the same issuer can issue JWTs that are intended for use by more
   than one relying party or application, the JWT MUST contain an "aud"
   (audience) claim that can be used to determine whether the JWT is
   being used by an intended party or was substituted by an attacker at
   an unintended party.  Furthermore, the relying party or application
   MUST validate the audience value and if the audience value is not
   present or not associated with the recipient, it MUST reject the JWT.

(grammar nit?) Is the "Furthermore" sentence supposed to still be scoped
to the case where the issuer can issue JWTs for more than one audience?
If not, it seems like we're requiring the rejection of all "aud"-less
JWTs but not requiring "aud" to be present when generating them.

Section 3.10

                                                Applications should
   protect against such attacks, e.g., by matching the URL to a
   whitelist of allowed locations, and ensuring no cookies are sent in
   the GET request.

This could probably be a SHOULD (or even a MUST?).

Section 3.11

   When applying explicit typing to a Nested JWT, the "typ" header
   parameter containing the explicit type value MUST be present in the
   inner JWT of the Nested JWT (the JWT whose payload is the JWT Claims
   Set).  The same "typ" header parameter value MAY be present in the
   outer JWT as well, to explicitly type the entire Nested JWT.

This is an interesting recommendation, as it is in some sense
*introducing* type confusion by using the same type name for JWTs with
different structures (the inner and outer JWTs)!  My sense is that it is
not practical to change current usage, though, so I think this should be
treated as a side note and not an actionable recommendation.

Section 3.12

   -  Use different keys for different kinds of JWTs.  Then the keys
      used to validate one kind of JWT will fail to validate other kinds
      of JWTs.

It might be worth calling back an analogy to RFC 8037's security
considerations (where we advise to keep an association between key
material and key algorithm), in effect extending the scope of
"algorithm" to include application usage.

   Given the broad diversity of JWT usage and applications, the best
   combination of types, required claims, values, header parameters, key
   usages, and issuers to differentiate among different kinds of JWTs
   will, in general, be application specific.  For new JWT applications,
   the use of explicit typing is RECOMMENDED.

This last recommendation seems to duplicate one from the end of Section
3.11.  While it's important and worth reiterating, we do usually try to
avoiding using normative RFC 2119 language when repeating ourselves, to
make it very clear which requirement is the binding one.