Re: [secdir] Security review of draft-ietf-netmod-yang-json-08

"Hilarie Orman" <hilarie@purplestreak.com> Thu, 17 March 2016 22:39 UTC

Return-Path: <hilarie@purplestreak.com>
X-Original-To: secdir@ietfa.amsl.com
Delivered-To: secdir@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 903A612DD72; Thu, 17 Mar 2016 15:39:42 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.62
X-Spam-Level:
X-Spam-Status: No, score=-2.62 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=ham autolearn_force=no
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 EjHtnIuBZrWa; Thu, 17 Mar 2016 15:39:36 -0700 (PDT)
Received: from out01.mta.xmission.com (out01.mta.xmission.com [166.70.13.231]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2E74F12DD61; Thu, 17 Mar 2016 15:39:36 -0700 (PDT)
Received: from in02.mta.xmission.com ([166.70.13.52]) by out01.mta.xmission.com with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from <hilarie@purplestreak.com>) id 1aggZr-0005Ud-0C; Thu, 17 Mar 2016 16:39:35 -0600
Received: from [72.250.219.84] (helo=rumpleteazer.rhmr.com) by in02.mta.xmission.com with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from <hilarie@purplestreak.com>) id 1aggZm-0003Gp-Am; Thu, 17 Mar 2016 16:39:34 -0600
Received: from rumpleteazer.rhmr.com (localhost [127.0.0.1]) by rumpleteazer.rhmr.com (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id u2HMdGkR018877; Thu, 17 Mar 2016 16:39:16 -0600
Received: (from hilarie@localhost) by rumpleteazer.rhmr.com (8.14.4/8.14.4/Submit) id u2HMdFff018872; Thu, 17 Mar 2016 16:39:15 -0600
Date: Thu, 17 Mar 2016 16:39:15 -0600
Message-Id: <201603172239.u2HMdFff018872@rumpleteazer.rhmr.com>
From: Hilarie Orman <hilarie@purplestreak.com>
To: stephen.farrell@cs.tcd.ie
In-reply-to: Yourmessage <56EABFA7.6050506@cs.tcd.ie>
X-XM-AID: U2FsdGVkX19N05aqfimG6D4OzDnIW+Iz
X-SA-Exim-Connect-IP: 72.250.219.84
X-SA-Exim-Mail-From: hilarie@purplestreak.com
X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1
X-Spam-Combo: ****;stephen.farrell@cs.tcd.ie
X-Spam-Relay-Country:
X-Spam-Timing: total 4205 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 3.7 (0.1%), b_tie_ro: 2.7 (0.1%), parse: 0.80 (0.0%), extract_message_metadata: 21 (0.5%), get_uri_detail_list: 4.4 (0.1%), tests_pri_-1000: 6 (0.1%), tests_pri_-950: 1.24 (0.0%), tests_pri_-900: 1.03 (0.0%), tests_pri_-400: 34 (0.8%), check_bayes: 33 (0.8%), b_tokenize: 10 (0.2%), b_tok_get_all: 12 (0.3%), b_comp_prob: 4.0 (0.1%), b_tok_touch_all: 4.1 (0.1%), b_finish: 0.58 (0.0%), tests_pri_0: 869 (20.7%), check_dkim_signature: 0.55 (0.0%), check_dkim_adsp: 174 (4.1%), tests_pri_500: 3266 (77.7%), poll_dns_idle: 3256 (77.4%), rewrite_mail: 0.00 (0.0%)
X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600)
X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com)
Archived-At: <http://mailarchive.ietf.org/arch/msg/secdir/jBKZzQUEhCsTZ-Zhqqm2rhUakJ4>
Cc: lhotka@nic.cz, draft-ietf-netmod-yang-json.all@tools.ietf.org, iesg@ietf.org, secdir@ietf.org
Subject: Re: [secdir] Security review of draft-ietf-netmod-yang-json-08
X-BeenThere: secdir@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
Reply-To: Hilarie Orman <hilarie@purplestreak.com>
List-Id: Security Area Directorate <secdir.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/secdir>, <mailto:secdir-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/secdir/>
List-Post: <mailto:secdir@ietf.org>
List-Help: <mailto:secdir-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/secdir>, <mailto:secdir-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 17 Mar 2016 22:39:42 -0000

