Re: [Json] Security Considerations

Paul Hoffman <paul.hoffman@vpnc.org> Fri, 07 June 2013 15:58 UTC

Return-Path: <paul.hoffman@vpnc.org>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 3FC1D21F9711 for <json@ietfa.amsl.com>; Fri, 7 Jun 2013 08:58:54 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -102.364
X-Spam-Level:
X-Spam-Status: No, score=-102.364 tagged_above=-999 required=5 tests=[AWL=0.235, BAYES_00=-2.599, USER_IN_WHITELIST=-100]
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 kDmV0PwBfqoC for <json@ietfa.amsl.com>; Fri, 7 Jun 2013 08:58:53 -0700 (PDT)
Received: from hoffman.proper.com (IPv6.Hoffman.Proper.COM [IPv6:2605:8e00:100:41::81]) by ietfa.amsl.com (Postfix) with ESMTP id 7A0FE21F91BC for <json@ietf.org>; Fri, 7 Jun 2013 08:58:53 -0700 (PDT)
Received: from [10.20.30.90] (50-0-66-165.dsl.dynamic.sonic.net [50.0.66.165]) (authenticated bits=0) by hoffman.proper.com (8.14.5/8.14.5) with ESMTP id r57FwmjU082261 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 7 Jun 2013 08:58:49 -0700 (MST) (envelope-from paul.hoffman@vpnc.org)
Content-Type: text/plain; charset="us-ascii"
Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\))
From: Paul Hoffman <paul.hoffman@vpnc.org>
In-Reply-To: <51B1885F.3080908@drees.name>
Date: Fri, 07 Jun 2013 08:58:48 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <9D5D948B-BD1E-4195-9B05-3376D6EFFAEA@vpnc.org>
References: <51B0E02E.4070209@crockford.com> <1BD0044B-D7A6-4C7F-899E-5D3E72C62956@vpnc.org> <51B116FE.9050406@crockford.com> <51B1885F.3080908@drees.name>
To: stefan@drees.name
X-Mailer: Apple Mail (2.1508)
Cc: Douglas Crockford <douglas@crockford.com>, "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] Security Considerations
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/json>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 07 Jun 2013 15:58:54 -0000

On Jun 7, 2013, at 12:14 AM, Stefan Drees <stefan@drees.name> wrote:

> On 07.06.13 01:10, Douglas Crockford wrote:
>> On 6/6/2013 4:04 PM, Paul Hoffman wrote:
>>> 
>>> On Jun 6, 2013, at 12:17 PM, Douglas Crockford <douglas@crockford.com>
>>> wrote:
>>> 
>>>> Proposal:
>>>> 
>>>>   With any data format, it is important to encode correctly.  Care must
>>>>   be taken when constructing JSON texts by concatenation.  For example:
>>>> 
>>>>   account = 4627;
>>>>   comment = "\",\"account\":262";   // provided by attacker
>>>>   json_text = "(\"account\":" + account + ",\"comment\":\"" +
>>>> comment + "\"}";
>>> The example is language-specific and, due to the escaping, hard to read.
>> Which specific language would you say it is? Confusion attacks are often
>> hard to read. That is why they work. ...
> 
> I propose to keep the example, but remove the need for quoting by switching to single quotes where needed:
> 
> """
> account = 4627;
> comment = '","account":262';  // provided by attacker
> json_text = '("account":' + account + ',"comment":"' + comment + '"}';
> """
> 
> this is valid (Java|ECMA)Script, right and also much more readable, isn't it?

I can live with this, but I think doing it in English wording is better.

--Paul Hoffman