Return-Path: <ietf@augustcellars.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 9815821F9E77 for <jose@ietfa.amsl.com>;
 Thu, 27 Jun 2013 10:11:15 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.949
X-Spam-Level: 
X-Spam-Status: No, score=-2.949 tagged_above=-999 required=5 tests=[AWL=0.649,
 BAYES_00=-2.599, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com
 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MKVpAIJYcJ5D for
 <jose@ietfa.amsl.com>; Thu, 27 Jun 2013 10:11:09 -0700 (PDT)
Received: from smtp2.pacifier.net (smtp2.pacifier.net [64.255.237.172]) by
 ietfa.amsl.com (Postfix) with ESMTP id 7E56721F9E75 for <jose@ietf.org>;
 Thu, 27 Jun 2013 10:11:09 -0700 (PDT)
Received: from Philemon (mccpool-66-89.ci.monterey.ca.us [205.155.66.89])
 (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate
 requested) (Authenticated sender: jimsch@nwlink.com) by smtp2.pacifier.net
 (Postfix) with ESMTPSA id DB4D52C9FE; Thu, 27 Jun 2013 10:11:08 -0700 (PDT)
From: "Jim Schaad" <ietf@augustcellars.com>
To: "'Mike Jones'" <Michael.Jones@microsoft.com>,
 "'John Bradley'" <ve7jtb@ve7jtb.com>, "'Tim Bray'" <tbray@textuality.com>
References: <061.bb7bbe0b618ec6b74904f48bdb9bb312@trac.tools.ietf.org>
 <076.a597050ecb4fb25084cec65f7174dc7e@trac.tools.ietf.org>
 <033b01ce729b$26ff5c90$74fe15b0$@augustcellars.com>
 <4E1F6AAD24975D4BA5B16804296739436789B4CC@TK5EX14MBXC283.redmond.corp.microsoft.com>
 <03b401ce72e5$002c65f0$008531d0$@augustcellars.com>
 <4E1F6AAD24975D4BA5B16804296739436789D4EA@TK5EX14MBXC283.redmond.corp.microsoft.com>
 <CAHBU6ivNow2xhDvRj7gG2gmHQ+C-ejEHCQubK=LwUtrXxdW6MA@mail.gmail.com>
 <255B9BB34FB7D647A506DC292726F6E1151BE45737@WSMSG3153V.srv.dir.telstra.com>
 <CAHBU6itHZ4NvGLyRqfDFaC9gkWD1_6dxhY=uVmwpyL+5Ay+j2w@mail.gmail.com>
 <255B9BB34FB7D647A506DC292726F6E1151BEDDD3C@WSMSG3153V.srv.dir.telstra.com>
 <CAHBU6iss5JbmHAue_2-AFDYSMVjAEnMLeLcESei3xTGTWP8_jQ@mail.gmail.com>
 <16F5858A-B77F-498B-9296-A42F84D5244D@ve7jtb.com>
 <4E1F6AAD24975D4BA5B1680429673943678A009C@TK5EX14MBXC283.redmond.corp.microsoft.com>
In-Reply-To: <4E1F6AAD24975D4BA5B1680429673943678A009C@TK5EX14MBXC283.redmond.corp.microsoft.com>
Date: Thu, 27 Jun 2013 10:10:12 -0700
Message-ID: <04ba01ce7359$2f946120$8ebd2360$@augustcellars.com>
MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary="----=_NextPart_000_04BB_01CE731E.8337FA20"
X-Mailer: Microsoft Outlook 14.0
Thread-Index: AQGqOaFgm5bSrTowyJkuz8ggVcVAJQJ0/9dvAtXnsooCfmP1+wE/Pt+eAksevJwBgJ6Q/AKiJ4UHAcTplCQBWG5bvQLZ0+mqAXMi1n4BLTjXupjRzw7Q
Content-Language: en-us
Cc: "'Manger, James H'" <James.H.Manger@team.telstra.com>, jose@ietf.org,
 draft-ietf-jose-json-web-signature@tools.ietf.org
Subject: Re: [jose] #27: member names MUST be unique needs additional text
X-BeenThere: jose@ietf.org
X-Mailman-Version: 2.1.12
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: Thu, 27 Jun 2013 17:11:15 -0000

This is a multipart message in MIME format.

------=_NextPart_000_04BB_01CE731E.8337FA20
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Except for the parsers which only return the nth name (according to the JSON
list they exist) it at least provides a degree of predictability.

 

The JSON list would point out that you want to allow duplicate field names
for the purposes of putting comments into output using the name "//".

 

 

 

From: Mike Jones [mailto:Michael.Jones@microsoft.com] 
Sent: Thursday, June 27, 2013 9:43 AM
To: John Bradley; Tim Bray
Cc: Manger, James H; Jim Schaad; jose@ietf.org;
draft-ietf-jose-json-web-signature@tools.ietf.org
Subject: RE: [jose] #27: member names MUST be unique needs additional text

 

I've come to believe that James' proposed language does a good job of making
security-appropriate restrictions while allowing the use of existing
parsers.  It was:

 

A creator of a JOSE message MUST NOT put duplicate names in any JSON object
in a JOSE header.  To prevent attacks where a JOSE message is interpreted as
different valid messages by different recipients, each recipient MUST either
reject messages with duplicate names or accept only the last name.

 

I might change "or accept only the last name" to "or use a parser that
always uses the lexically last name for any duplicate member names, per
[ECMAScript]" for clarity, but the intent is the same.

 

Would that work for people?

 

                                                            -- Mike

 

From: John Bradley [mailto:ve7jtb@ve7jtb.com] 
Sent: Thursday, June 27, 2013 8:49 AM
To: Tim Bray
Cc: Manger, James H; Mike Jones; Jim Schaad; jose@ietf.org;
draft-ietf-jose-json-web-signature@tools.ietf.org
Subject: Re: [jose] #27: member names MUST be unique needs additional text

 

The problem is not wanting to leave a hole for malicious signers to create
JWT that may be misinterpreted by the receiver.  Accidental interop problems
from bad signers are not a big concern for me and are covered by MUST NOT
emit dups.

 

Accepting malformed JSON as the envelope may lead to real security issues.

 

This may be more of an issue for the JSON encoding than the compact as there
you need to be careful the body you process for the signature is the body
that the application uses.

 

What happens if you receive.

 

{"protected":<integrity-protected shared header contents>",
      "unprotected":<non-integrity-protected shared header contents>",
      "payload":"<original payload contents>",
      "payload":"<bad payload contents inserted by attacker>"
      "signatures":[
       {"header":"<per-signature unprotected header 1 contents>",
        "signature":"<signature 1 contents>"},
       ...
       {"header":"<per-signature unprotected header N contents>",
        "signature":"<signature N contents>"}],
     }

 

If the JOSE library validates on the first version of "payload" and the
application using a different JSON parser only sees the second "payload" we
have a wrapping attack similar to xmldsig.

 

I can't off the top of my head think of what you could do in the compact
serialization that would lead to a successful attack given that the
signature is over the base64url encoded segments, that prevents attackers
from modifying the JSON while maintaining integrity.

 

It is a real issue for the JSON serialization though.

 

John B.

 

On 2013-06-27, at 11:20 AM, Tim Bray <tbray@textuality.com> wrote:

 

The approach just seems wrong.  If we require that conforming
implementations MUST NOT emit dupes, then authors of receiving software can
just pick the best-performing parser with the nicest API, because they *all*
perform correctly when there are no dupes.  

Who's going to own the responsibility for making the authoritative finding
that of the many JSON parsers in the Java ecosystem, these ones, but not
those ones, are usable in JOSE applications?  And suppose one that has been
previously OK is quietly optimized on GitHub to run 30% faster and as a
side-effect silently ignores dupes?  

The benefit of using JSON is that there is widely deployed software to
handle it.  It is a known problem that sloppy spec drafting has allowed
various kinds of problems to occur when dupe keys are received. "Doctor, it
hurts when I do this." "So... don't do that."

Are we also going to specify the behavior of receiving software when the
JSON has a misplaced quotation mark?  A missing trailing "}"?

 -T

 

 

On Wed, Jun 26, 2013 at 11:29 PM, Manger, James H
<James.H.Manger@team.telstra.com> wrote:

Most JSON libraries that silently accept [sob] dupe keys at least
consistently use the last key. Allowing just that behaviour (or rejecting
dupes), while forbidding acceptance of a non-last dupe (eg first key), is
safe and allows most JSON libraries to be used. Since this accepts most
libraries I think it is practical.

 

Hence I suggest:

 

>   A creator of a JOSE message MUST NOT put duplicate names in any JSON

> object in a JOSE header.

>   To prevent attacks where a JOSE message is interpreted as different

> valid messages by different recipients, each recipient MUST either

> reject messages with duplicate names or accept only the last name.

 

This isn't "truly predictable" as a message with dupes might be accepted or
rejected. The crucial point is that if a message is accepted it is
predictable.

 

--

James Manger

 

From: Tim Bray [mailto:tbray@textuality.com] 
Sent: Thursday, 27 June 2013 4:16 PM
To: Manger, James H
Cc: Mike Jones; Jim Schaad; jose@ietf.org;
draft-ietf-jose-json-web-signature@tools.ietf.org


Subject: Re: [jose] #27: member names MUST be unique needs additional text

 

 

Well, you have a practical problem in that most implementers will want to
use a standard JSON library, which is good practice because it will be
well-debugged, and most libraries [sob] silently take care of dupe keys and
don't have a way to tell the client software what happened. So if you want
truly predictable behavior, you're forcing the use of hand-constructed JSON
parsers. And that sucks, because getting good performance in JSON parsing is
surprisingly hard, with dramatic performance differences between
implementations. So you're forcing receiving software which wants to be
conformant to use a hand-rolled parser which will probably have lousy
performance and have other bugs which in fact may compromise security more
than dupe-key tricks could.  -T

 

On Wed, Jun 26, 2013 at 10:39 PM, Manger, James H
<James.H.Manger@team.telstra.com> wrote:

> I think it's a nice clean minimal solution to say that producers MUST
> NOT generate dupes, end of story.  I don't think saying anything beyond
> that adds value. -T

Clean and minimal that may be, but it ignores the security issue. We don't
want a malicious producer (who is so malicious they ignore a MUST) to create
JOSE messages that a JOSE-compliant security layer accepts as "benign
interpretation #1" so it passes the message on to the JOSE-compliant backend
app that acts on "nasty interpretation #2".

--
James Manger

 

 

 


------=_NextPart_000_04BB_01CE731E.8337FA20
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40"><head><META =
HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii"><meta name=3DGenerator content=3D"Microsoft Word 14 =
(filtered medium)"><style><!--
/* Font Definitions */
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
	{font-family:Consolas;
	panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
p
	{mso-style-priority:99;
	mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
pre
	{mso-style-priority:99;
	mso-style-link:"HTML Preformatted Char";
	margin:0in;
	margin-bottom:.0001pt;
	font-size:10.0pt;
	font-family:"Courier New";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
	{mso-style-priority:99;
	mso-style-link:"Balloon Text Char";
	margin:0in;
	margin-bottom:.0001pt;
	font-size:8.0pt;
	font-family:"Tahoma","sans-serif";}
span.HTMLPreformattedChar
	{mso-style-name:"HTML Preformatted Char";
	mso-style-priority:99;
	mso-style-link:"HTML Preformatted";
	font-family:Consolas;}
span.BalloonTextChar
	{mso-style-name:"Balloon Text Char";
	mso-style-priority:99;
	mso-style-link:"Balloon Text";
	font-family:"Tahoma","sans-serif";}
span.EmailStyle22
	{mso-style-type:personal;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
span.EmailStyle23
	{mso-style-type:personal-reply;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]--></head><body lang=3DEN-US link=3Dblue =
vlink=3Dpurple><div class=3DWordSection1><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'>Except for the parsers which only return the nth name (according to =
the JSON list they exist) it at least provides a degree of =
predictability.<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'>The JSON list would point out that you want to allow duplicate field =
names for the purposes of putting comments into output using the name =
&#8220;//&#8221;.<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'><o:p>&nbsp;</o:p></span></p><div =
style=3D'border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in =
4.0pt'><div><div style=3D'border:none;border-top:solid #B5C4DF =
1.0pt;padding:3.0pt 0in 0in 0in'><p class=3DMsoNormal><b><span =
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span>=
</b><span style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"'> =
Mike Jones [mailto:Michael.Jones@microsoft.com] <br><b>Sent:</b> =
Thursday, June 27, 2013 9:43 AM<br><b>To:</b> John Bradley; Tim =
Bray<br><b>Cc:</b> Manger, James H; Jim Schaad; jose@ietf.org; =
draft-ietf-jose-json-web-signature@tools.ietf.org<br><b>Subject:</b> RE: =
[jose] #27: member names MUST be unique needs additional =
text<o:p></o:p></span></p></div></div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'>I&#8217;ve come to believe that James&#8217; proposed language does a =
good job of making security-appropriate restrictions while allowing the =
use of existing parsers.&nbsp; It was:<o:p></o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal =
style=3D'margin-left:.5in'><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'>A creator of a JOSE message MUST NOT put duplicate names in any JSON =
object in a JOSE header.&nbsp; To prevent attacks where a JOSE message =
is interpreted as different valid messages by different recipients, each =
recipient MUST either reject messages with duplicate names or accept =
only the last name.<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'>I might change &#8220;or accept only the last name&#8221; to =
&#8220;or use a parser that always uses the lexically last name for any =
duplicate member names, per [ECMAScript]&#8221; for clarity, but the =
intent is the same.<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'>Would that work for people?<o:p></o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- =
Mike<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'><o:p>&nbsp;</o:p></span></p><div><div =
style=3D'border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in =
0in 0in'><p class=3DMsoNormal><b><span =
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span>=
</b><span style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"'> =
John Bradley [<a =
href=3D"mailto:ve7jtb@ve7jtb.com">mailto:ve7jtb@ve7jtb.com</a>] =
<br><b>Sent:</b> Thursday, June 27, 2013 8:49 AM<br><b>To:</b> Tim =
Bray<br><b>Cc:</b> Manger, James H; Mike Jones; Jim Schaad; <a =
href=3D"mailto:jose@ietf.org">jose@ietf.org</a>; <a =
href=3D"mailto:draft-ietf-jose-json-web-signature@tools.ietf.org">draft-i=
etf-jose-json-web-signature@tools.ietf.org</a><br><b>Subject:</b> Re: =
[jose] #27: member names MUST be unique needs additional =
text<o:p></o:p></span></p></div></div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>The problem =
is not wanting to leave a hole for malicious signers to create JWT that =
may be misinterpreted by the receiver. &nbsp;Accidental interop problems =
from bad signers are not a big concern for me and are covered by MUST =
NOT emit dups.<o:p></o:p></p><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal>Accepting malformed JSON as the envelope may lead to =
real security issues.<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal>This may be more of an issue for the JSON encoding =
than the compact as there you need to be careful the body you process =
for the signature is the body that the application =
uses.<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal>What happens if you =
receive.<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><pre =
style=3D'page-break-before:always'><span =
style=3D'font-size:12.0pt'>{&quot;protected&quot;:&lt;integrity-protected=
 shared header contents&gt;&quot;,<o:p></o:p></span></pre><pre =
style=3D'page-break-before:always'><span =
style=3D'font-size:12.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;unprotected&quot;:&lt;non-integrity-protected shared header =
contents&gt;&quot;,<o:p></o:p></span></pre><pre =
style=3D'page-break-before:always'><span =
style=3D'font-size:12.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;payload&quot;:&quot;&lt;original payload =
contents&gt;&quot;,<o:p></o:p></span></pre><pre =
style=3D'page-break-before:always'><span =
style=3D'font-size:12.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;payload&quot;:&quot;&lt;bad payload contents inserted by =
attacker&gt;&quot;<o:p></o:p></span></pre><pre =
style=3D'page-break-before:always'><span =
style=3D'font-size:12.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;signatures&quot;:[<o:p></o:p></span></pre><pre =
style=3D'page-break-before:always'><span =
style=3D'font-size:12.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
{&quot;header&quot;:&quot;&lt;per-signature unprotected header 1 =
contents&gt;&quot;,<o:p></o:p></span></pre><pre =
style=3D'page-break-before:always'><span =
style=3D'font-size:12.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;signature&quot;:&quot;&lt;signature 1 =
contents&gt;&quot;},<o:p></o:p></span></pre><pre =
style=3D'page-break-before:always'><span =
style=3D'font-size:12.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
...<o:p></o:p></span></pre><pre style=3D'page-break-before:always'><span =
style=3D'font-size:12.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
{&quot;header&quot;:&quot;&lt;per-signature unprotected header N =
contents&gt;&quot;,<o:p></o:p></span></pre><pre =
style=3D'page-break-before:always'><span =
style=3D'font-size:12.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;signature&quot;:&quot;&lt;signature N =
contents&gt;&quot;}],<o:p></o:p></span></pre><pre =
style=3D'page-break-before:always'><span =
style=3D'font-size:12.0pt'>&nbsp;&nbsp;&nbsp;&nbsp; =
}<o:p></o:p></span></pre><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal>If the JOSE library validates on the first version of =
&quot;payload&quot; and the application using a different JSON parser =
only sees the second &quot;payload&quot; we have a wrapping attack =
similar to xmldsig.<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=3DMsoNormal>I =
can't off the top of my head think of what you could do in the compact =
serialization that would lead to a successful attack given that the =
signature is over the base64url encoded segments, that prevents =
attackers from modifying the JSON while maintaining =
integrity.<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal>It is a real issue for the JSON serialization =
though.<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal>John B.<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><div><p =
class=3DMsoNormal>On 2013-06-27, at 11:20 AM, Tim Bray &lt;<a =
href=3D"mailto:tbray@textuality.com">tbray@textuality.com</a>&gt; =
wrote:<o:p></o:p></p></div><p class=3DMsoNormal =
style=3D'margin-bottom:12.0pt'><o:p>&nbsp;</o:p></p><div><div><div><p =
class=3DMsoNormal style=3D'margin-bottom:12.0pt'>The approach just seems =
wrong.&nbsp; If we require that conforming implementations MUST NOT emit =
dupes, then authors of receiving software can just pick the =
best-performing parser with the nicest API, because they *all* perform =
correctly when there are no dupes.&nbsp; <br><br>Who&#8217;s going to =
own the responsibility for making the authoritative finding that of the =
many JSON parsers in the Java ecosystem, these ones, but not those ones, =
are usable in JOSE applications?&nbsp; And suppose one that has been =
previously OK is quietly optimized on GitHub to run 30% faster and as a =
side-effect silently ignores dupes?&nbsp; <o:p></o:p></p></div><p =
class=3DMsoNormal style=3D'margin-bottom:12.0pt'>The benefit of using =
JSON is that there is widely deployed software to handle it.&nbsp; It is =
a known problem that sloppy spec drafting has allowed various kinds of =
problems to occur when dupe keys are received. &#8220;Doctor, it hurts =
when I do this.&#8221; &#8220;So... don&#8217;t do =
that.&#8221;<o:p></o:p></p></div><div><p class=3DMsoNormal =
style=3D'margin-bottom:12.0pt'>Are we also going to specify the behavior =
of receiving software when the JSON has a misplaced quotation =
mark?&nbsp; A missing trailing =
&#8220;}&#8221;?<o:p></o:p></p></div><div><p =
class=3DMsoNormal>&nbsp;-T<o:p></o:p></p></div><div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div></div></div><div><p =
class=3DMsoNormal =
style=3D'margin-bottom:12.0pt'><o:p>&nbsp;</o:p></p><div><p =
class=3DMsoNormal>On Wed, Jun 26, 2013 at 11:29 PM, Manger, James H =
&lt;<a href=3D"mailto:James.H.Manger@team.telstra.com" =
target=3D"_blank">James.H.Manger@team.telstra.com</a>&gt; =
wrote:<o:p></o:p></p><div><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
lang=3DEN-AU =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'>Most JSON libraries that silently accept [sob] dupe keys at least =
consistently use the last key. Allowing just that behaviour (or =
rejecting dupes), while forbidding acceptance of a non-last dupe (eg =
first key), is safe and allows most JSON libraries to be used. Since =
this accepts most libraries I think it is practical.</span><span =
lang=3DEN-AU><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
lang=3DEN-AU =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'>&nbsp;</span><span lang=3DEN-AU><o:p></o:p></span></p><p =
class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
lang=3DEN-AU =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'>Hence I suggest:</span><span =
lang=3DEN-AU><o:p></o:p></span></p><div><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
lang=3DEN-AU =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'>&nbsp;</span><span lang=3DEN-AU><o:p></o:p></span></p><p><span =
lang=3DEN-AU>&gt; &nbsp;&nbsp;A creator of a JOSE message MUST NOT put =
duplicate names in any JSON<o:p></o:p></span></p><p><span =
lang=3DEN-AU>&gt; object in a JOSE header.<o:p></o:p></span></p><p><span =
lang=3DEN-AU>&gt; &nbsp;&nbsp;To prevent attacks where a JOSE message is =
interpreted as different<o:p></o:p></span></p><p><span lang=3DEN-AU>&gt; =
valid messages by different recipients, each recipient MUST =
either<o:p></o:p></span></p><p><span lang=3DEN-AU>&gt; reject messages =
with duplicate names or accept only the last =
name.<o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
lang=3DEN-AU =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'>&nbsp;</span><span lang=3DEN-AU><o:p></o:p></span></p></div><p =
class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
lang=3DEN-AU =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'>This isn&#8217;t &#8220;truly predictable&#8221; as a message with =
dupes might be accepted or rejected. The crucial point is that if a =
message is accepted it is predictable.</span><span =
lang=3DEN-AU><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
lang=3DEN-AU =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'>&nbsp;</span><span lang=3DEN-AU><o:p></o:p></span></p><p =
class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
lang=3DEN-AU =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'>--</span><span lang=3DEN-AU><o:p></o:p></span></p><p =
class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
lang=3DEN-AU =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'>James Manger</span><span lang=3DEN-AU><o:p></o:p></span></p><p =
class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
lang=3DEN-AU =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'>&nbsp;</span><span lang=3DEN-AU><o:p></o:p></span></p><div =
style=3D'border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in =
4.0pt'><div><div style=3D'border:none;border-top:solid #B5C4DF =
1.0pt;padding:3.0pt 0in 0in 0in'><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span =
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span>=
</b><span style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"'> =
Tim Bray [mailto:<a href=3D"mailto:tbray@textuality.com" =
target=3D"_blank">tbray@textuality.com</a>] <br><b>Sent:</b> Thursday, =
27 June 2013 4:16 PM<br><b>To:</b> Manger, James H<br><b>Cc:</b> Mike =
Jones; Jim Schaad; <a href=3D"mailto:jose@ietf.org" =
target=3D"_blank">jose@ietf.org</a>; <a =
href=3D"mailto:draft-ietf-jose-json-web-signature@tools.ietf.org" =
target=3D"_blank">draft-ietf-jose-json-web-signature@tools.ietf.org</a></=
span><span lang=3DEN-AU><o:p></o:p></span></p><div><p =
class=3DMsoNormal><span lang=3DEN-AU><br><b>Subject:</b> Re: [jose] #27: =
member names MUST be unique needs additional =
text<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-AU><o:p>&nbsp;</o:p></span></p></div></div></div><p =
class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
lang=3DEN-AU>&nbsp;<o:p></o:p></span></p><div><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
lang=3DEN-AU>Well, you have a practical problem in that most =
implementers will want to use a standard JSON library, which is good =
practice because it will be well-debugged, and most libraries [sob] =
silently take care of dupe keys and don&#8217;t have a way to tell the =
client software what happened. So if you want truly predictable =
behavior, you&#8217;re forcing the use of hand-constructed JSON parsers. =
And that sucks, because getting good performance in JSON parsing is =
surprisingly hard, with dramatic performance differences between =
implementations. So you&#8217;re forcing receiving software which wants =
to be conformant to use a hand-rolled parser which will probably have =
lousy performance and have other bugs which in fact may compromise =
security more than dupe-key tricks could.&nbsp; =
-T<o:p></o:p></span></p></div><div><div><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;margin-bottom:12.0pt'><span =
lang=3DEN-AU>&nbsp;<o:p></o:p></span></p><div><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
lang=3DEN-AU>On Wed, Jun 26, 2013 at 10:39 PM, Manger, James H &lt;<a =
href=3D"mailto:James.H.Manger@team.telstra.com" =
target=3D"_blank">James.H.Manger@team.telstra.com</a>&gt; =
wrote:<o:p></o:p></span></p><div><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;margin-bottom:12.0pt'><span =
lang=3DEN-AU>&gt; I think it&#8217;s a nice clean minimal solution to =
say that producers MUST<br>&gt; NOT generate dupes, end of story.&nbsp; =
I don&#8217;t think saying anything beyond<br>&gt; that adds value. =
-T<o:p></o:p></span></p></div><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
lang=3DEN-AU>Clean and minimal that may be, but it ignores the security =
issue. We don't want a malicious producer (who is so malicious they =
ignore a MUST) to create JOSE messages that a JOSE-compliant security =
layer accepts as &quot;benign interpretation #1&quot; so it passes the =
message on to the JOSE-compliant backend app that acts on &quot;nasty =
interpretation #2&quot;.<br><br>--<br>James =
Manger<o:p></o:p></span></p></div><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span =
lang=3DEN-AU>&nbsp;<o:p></o:p></span></p></div></div></div></div></div><p=
 class=3DMsoNormal><o:p>&nbsp;</o:p></p></div></div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div></div></div></body></html>
------=_NextPart_000_04BB_01CE731E.8337FA20--