It is difficult to feel that the generic dont-worry response ("knows
what he or she is doing", "almost never", and "pay(s) attention to the
data model", etc.)  is sufficient to address security concerns.  My
review boils down to "surely you can do better", but I do not have the
expertise to write specific text that would improve the situation.

Hilarie

>  From: Stephen Farrell <stephen.farrell@cs.tcd.ie>
>  Date: Thu, 17 Mar 2016 14:31:03 +0000

>  Hi folks,

>  This thread seemed to just trail off.

>  Hilarie, did you want to follow up more or do we think
>  the document is all set?

>  Thanks,
>  S.

>  On 08/03/16 15:31, Ladislav Lhotka wrote:
>  > Hi Hilarie,
>  >=20
>  > thank you for the review, please se my responses inline.
>  >=20
>  > Hilarie Orman <hilarie@purplestreak.com> writes:
>  >=20
>  >>                      Security review of
>  >> JSON Encoding of Data Modeled with YANG draft-ietf-netmod-yang-json-08=

>  >>
>  >> Do not be alarmed.  I have reviewed this document as part of the
>  >> security directorate's ongoing effort to review all IETF documents
>  >> being processed by the IESG.  These comments were written primarily
>  >> for the benefit of the security area directors.  Document editors and
>  >> WG chairs should treat these comments just like any other last call
>  >> comments.
>  >>
>  >> "This document defines encoding rules for representing configuration,
>  >> state data, parameters of RPC operations or actions, and notifications=

>  >> defined using YANG as JavaScript Object Notation (JSON) text.  YANG is=

>  >> a data modeling language originally designed to model configuration
>  >> and state data manipulated by the Network Configuration Protocol
>  >> (NETCONF), NETCONF remote procedure calls, and NETCONF notifications."=

>  >>
>  >> I have no specific recommendation for an action on this, just
>  >> some observations.
>  >>
>  >> I'm not an expert on YANG, JSON, or XML, but I was taken aback to read=

>  >> in section 5.5:
>  >>
>  >>      Anydata data node serves as a container for an arbitrary set of n=
>  odes
>  >>      that otherwise appear as normal YANG-modeled data.  A data model =
>  for
>  >>      anydata content may or may not be known at run time.  In the latt=
>  er
>  >>      case, converting JSON-encoded instances to the XML encoding defin=
>  ed
>  >>      in [I-D.ietf-netmod-rfc6020bis] may be impossible.
>  >=20
>  > An "anydata" node represents data for which no schema is specified in
>  > the data model. The schema for such data may be known at run time, but
>  > the consensus in the NETMOD WG was to keep the possibility that this is=

>  > not the case. And if the schema is not available, translation between
>  > XML and JSON encodings cannot be done because, for example, we use the
>  > data model info for translating namespace identifiers.
>  >=20
>  > As long as we want to keep the option of specifying schema-less data in=

>  > the data model, we have to live with this. I don't think it is really
>  > ominous, also because normal configuration and state data should almost=

>  > never be modelled with "anydata".
>  >=20
>  >>
>  >> That seems ominous, and there are other warnings about the force
>  >> fitting of JSON and XML:
>  >>
>  >>    "JSON processing is rather different from XML, and JSON parsers may=

>  >>    thus suffer from other types of vulnerabilities than their XML
>  >>    counterparts.  To minimize these new security risks, software on th=
>  e
>  >>    receiving side SHOULD reject all messages that do not comply to the=

>  >>    rules of this document and reply with an appropriate error message =
>  to
>  >>    the sender."
>  >=20
>  > Implementors might be tempted to apply the Postel Principle and be
>  > liberal on the receiving side. This paragraph warns against doing so,
>  > unless, of course, the implementor knows what he or she is doing.
>  >=20
>  >>
>  >> The security section refers back to the security considerations in
>  >> https://tools.ietf.org/html/draft-ietf-netmod-rfc6020bis-11
>  >> section 16 (should be 17) where we read:
>  >>
>  >>    "Data modeled in YANG might contain sensitive information.  RPCs or=

>  >>    notifications defined in YANG might transfer sensitive information.=
>  "
>  >>
>  >>    "YANG parsers need to be robust with respect to malformed documents=
>  =2E
>  >>    Reading malformed documents from unknown or untrusted sources could=

>  >>    result in an attacker gaining privileges of the user running the YA=
>  NG
>  >>    parser.  In an extreme situation, the entire machine could be
>  >>    compromised."
>  >>
>  >> There being no succinct description of correctness of YANG, JSON, or
>  >> XML for NETCONF data, how would one determine that any of it,
>  >> including mappings from one to another, was "robust"?  If that simply
>  >=20
>  > In fact, it is one of the most important virtues of data modelling that=

>  > the correctness of configuration or state data can be reliably
>  > verified. In the context of draft-ietf-netmod-yang-json, correctness ha=
>  s
>  > two aspects:
>  >=20
>  > 1. All data is required to be I-JSON compliant [RFC 7493] which helps
>  >    avoid common JSON-specific interoperability and security problems.
>  >=20
>  > 2. The data model precisely specifies the schema, data types of all
>  >    values, and also semantic constraints.
>  >=20
>  > If an implementor pays attention to data model definitions (including
>  > textual descriptions), then I believe the risk of any data-induced
>  > issues is effectively minimised.
>  >=20
>  >> means "doesn't cause a buffer overflow or crash", I suppose it's
>  >> achievable (and should be explicit).  But how could anyone be sure
>  >> that sensitive data was not leaked without a full analysis of the
>  >> specifications of all the component parts?  Perhaps this is an
>  >> unaddressable question, but one does hope that the extreme situation
>  >> does not occur.
>  >>
>  >=20
>  > This question isn't specific to this document - sensitive data may be
>  > present in any encoding. It is also one of the duties of a good data
>  > model to identify such data, and sec. 6 in RFC 6087 puts forward specif=
>  ic
>  > requirements in this direction.
>  >=20
>  > Thanks, Lada