Re: [jose] High risk vulnerability in RFC 7515

Thai Duong <thaidn@google.com> Wed, 14 September 2016 17:54 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 5333A12B3D7 for <jose@ietfa.amsl.com>; Wed, 14 Sep 2016 10:54:41 -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 Kl4JmJGRercl for <jose@ietfa.amsl.com>; Wed, 14 Sep 2016 10:54:38 -0700 (PDT)
Received: from mail-oi0-x234.google.com (mail-oi0-x234.google.com [IPv6:2607:f8b0:4003:c06::234]) (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 A2B7612B3F3 for <jose@ietf.org>; Wed, 14 Sep 2016 10:54:37 -0700 (PDT)
Received: by mail-oi0-x234.google.com with SMTP id r126so33681544oib.0 for <jose@ietf.org>; Wed, 14 Sep 2016 10:54:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=2UUpeV+bLCZwGN94Lh2nBlOkc6706xhVVLwev7V0Iks=; b=f7H9StIKGZw4bHHsEkz3vglkkcRPaibdZB3wV5qkQmTg197c2CzxoR+2cJBkuUuAa5 llK1TD1lSrMGhrK2tDs0WfvLQ3v7INx7JQ68ZS5D4cEwiYH75zi2z9s3pUUG526x7Ipu EdsfUnV711OC02fpPavUt5px9jtkgRdJrUXWdYh1aci+BZShvvTHCfvWFbK4WX3UCHLw iqHpOmnKEdGqXnNcUR4/WMJZcpPvSc7xwxSCuF1Nk8//II1MLsEfeTWWteEeovDn39SQ MZhz9igHOKkRcKnyq4MIEIUBlpZAIAKnDrG+novJg6xrBzuP8UsgxuOklhPUh9U67OaT 3n5A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=2UUpeV+bLCZwGN94Lh2nBlOkc6706xhVVLwev7V0Iks=; b=gA5PqVKnuZd3ohyKCxMZqPUW8yMvBlnQg31p73yPCVIbdiiUryT6lDGBgwyqmFxunw P87Eekj0gRCRUDZm/cP1XnyLsa2XxPbB9qZD9d/cM+46YftFkQGVxAjj9tEcDCBGDcTM 9TsKkGjqFgyMzVQtfNBJwmwFyB8SAtmfoadGKwPTT3z3FopQjR+IX51dOOlLlei8a5x0 JW+avUPijtHpZJhBGKt+D8GFC5zV1T1oa4T2uvEGK5Q40Rtv+xKh08hMyi26EHhJrocC xaxKnTl/7Oxr0TQmw1w5yB1aMtlj6+AzdUM6SuhDyXq3n4lcRVwlGgovucH4+Xoo+0Kj IEeA==
X-Gm-Message-State: AE9vXwONvtIEBujWiGA4lwF8TYWLa9FQtsCrR81UOO9iClzRMX3dum1s+IEHD3ZU5aNlwhUBtpAADHUR2CAvSg5k
X-Received: by 10.157.22.240 with SMTP id s45mr3412730ots.89.1473875676879; Wed, 14 Sep 2016 10:54:36 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.202.224.214 with HTTP; Wed, 14 Sep 2016 10:53:56 -0700 (PDT)
In-Reply-To: <009201d20eb0$16c11030$44433090$@augustcellars.com>
References: <CAKkgqz3GdMG2Q=5jcuLnccWTs4jOjjR_8DzBdoiRE2uEkTLr1g@mail.gmail.com> <CAKkgqz2s8GKSYQ4_LGgupahrkyhmb0e9jWYenLR3X7bMePFy5w@mail.gmail.com> <1473871534.10979.12.camel@redhat.com> <009201d20eb0$16c11030$44433090$@augustcellars.com>
From: Thai Duong <thaidn@google.com>
Date: Wed, 14 Sep 2016 10:53:56 -0700
Message-ID: <CAPnkLjwyCm1wRN83ir6zCBQKTa_zV32Z_Dhe7NzW046-PoUOXg@mail.gmail.com>
To: Jim Schaad <ietf@augustcellars.com>
Content-Type: multipart/alternative; boundary="001a11414e5a2a2882053c7b6c84"
Archived-At: <https://mailarchive.ietf.org/arch/msg/jose/4KXwTgoUso4pLYDAjTv_De3Cqvo>
X-Mailman-Approved-At: Wed, 14 Sep 2016 11:08:44 -0700
Cc: Quan Nguyen <quannguyen@google.com>, Nathaniel McCallum <npmccallum@redhat.com>, Michael Jones <mbj@microsoft.com>, jose@ietf.org, John Bradley <ve7jtb@ve7jtb.com>, 崎村夏彦 <n-sakimura@nri.co.jp>
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:24 -0000

On Wed, Sep 14, 2016 at 10:47 AM, Jim Schaad <ietf@augustcellars.com> wrote:

> The jwk parameter is required when doing ephermal-static ECDH as that is
> the only way to carry the ephemeral key from the sender to the recipient.
>

Quoting https://tools.ietf.org/html/rfc7515#section-4.1.3

"The "jwk" (JSON Web Key) Header Parameter is the public key that
   corresponds to the key used to digitally sign the JWS.  This key is
   represented as a JSON Web Key [JWK].  Use of this Header Parameter is
   OPTIONAL."

At any rate there's no reason that the ECDH ephemeral key shouldn't be part
of the ciphertext.


> One always needs to validate the key no matter how it is obtained so I
> would have a hard time not saying that this is a library user problem.
>

Blaming users is easy. Helping them not make mistakes is right.

> Jim
>
>
> > -----Original Message-----
> > From: jose [mailto:jose-bounces@ietf.org] On Behalf Of Nathaniel
> McCallum
> > Sent: Wednesday, September 14, 2016 9:46 AM
> > To: Quan Nguyen <quannguyen@google.com>; Michael Jones
> > <mbj@microsoft.com>; John Bradley <ve7jtb@ve7jtb.com>; 崎村夏彦 <n-
> > sakimura@nri.co.jp>; Thai Duong <thaidn@google.com>; jose@ietf.org
> > Subject: Re: [jose] High risk vulnerability in RFC 7515
> >
> > 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.
> >
> > _______________________________________________
> > jose mailing list
> > jose@ietf.org
> > https://www.ietf.org/mailman/listinfo/jose
>
>