Re: [jose] Secdir review of draft-ietf-jose-json-web-signature-31

Mike Jones <Michael.Jones@microsoft.com> Sat, 20 September 2014 02:37 UTC

Return-Path: <Michael.Jones@microsoft.com>
X-Original-To: jose@ietfa.amsl.com
Delivered-To: jose@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 5518C1A0072; Fri, 19 Sep 2014 19:37:12 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham
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 ZvOzNtAY3wnZ; Fri, 19 Sep 2014 19:37:07 -0700 (PDT)
Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0126.outbound.protection.outlook.com [65.55.169.126]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 771741A005D; Fri, 19 Sep 2014 19:37:06 -0700 (PDT)
Received: from BN3PR0301CA0002.namprd03.prod.outlook.com (25.160.180.140) by BY1PR0301MB1206.namprd03.prod.outlook.com (25.161.203.155) with Microsoft SMTP Server (TLS) id 15.0.1034.13; Sat, 20 Sep 2014 02:37:04 +0000
Received: from BY2FFO11FD025.protection.gbl (2a01:111:f400:7c0c::153) by BN3PR0301CA0002.outlook.office365.com (2a01:111:e400:4000::12) with Microsoft SMTP Server (TLS) id 15.0.1034.13 via Frontend Transport; Sat, 20 Sep 2014 02:37:03 +0000
Received: from mail.microsoft.com (131.107.125.37) by BY2FFO11FD025.mail.protection.outlook.com (10.1.15.214) with Microsoft SMTP Server (TLS) id 15.0.1029.15 via Frontend Transport; Sat, 20 Sep 2014 02:37:03 +0000
Received: from TK5EX14MBXC286.redmond.corp.microsoft.com ([169.254.1.23]) by TK5EX14MLTC103.redmond.corp.microsoft.com ([157.54.79.174]) with mapi id 14.03.0195.002; Sat, 20 Sep 2014 02:36:33 +0000
From: Mike Jones <Michael.Jones@microsoft.com>
To: John Bradley <ve7jtb@ve7jtb.com>, Jim Schaad <ietf@augustcellars.com>
Thread-Topic: [jose] Secdir review of draft-ietf-jose-json-web-signature-31
Thread-Index: Ac/Ue6/WWdMUgOdf8EqNa4N9Ytbe4Q==
Content-Class: urn:content-classes:message
Date: Sat, 20 Sep 2014 02:36:32 +0000
Message-ID: <4E1F6AAD24975D4BA5B16804296739439BA5C5C0@TK5EX14MBXC286.redmond.corp.microsoft.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Content-Type: multipart/alternative; boundary="_000_4E1F6AAD24975D4BA5B16804296739439BA5C5C0TK5EX14MBXC286r_"
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:(10019020)(438002)(189002)(51444003)(24454002)(199003)(52544003)(377454003)(41574002)(51704005)(92566001)(74662003)(83322001)(92726001)(19617315012)(86612001)(31966008)(86362001)(81542003)(33656002)(6806004)(79102003)(16236675004)(19580405001)(69596002)(81342003)(19580395003)(85852003)(77982003)(80022003)(15975445006)(68736004)(46102003)(107046002)(104016003)(74502003)(26826002)(44976005)(83072002)(85306004)(106466001)(55846006)(84676001)(90102001)(87936001)(50986999)(230783001)(64706001)(20776003)(54356999)(77096002)(512874002)(99396002)(2656002)(95666004)(97736003)(84326002)(71186001)(76482002)(21056001)(85806002)(81156004)(4396001); DIR:OUT; SFP:1102; SCL:1; SRVR:BY1PR0301MB1206; H:mail.microsoft.com; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en;
X-Microsoft-Antispam: UriScan:;
X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1206;
X-O365ENT-EOP-Header: Message processed by - O365_ENT: Allow from ranges (Engineering ONLY)
X-Forefront-PRVS: 0340850FCD
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/jose/FY1Afe0UDRzOwDBuGfd_KxcP5tQ
Cc: "ietf@ietf.org" <ietf@ietf.org>, "secdir@ietf.org" <secdir@ietf.org>, Richard Barnes <rlb@ipv.sx>, Tero Kivinen <kivinen@iki.fi>, IESG <iesg@ietf.org>, "jose@ietf.org" <jose@ietf.org>, "draft-ietf-jose-json-web-signature.all@tools.ietf.org" <draft-ietf-jose-json-web-signature.all@tools.ietf.org>
Subject: Re: [jose] Secdir review of draft-ietf-jose-json-web-signature-31
X-BeenThere: jose@ietf.org
X-Mailman-Version: 2.1.15
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: <http://www.ietf.org/mail-archive/web/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: Sat, 20 Sep 2014 02:37:12 -0000

