Re: [jose] High risk vulnerability in RFC 7515

Thai Duong <thaidn@google.com> Wed, 14 September 2016 16:52 UTC

Return-Path: <thaidn@google.com>
X-Original-To: jose@ietfa.amsl.com
Delivered-To: jose@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 623B712B295 for <jose@ietfa.amsl.com>; Wed, 14 Sep 2016 09:52:02 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.208
X-Spam-Level:
X-Spam-Status: No, score=-4.208 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RP_MATCHES_RCVD=-1.508, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=google.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 IQP0jMLiWm03 for <jose@ietfa.amsl.com>; Wed, 14 Sep 2016 09:52:00 -0700 (PDT)
Received: from mail-oi0-x230.google.com (mail-oi0-x230.google.com [IPv6:2607:f8b0:4003:c06::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id DF98812B1FA for <jose@ietf.org>; Wed, 14 Sep 2016 09:51:59 -0700 (PDT)
Received: by mail-oi0-x230.google.com with SMTP id w11so30863543oia.2 for <jose@ietf.org>; Wed, 14 Sep 2016 09:51:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=d3bxVBvqmP+p0WK32aHsuYXN5IPxVUatTGlxAKveFhY=; b=nlNT2j35hkUcznJSRkXxIGgrGOfop7m+Bmm0gFv6mxTY1CnZGcr0+x6d0Ybj8VFinZ RZA0OrHoXdMQLKp5pAB3IJmgxv5F6YIsRBp0CY0OmT0+RxjE1gAP+M/AVJwV0rAWL7IR W9aSKRq2+57AP2jzn8wCtG+k6UG9a7wHXVzfnrt6rMb+tszl3pBJpRW3zvp9GPh8j41K ILNuPssVWqGGdq0c7G3jCB613cNf8z5ngiwkip77J3OQG8wVv1LrF0nSlqX7XXB2w8Cn ocg6g2xapJl1aOJTxY06b3vPjU+iWvbEY3M5BgZLiufnD+CnbOetqmgcunb02GTjnRUP r61g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=d3bxVBvqmP+p0WK32aHsuYXN5IPxVUatTGlxAKveFhY=; b=YVc1ouvlxncm09cUEXZ6W/R/2aYjInjN6wU6gF3gPybh0dSM0Sq/47CKlVvHLYUiOc aGQJC5XilFLpAMBHn6U2valdG6gmP4cT4SzTIY4kLpiA/0KSuxoRwDMjxbJ4qapGwrs6 qh8vmtvmyXDylzEH6UiXJRjJuxJt1zdFTPjTJiocgBrFYiRZjmk2caiGKaSK6KeRV4SS KEge/fDo3cCqAIbdTX+AGqvX36CtpzD2U6fmog9pEr+x3g8CVu2QY4UjyIJZmOidHWPE LUuBu3NH4Ri6WmcYmuEwRDJUc52R03xW2+w/dOQ35bQqQ3CGEqEyyMX5+u+TzNVlPt8n YXnA==
X-Gm-Message-State: AE9vXwNBufffsXIcEF3YDqaUWxd/z8sFsr2dUcviUvEGt7lp0sT7FpNb5JlOPwu31RCUqBrNChmCT94ai+lQrVJ8
X-Received: by 10.202.76.139 with SMTP id z133mr3360560oia.29.1473871919035; Wed, 14 Sep 2016 09:51:59 -0700 (PDT)
MIME-Version: 1.0
References: <CAKkgqz3GdMG2Q=5jcuLnccWTs4jOjjR_8DzBdoiRE2uEkTLr1g@mail.gmail.com> <CAKkgqz2s8GKSYQ4_LGgupahrkyhmb0e9jWYenLR3X7bMePFy5w@mail.gmail.com> <1473871534.10979.12.camel@redhat.com>
In-Reply-To: <1473871534.10979.12.camel@redhat.com>
From: Thai Duong <thaidn@google.com>
Date: Wed, 14 Sep 2016 16:51:48 +0000
Message-ID: <CAPnkLjxpXXmV6KKhbbq=_bscAVmnHvk+U0hNg7o7_QKHg8v4Ww@mail.gmail.com>
To: Nathaniel McCallum <npmccallum@redhat.com>, Quan Nguyen <quannguyen@google.com>, Michael Jones <mbj@microsoft.com>, John Bradley <ve7jtb@ve7jtb.com>, 崎村夏彦 <n-sakimura@nri.co.jp>, jose@ietf.org
Content-Type: multipart/alternative; boundary="001a11c1769a2e2b34053c7a8cb8"
Archived-At: <https://mailarchive.ietf.org/arch/msg/jose/GIPFkBe7vfzNTtWoDCoYBuzWlRk>
X-Mailman-Approved-At: Wed, 14 Sep 2016 11:08:44 -0700
Subject: Re: [jose] High risk vulnerability in RFC 7515
X-BeenThere: jose@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: Javascript Object Signing and Encryption <jose.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/jose>, <mailto:jose-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/jose/>
List-Post: <mailto:jose@ietf.org>
List-Help: <mailto:jose-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/jose>, <mailto:jose-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 14 Sep 2016 17:56:39 -0000

(cross-posting from another thread)

One thing to keep in mind is that the public key tag contains a raw public
key, not a certificate.

How can the receivers verify the public key? They'll have to compute a
fingerprint and compare with some existing key. But if they already have
the key, a keyID should be used. Do you agree?

In other words the public key is useless. It's also dangerous because
people might forget to validate it.

On Wed, Sep 14, 2016, 9:45 AM Nathaniel McCallum <npmccallum@redhat.com>
wrote:

> OTOH, removing the 'jwk' parameter means that all attributes of keys
> need to be duplicated in the header namespace.
>
> I concur that nobody should trust the contents of the jwk parameter
> without additional verification. And I would support language of this
> type in an errata. But I think the 'jwk' parameter does have real
> value.
>
> On Wed, 2016-09-14 at 08:34 -0700, Quan Nguyen wrote:
> >
> >
> On Tue, Sep 13, 2016 at 8:43 PM, Quan Nguyen <quannguyen@google.com>
> > wrote:
> Hi,
>
> I'm Quan Nguyen, a Google Information Security Engineer.
>
> RFC 7515, https://tools.ietf.org/html/rfc7515#section-4.1.3  "jwk"
> > (JSON Web Key) Header Parameter allows the signature to include the
> > public key that corresponds to the key used to digitally sign the
> > JWS. This is a really dangerous option [1]
>
> This option allows any attacker to just generate private key /public
> > key pair, send the public key together with the signature and and
> > signature will be valid. It means that the signature is meaningless
> > and easily bypassed. Note that even if it's OPTIONAL, the attacker or
> > MITM can always include that field.
>
> I'm aware that you have a section 6 and Appendix D talking about key
> > trust decision. However:
>      1.  There is no reason to trust this key
>      2.  There is no way to verify public key's truthfulness to make
> > trust decision, unless the receiver already knows the public key in
> > advance (in that case, "kid" is enough).
>
> I've seen library making this mistake, but they just followed the
> > RFC, so it's hard to convince them to fix the issue. In the end of
> > the day, users are vulnerable. Furthermore, I believe this is RFC's
> > vulnerability, not the library.
>
> Regards,
>
> -Quan
>
> [1] I'm aware that there may be a rare use-case that needs to send
> > the public key, e.g., certificate signing request, but even in that
> > case, the user can send the public key, e.g, in opaque field in JWT.
>
>
> _______________________________________________
> jose mailing list
> jose@ietf.org
> https://www.
>