Re: [TLS] Malformed Finished handling

Eric Rescorla <ekr@rtfm.com> Wed, 04 July 2018 13:01 UTC

Return-Path: <ekr@rtfm.com>
X-Original-To: tls@ietfa.amsl.com
Delivered-To: tls@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 4912A130E6E for <tls@ietfa.amsl.com>; Wed, 4 Jul 2018 06:01:02 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.907
X-Spam-Level:
X-Spam-Status: No, score=-1.907 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, NORMAL_HTTP_TO_IP=0.001, RCVD_IN_DNSWL_NONE=-0.0001, T_DKIMWL_WL_MED=-0.01, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=rtfm-com.20150623.gappssmtp.com
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 tlKhmYVx8UV3 for <tls@ietfa.amsl.com>; Wed, 4 Jul 2018 06:01:00 -0700 (PDT)
Received: from mail-yw0-x22c.google.com (mail-yw0-x22c.google.com [IPv6:2607:f8b0:4002:c05::22c]) (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 D3E05127332 for <tls@ietf.org>; Wed, 4 Jul 2018 06:00:59 -0700 (PDT)
Received: by mail-yw0-x22c.google.com with SMTP id l189-v6so1897178ywb.10 for <tls@ietf.org>; Wed, 04 Jul 2018 06:00:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rtfm-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=/RRTedCLRAlo5VdsVuHKpR3VAQaZLOOaTaa8P7J21IE=; b=CFCchHKT1wOdz8+hhUQk2thi5LW/0+VvpDGbk9aZ7BefKitT/W13HBrh4WG6pQ+GIW VEjrTh+WISRBhAExZxtZuiDALZ9JaHKH39+L57x6ftNKZPURcIMeZzZCxm4c6/Fg5Qnd M90dylDypZ75DD8KJkyi0eFPD4mBG0Wk6h1j6mhvIaM/JP6uulCK91fqYzaHE9vWqccE FdYHKMPAOYdxgbDdRZKJyGGdZlt32+rgegFZaeqIV6zbRqoTDEUlHxF47KFFwG0+lPuj pLtYoHPh9ZflX6EYht7n/ITLl3ToamXHq1ravudmqSZhXsmNEZj14BfAEgiGqiVg4Gaw 61sQ==
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=/RRTedCLRAlo5VdsVuHKpR3VAQaZLOOaTaa8P7J21IE=; b=ekM/XOGNVYkQ6tWHD30qLZbqxlWz8qQQ2fYzIUdia4puuETnWMSJXceyp5Lv9+M2g4 IxvthzowwO5/YZNutaA6zzUZCk53FnVrShfqqMwhejI115Fer5q8KrERHp4ORhDJpy/x Noum9AFsqY9PBSzg9oOuGjEEHft5UKNe01n63pmGTODXzrhKjtL2QKx1Z69UAqeVAKA5 fRnIni1WOpxVl2SYuRjmdGPo49hh8rKRe29pmg3kWy/MK2zyAqlSaLj2QlhPCR1raSk0 vTALtFKSj3wzYpwmaVPLCBPDZOZ5mF10sk3ap21uBSU0UO4uRRqSkCbWV17HUghvJreB vbYw==
X-Gm-Message-State: APt69E3K3fprrZU4A7DkuBqRbemAUmKyStilzRRzC9DUHwkAfQ7JpzNB iaQK8cDbEAzrDi+SiixlhYLKP1ofut3n6dP/KzexUg==
X-Google-Smtp-Source: AAOMgpcOdNJdrXP8bjtTYgz70grk6cnEC2q5FWyAic0c0Y2HaKJjDr06Qxn6k517vhEZoyQ3LqaEUO7XJjlMXe9lK6k=
X-Received: by 2002:a0d:f286:: with SMTP id b128-v6mr817987ywf.489.1530709259125; Wed, 04 Jul 2018 06:00:59 -0700 (PDT)
MIME-Version: 1.0
Received: by 2002:a81:6b83:0:0:0:0:0 with HTTP; Wed, 4 Jul 2018 06:00:18 -0700 (PDT)
In-Reply-To: <2069745.MLjj786GGa@pintsize.usersys.redhat.com>
References: <2069745.MLjj786GGa@pintsize.usersys.redhat.com>
From: Eric Rescorla <ekr@rtfm.com>
Date: Wed, 04 Jul 2018 06:00:18 -0700
Message-ID: <CABcZeBOFTKBUbCTGT-cLpqyfK9J2zre4EFmFz-9b8S-nQhJ=cg@mail.gmail.com>
To: Hubert Kario <hkario@redhat.com>
Cc: "<tls@ietf.org>" <tls@ietf.org>
Content-Type: multipart/alternative; boundary="000000000000a51d3505702c051c"
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/JCoPWu_Dv4ea6E-khWF--EY4hj8>
Subject: Re: [TLS] Malformed Finished handling
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.26
Precedence: list
List-Id: "This is the mailing list for the Transport Layer Security working group of the IETF." <tls.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/tls>, <mailto:tls-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/tls/>
List-Post: <mailto:tls@ietf.org>
List-Help: <mailto:tls-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/tls>, <mailto:tls-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Jul 2018 13:01:02 -0000

I think it's a close call, because the length is sort of external to the
language. That's why, for instance, NSS sends "illegal_parameter". So,
absent specific text about this value, I think this is something we can
leave to the implementations.

-Ekr




On Wed, Jul 4, 2018 at 2:54 AM, Hubert Kario <hkario@redhat.com> wrote:

> Despite this, is it correct to terminate a connection with
> "illegal_parameter"
> upon receiving a Finished handshake message with a 100 byte payload? or a
> 20
> byte payload? My opinion is that it is not, "decode_error" is more
> specific so
> it should be used instead.
>
>
> Specification says the following on the matter:
>
> The draft 28 specifies the Finished message as having following structure:
>
>       struct {
>           opaque verify_data[Hash.length];
>       } Finished;
>
> At multiple places it also talks about handling messages that have sizes
> that
> don't match their structure as requiring termination of connection with
> "decode_error".
>
> The generic situation in Section 6:
>
>    Peers which receive a message which
>    cannot be parsed according to the syntax (e.g., have a length
>    extending beyond the message boundary or contain an out-of-range
>    length) MUST terminate the connection with a "decode_error" alert.
>
> as description of the alert in Section 6.2:
>
>    decode_error  A message could not be decoded because some field was
>       out of the specified range or the length of the message was
>       incorrect.  This alert is used for errors where the message does
>       not conform to the formal protocol syntax.
>
> In specific about Client Hello, in Section 4.1.2:
>
>    If negotiating a version of TLS prior to 1.3, a server MUST check
>    that the message either contains no data after
>    legacy_compression_methods or that it contains a valid extensions
>    block with no data following.  If not, then it MUST abort the
>    handshake with a "decode_error" alert.
>
> And specific handling of Certificate from server in Section 4.4.2.4:
>
>    If the server supplies an empty Certificate message, the client MUST
>    abort the handshake with a "decode_error" alert.
>
> Description of "illegal_parameter" in Section 6:
>
>    Peers which receive a message which is syntactically correct but
>    semantically invalid (e.g., a DHE share of p - 1, or an invalid enum)
>    MUST terminate the connection with an "illegal_parameter" alert.
>
> Alert description in Section 6.2:
>
>    illegal_parameter  A field in the handshake was incorrect or
>       inconsistent with other fields.  This alert is used for errors
>       which conform to the formal protocol syntax but are otherwise
>       incorrect.
>
> (it's also mentioned in over a dozen places in the draft)
> --
> Regards,
> Hubert Kario
> Senior Quality Engineer, QE BaseOS Security team
> Web: www.cz.redhat.com
> Red Hat Czech s.r.o., Purkyňova 115, 612 00  Brno, Czech Republic
> _______________________________________________
> TLS mailing list
> TLS@ietf.org
> https://www.ietf.org/mailman/listinfo/tls
>
>