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

John Bradley <> Mon, 22 September 2014 00:59 UTC

Return-Path: <>
Received: from localhost ( []) by (Postfix) with ESMTP id 7D36C1A0396 for <>; Sun, 21 Sep 2014 17:59:36 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -2.6
X-Spam-Status: No, score=-2.6 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=unavailable
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id 6KsNapobP3ek for <>; Sun, 21 Sep 2014 17:59:33 -0700 (PDT)
Received: from ( []) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by (Postfix) with ESMTPS id A5A211A03A6 for <>; Sun, 21 Sep 2014 17:59:25 -0700 (PDT)
Received: by with SMTP id 9so1011372ykp.25 for <>; Sun, 21 Sep 2014 17:59:24 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20130820; h=x-gm-message-state:content-type:mime-version:subject:from :in-reply-to:date:cc:message-id:references:to; bh=NesEmMU5YE22Dif4PE/3+nXQdxKfYdQCdrAtm7o+fEM=; b=I+UeDNttR7h401L89v9XOF1JJaq7RVMsnSyoZljHNTSubIGeqjRJczCI3Z3pYkdTYU rTkBr/ebeBUM6RR1IE49F6jJzVfnLb3Ak84YyP1M3PUeXucYXoZevifbSq0tN7YQ+W0g rGO4kWym4Hkqpk0AkrsXZdNRvLL1WsQ/MKVGaOQAP5FPMYzQ1a9WOemIwHYrLbZda48U UbiPQ/aqI2G8DCKmzgXzG2uGRugwDwYdFolg4xihNfHL+JBlJG64mCJQjz7U1sYjHrU5 SZP2OVXriJWvGXs+Mx/4gIFBrkYajsOrViQu6gMWCToF8gMvAVC1llwwlABiWcBukzOK nkbA==
X-Gm-Message-State: ALoCoQlMHfuqFCSy1aGV4ukfX2Zzv+0QZT+wvsMM5Jz2xHw+bGr9BUKdw4UK0IHpXmhP7Up1u+bH
X-Received: by with SMTP id o27mr22344246yhn.29.1411347564747; Sun, 21 Sep 2014 17:59:24 -0700 (PDT)
Received: from [] ( []) by with ESMTPSA id f26sm3786682yhg.10.2014. for <multiple recipients> (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 21 Sep 2014 17:59:23 -0700 (PDT)
Content-Type: multipart/signed; boundary="Apple-Mail=_6D80B17A-A2DF-4059-A04B-5728419D2A5B"; protocol="application/pkcs7-signature"; micalg="sha1"
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\))
From: John Bradley <>
In-Reply-To: <>
Date: Sun, 21 Sep 2014 20:59:22 -0400
Message-Id: <>
References: <> <> <> <> <> <> <> <> <> <03a601cfd460$f8d71d70$ea855850$> <> <03c701cfd483$d1cf45e0$756dd1a0$> <> <043a01cfd4f2$3df75ff0$b9e61fd0$> <> <> <>
To: Richard Barnes <>
X-Mailer: Apple Mail (2.1878.6)
Cc: "" <>, secdir <>, Jim Schaad <>, Tero Kivinen <>, Michael Jones <>, IESG <>, "" <>, "" <>
Subject: Re: [jose] Secdir review of draft-ietf-jose-json-web-signature-31
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Javascript Object Signing and Encryption <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Mon, 22 Sep 2014 00:59:36 -0000

Also with PSS the attack is largely mitigated if the mask function uses the same hash as the message.

JWA sec 3.5  requires SHA2 MGF functions for SHA2 message hashes with the equivalent length.

If the same is done when SHA3 is added then I think PSS is not as susceptible to a substitution attack as it might look on the surface.

Sorry I just remembers that there was that mitigation for PSS.

John B.
On Sep 21, 2014, at 8:47 PM, John Bradley <> wrote:

> I like the general direction.
> One question,  wouldn't the recipient of a PSS signature detect the substitution of SHA-284 with SHA-256 due to the different key length.
> I was under the perhaps mistaken impression that the key lengths needed to be the same and just the alg different eg SHA3 and SHA2 keys of the same length.
> If that is the case we probably have not defined any algs currently that may be subject to this.  That is not to say that we shouldn't warn people as new algs are defined.
> John B.
> On Sep 21, 2014, at 8:32 PM, Richard Barnes <> wrote:
>> I think I may have erred by trying to write a treatise on which algorithms are vulnerable :)  Here's some updated text, trying to be more concise.
>> Jim: Your points about SHA-256 vs. SHA-512/256 and SHA-256 vs. SHA-3 don't really apply, since JOSE hasn't defined algorithm identifiers for SHA-512/256 or SHA-3.
>> """
>> # 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 "PS256" and "PS384" as "alg" values, and a signer creates a signature using "PS256".  If the attacker can craft a payload that results in the same signature with SHA-256 as the signature with SHA-384 of the legitimate payload, then the "PS256" signature over the bogus payload will be the same as the "PS384" signature over the legitimate payload.
>> There are several ways for an application using JOSE to mitigate algorithm substitution attacks
>> The simplest mitigation is to not accept signatures using vulnerable algorithms: Algorithm substitution attacks do not arise for all signature algorithms.  The only algorithms defined in JWA {{I-D.ietf-jose-json-web-algorithms}} that may be vulnerable to algorithm substitution attacks is RSA-PSS ("PS256", etc.).  An implementation that does not support RSA-PSS is not vulnerable to algorithm substitution attacks.  (Obviously, if other algorithms are added, then they may introduce new risks.)  
>> In addition, substitution attacks are only feasible if an attacker can compute pre-images for the weakest hash function accepted by the recipient.  All JOSE algorithms use SHA-2 hashes, for which there are no known pre-image attacks as of this writing.  Until there begin to be attacks against SHA-2 hashes, even a JOSE implementation that supports PSS is safe from substitution attacks.
>> Without restricting algorithms, there are also mitigations at the JOSE and application layer: At the level of JOSE, an application could require that the "alg" parameter be carried in the protected header.  (This is the approach taken by RFC 6211.)  The application could also 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}}.)
>> Of these mitigations, the only sure solution is the first, not to accept vulnerable algorithms.  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.
>> """