Your interpretation matches my intent.
________________________________
From: John Bradley<mailto:ve7jtb@ve7jtb.com>
Sent: ‎9/‎19/‎2014 7:17 PM
To: Jim Schaad<mailto:ietf@augustcellars.com>
Cc: Richard Barnes<mailto:rlb@ipv.sx>; Mike Jones<mailto:Michael.Jones@microsoft.com>; ietf@ietf.org<mailto:ietf@ietf.org>; secdir@ietf.org<mailto:secdir@ietf.org>; Tero Kivinen<mailto:kivinen@iki.fi>; IESG<mailto:iesg@ietf.org>; jose@ietf.org<mailto:jose@ietf.org>; draft-ietf-jose-json-web-signature.all@tools.ietf.org<mailto:draft-ietf-jose-json-web-signature.all@tools.ietf.org>
Subject: Re: [jose] Secdir review of draft-ietf-jose-json-web-signature-31

For HMAC changing the  hash from SHA3 256 to SHA2 256 doesn't really get the attacker much as they still don't know the key to be able to create a appropriate fake plaintext.
So simply knowing a value that creates a collision is not sufficient for an attack.

I interpreted Mike's comment on PKCS#1 as being that the signature needs to be verified by the algorithm specified in the "alg" parameter.  That is not to say that if in the case of PKCS#1 padding if the OID is not consistent with the value of "alg" that wouldn't be an error.   I think that would be a invalid JWS.     I do think that should be made clear.

With PSS if the key is the same length it is true that you are going to be vulnerable to collisions over the plaintext based on the weakest hash you can get the receiver to accept.
This is not a issue unique to JOSE in any way.   One would be tempted to rule out SHA1 now but it is differentiated by it's key length, so can't be downgraded to from SHA2.

John B.


On Sep 19, 2014, at 7:25 PM, Jim Schaad <ietf@augustcellars.com<mailto:ietf@augustcellars.com>> wrote:



From: Richard Barnes [mailto:rlb@ipv.sx]
Sent: Friday, September 19, 2014 2:32 PM
To: Mike Jones
Cc: Tero Kivinen; iesg@ietf.org<mailto:iesg@ietf.org>; secdir@ietf.org<mailto:secdir@ietf.org>; ietf@ietf.org<mailto:ietf@ietf.org>; draft-ietf-jose-json-web-signature.all@tools.ietf.org<mailto:draft-ietf-jose-json-web-signature.all@tools.ietf.org>;jose@ietf.org<mailto:jose@ietf.org>
Subject: Re: Secdir review of draft-ietf-jose-json-web-signature-31

