Re: [websec] Question regarding RFC 6797: What is the proper reading of §8.3 #5

Eric Mill <eric.mill@gsa.gov> Thu, 01 March 2018 17:45 UTC

Return-Path: <eric.mill@gsa.gov>
X-Original-To: websec@ietfa.amsl.com
Delivered-To: websec@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 7238112EBDC for <websec@ietfa.amsl.com>; Thu, 1 Mar 2018 09:45:22 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.998
X-Spam-Level:
X-Spam-Status: No, score=-1.998 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DC_PNG_UNO_LARGO=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=gsa.gov
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 Q2TgLxIqD9tD for <websec@ietfa.amsl.com>; Thu, 1 Mar 2018 09:45:17 -0800 (PST)
Received: from mail-qt0-x22b.google.com (mail-qt0-x22b.google.com [IPv6:2607:f8b0:400d:c0d::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 4428512EBD4 for <websec@ietf.org>; Thu, 1 Mar 2018 09:45:17 -0800 (PST)
Received: by mail-qt0-x22b.google.com with SMTP id l25so8616971qtj.1 for <websec@ietf.org>; Thu, 01 Mar 2018 09:45:17 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gsa.gov; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=JS6K0d5yUIQZAvFwvxLF43dUnJWBnPynNAO05GPNxRA=; b=GkH/7oQh+OGNGXHh4kJkkoiEoCcydIQZ7nvErQt/x9NYkb3CxNDUrMcuuhmeqUIkJd Aef8v6XcpyePFuMUojl4NRamN+YPbme0hwWLqnxdDOhfa7dVOw9R/FOaM0kQbT9EX+YL Jy3YvXgaNyLQCXdfwsIyZFPXKAHR7Y6QFyG70=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=JS6K0d5yUIQZAvFwvxLF43dUnJWBnPynNAO05GPNxRA=; b=d7klANVbgEGKUldPUCQoqnNQShsyHIZIQG/onOzGsOlOx2azVT3yX3iRH1OLBDMxuF vGkLa9oYv2swa9pxfZs0DlnmGecm469vsNwWI2U/gwXO8ACNa5/IihC2diQnYEcU7zw5 8X2ZOWTFOFx4MFAn/6nrariCW98xLYJJcNtTh/pfrQptdfI6+xB1csFTHLnDWrnm7XoK LiK9f9LGi3Hro3713tt5WU+XnWN8W4bkmKm2N9v49TTcGNtzZzSimdmrujB7Mq4ZcUFj pNwU74xdhOAGbG6uJHKnzMSjaXVdFHLT1tN7vzf9cSfmOx9d8obAQTgddKT0v0hxsPQg Na8Q==
X-Gm-Message-State: AElRT7G2ynDEcEMaC+MO/wbPloXM/+Fpr6iKk3yRi98fp0ijacTqqVgL ctFt9P5pg4ZUZ4grBbrCIl28jOm2PtIt1MRdhdGfkw==
X-Google-Smtp-Source: AG47ELv6488Q9tAjtIcXMmSamxltlqNUtlnPvNQyr2AyCQAi0LkRC81bHlr6ZHmkIxY2hKobKAf1cnn6eRHqfpkXPwo=
X-Received: by 10.237.48.229 with SMTP id 92mr4129067qtf.39.1519926315271; Thu, 01 Mar 2018 09:45:15 -0800 (PST)
MIME-Version: 1.0
Received: by 10.12.138.82 with HTTP; Thu, 1 Mar 2018 09:44:34 -0800 (PST)
In-Reply-To: <94B62129-BF27-4D73-99A2-D510ED68644E@gmail.com>
References: <84bee28e52764d75a9f15effaea8358e@dnb.de> <94B62129-BF27-4D73-99A2-D510ED68644E@gmail.com>
From: Eric Mill <eric.mill@gsa.gov>
Date: Thu, 01 Mar 2018 12:44:34 -0500
Message-ID: <CAC7uhV82ku+Ro=YCLW7iwOvfU1VE_ix29oKnf7M8dzGNMrK6NQ@mail.gmail.com>
To: Yoav Nir <ynir.ietf@gmail.com>
Cc: "Svensson, Lars" <L.Svensson@dnb.de>, "websec@ietf.org" <websec@ietf.org>
Content-Type: multipart/related; boundary="94eb2c0ca7c41d057205665d6c4f"
Archived-At: <https://mailarchive.ietf.org/arch/msg/websec/89qk4V8n6V--fcw19ztqIstbfOE>
Subject: Re: [websec] Question regarding RFC 6797: What is the proper reading of §8.3 #5
X-BeenThere: websec@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: Web Application Security Minus Authentication and Transport <websec.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/websec>, <mailto:websec-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/websec/>
List-Post: <mailto:websec@ietf.org>
List-Help: <mailto:websec-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/websec>, <mailto:websec-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Mar 2018 17:45:22 -0000

Yoav's diagram is my understanding as well.

On Thu, Mar 1, 2018 at 11:11 AM, Yoav Nir <ynir.ietf@gmail.com> wrote:

> This is how I understand it:
>
>
> On 1 Mar 2018, at 13:59, Svensson, Lars <L.Svensson@dnb.de> wrote:
>
> When implementing HSTS, my colleagues and I had discussions on how to
> correctly interpret §8.3, #5 of RFC 6797 [1]. In our opinion the text is
> ambiguous and we hope that you can help us to clarify what is the proper
> reading of that section. In §8.3 #5 the following is stated:
>
> [[
> If, when performing domain name matching any superdomain match
>       with an asserted includeSubDomains directive is found, or, if no
>       superdomain matches with asserted includeSubDomains directives
>       are found and a congruent match is found (with or without an
>       asserted includeSubDomains directive), then before proceeding
>       with the load:
>
>          The UA MUST replace the URI scheme with "https" [RFC2818], and
>
>          if the URI contains an explicit port component of "80", then
>          the UA MUST convert the port component to be "443", or
>
>          if the URI contains an explicit port component that is not
>          equal to "80", the port component value MUST be preserved;
>          otherwise,
>
>          if the URI does not contain an explicit port component, the UA
>          MUST NOT add one.
>
>          NOTE:  These steps ensure that the HSTS Policy applies to HTTP
>                 over any TCP port of an HSTS Host.
>
>   NOTE:  In the case where an explicit port is provided (and to a
>          lesser extent with subdomains), it is reasonably likely that
>          there is actually an HTTP (i.e., non-secure) server running on
>          the specified port and that an HTTPS request will thus fail
>          (see item 6 in Appendix A ("Design Decision Notes")).
> ]]
>
> The question is how to interpret the "and" and "or" connections between
> the paragraphs. One possibility is to use arithmetic ordering ("and" before
> "or"), another to collect all "or" statements into one expression and then
> apply the "and". In the first case we arrive at:
>
>          The UA MUST replace the URI scheme with "https" [RFC2818], and
>
> (
>          if the URI contains an explicit port component of "80", then
>          the UA MUST convert the port component to be "443", or
>
>          if the URI contains an explicit port component that is not
>          equal to "80", the port component value MUST be preserved;
>          otherwise,
>
>          if the URI does not contain an explicit port component, the UA
>          MUST NOT add one.
> )
>
> That is, the UA _always_ has to replace the URI scheme with https and then
> will continue to handle the port component. In pseudocode this would be:
>
> If( Scheme = "http" ) {
> Replace scheme with "https"
> If ( URI contains explicit port "80" ) {
> Replace port with "443" ;
> } ElseIf( URI contains explicit port ) {
> Keep explicit port ;
> } Else {
> Do not add explicit port ;
> }
> }
>
>
> In the second case the reading would be:
>
> (
>          The UA MUST replace the URI scheme with "https" [RFC2818], and
>
>          if the URI contains an explicit port component of "80", then
>          the UA MUST convert the port component to be "443", or
> )
>
>          if the URI contains an explicit port component that is not
>          equal to "80", the port component value MUST be preserved;
>
> # The otherwise starts a new scope so we repeat the first clause:
>
>          otherwise,
>
> (
>          The UA MUST replace the URI scheme with "https" [RFC2818], and
>
>          if the URI does not contain an explicit port component, the UA
>          MUST NOT add one.
> )
>
> That is, the UA must change the schema to https _only then_ when the port
> is explicitly "80" (and then convert the port to 443) or when there is no
> port.
>
> In pseudocode:
>
> If ( Scheme = "http" ) {
> If ( URI contains no port ) {
> Replace URI scheme with https ;
> } ElseIf ( URI contains port "80" ) {
> Replace URI scheme with "https" ;
> Replace port with "443" ;
> } Else {
> /* don't touch this, do nothing */
> }
>
> }
>
> This way it's possible to run internal http-based services (e. g. behind a
> firewall) on other ports than 80 without having to upgrade those to https.
>
> But if the UA acts like described first, then it will try to upgrade to
> https on any other port but 80, too.
> As a consequence, you then will have to offer all "real" services on other
> port with https - with the exception of a "https-bumper" on 80.
>
> [1] https://tools.ietf.org/html/rfc6797#section-8.3
>
> Thanks for any insight,
>
> Lars
>
>
> *** Lesen. Hören. Wissen. Deutsche Nationalbibliothek ***
> --
> Dr. Lars G. Svensson
> Deutsche Nationalbibliothek
> Informationsinfrastruktur
> Adickesallee 1
> 60322 Frankfurt am Main
> Telefon: +49 69 1525-1752 <+49%2069%2015251752>
> Telefax: +49 69 1525-1799 <+49%2069%2015251799>
> mailto:l.svensson@dnb.de <l.svensson@dnb.de>
> http://www.dnb.de
>
> _______________________________________________
> websec mailing list
> websec@ietf.org
> https://www.ietf.org/mailman/listinfo/websec
>
>
>
> _______________________________________________
> websec mailing list
> websec@ietf.org
> https://www.ietf.org/mailman/listinfo/websec
>
>


-- 
Eric Mill
Senior Advisor, Technology Transformation Services
Federal Acquisition Service, GSA
eric.mill@gsa.gov, +1-617-314-0966