"""
# Signature Algorithm Protection
In some usages of JWS, there is a risk of algorithm substitution attacks, in which an attacker can use an existing signature value with a different signature algorithm to make it appear that a signer has signed something that he actually has not.  These attacks have been discussed in detail in the context of CMS {{RFC 6211}}.  The risk arises when all of the following are true:

* Verifiers of a signature support multiple algorithms of different strengths
* Given an existing signature, an attacker can find another payload that produces the same signature value with a weaker algorithm
* In particular, the payload crafted by the attacker is valid in a given application-layer context
For example, suppose a verifier is willing to accept both "PS1" and "PS256" as "alg" values, and a signer creates a signature using "PS256".  If the attacker can craft a payload that has the same SHA-1 digest has as the SHA-256 digest of the legitimate payload, then the "PS1" signature over the bogus payload will be the same as the "PS256" signature over the legitimate payload.

There are several ways for an application using JOSE to mitigate algorithm substitution attacks:
* Don't accept signatures using vulnerable algorithms: Algorithm substitution attacks do not arise for all signature algorithms.
  * Signatures using RSA PKCS#1 v1.5 ("RS1", "RS256", etc.) are not subject to substitution attacks because the signature value itself encodes the hash function used.
  * Signatures with HMAC algorithms ("HS1", "HS256", etc.) cannot be substituted because the signature values have different lengths  Likewise for signatures with ECDSA algorithms ("ES256", "ES384", etc.).

[JLS] This is not a true statement.  If you support both SHA256 and SHA512/256 then the signature values have the same length.  This will also be an issue if you support both the SHA2 and the SHA3 algorithm sets as they have results of the same length.

  * The only algorithms defined in JWA {{I-D.ietf-jose-json-web-algorithms}} that is vulnerable to algorithm substitution attacks is RSA-PSS ("PS1", "PS256", etc.).  An implementation that does not support RSA-PSS is not vulnerable to algorithm substitution attacks.

[JLS] ECDSA is open to this attack if you support both SHA256 and SHA512/256 the hash lengths are the same.  This will also be an issue if you support both the SHA2 and the SHA3 algorithm sets as they have results of the same length.

* Require that the "alg" parameter be carried in the protected header.  (This is the approach taken by RFC 6211.)
* Include a field reflecting the algorithm in the application payload, and require that it be matched with the "alg" parameter during verification (This is the approach taken by PKIX {{RFC5280}}.)

[JLS] RSA-PKCS#1.5 is open to this attack if the suggestion of Mike in a message prior to this is put into the text.  That is to allow for the hash inside of the signature and that outside of the signature to differ in value because you only enforce one of the two values.

Of these mitigations, the only sure solution is the first.  Signing over the "alg" parameter (directly or indirectly) only makes the attacker's work more difficult, by requiring that the bogus payload also contain bogus information about the signing algorithm.  They do not prevent attack by a sufficiently powerful attacker.
"""

On Fri, Sep 19, 2014 at 2:49 PM, Mike Jones <Michael.Jones@microsoft.com<mailto:Michael.Jones@microsoft.com>> wrote:
I would appreciate it if you would write a draft of the proposed security considerations text, Richard.  Perhaps title the section “Unsecured Algorithm Values”.

                                                            Thanks!
                                                            -- Mike

From: Richard Barnes [mailto:rlb@ipv.sx<mailto:rlb@ipv.sx>]
Sent: Wednesday, September 17, 2014 6:24 AM
To: Tero Kivinen
Cc: Mike Jones; iesg@ietf.org<mailto:iesg@ietf.org>; secdir@ietf.org<mailto:secdir@ietf.org>; ietf@ietf.org<mailto:ietf@ietf.org>; draft-ietf-jose-json-web-signature.all@tools.ietf.org<mailto:draft-ietf-jose-json-web-signature.all@tools.ietf.org>;jose@ietf.org<mailto:jose@ietf.org>
Subject: Re: Secdir review of draft-ietf-jose-json-web-signature-31



On Wednesday, September 17, 2014, Tero Kivinen <kivinen@iki.fi<mailto:kivinen@iki.fi>> wrote:
Richard Barnes writes:
>     Perhaps, but is there benefits for leaving the alg without protection?
>
> Simplicity (if you omit protected headers altogether), and
> compatibility with other signed things.  In the sense that you could
> transform one of them into a JWS without re-signing.  This would
> apply, for example, to an X.509 certificate -- just parse the outer
> SEQUENCE, and re-assemble into a JWS with the tbsCertificate as
> payload.  Same security properties that X.509 already has.

Ok, having this kind of information somewhere in the draft would help
to understand the reason. Also having text explaining that is
possible, and that the security properties of this option (i.e. no
problem with PKCS#1, etc... the text you had in the other email).

> It's also completely unnecessary for PKCS#1 signatures, which are
> the dominant use case today.

I agree.

> In general, I'm opposed to protocols baking in more
> application-specific logic than they need to.  The point of JOSE is
> to describe the cryptographic operation that was performed, and
> carry the relevant bits around.  Its job is not to fix all the
> weaknesses that every algorithm has.

Yes, but this property might have security issues, so they should be
covered by the security considerations section.

I'm perfectly happy to have it documented in the Security Considerations.

Mike: Should I generate some text, or do you want to take a stab?

--
kivinen@iki.fi<mailto:kivinen@iki.fi>

_______________________________________________
jose mailing list
jose@ietf.org<mailto:jose@ietf.org>
https://www.ietf.org/mailman/listinfo/jose