Re: [TLS] Malformed Finished handling

Eric Rescorla <ekr@rtfm.com> Wed, 04 July 2018 16:54 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 8BF2913103B for <tls@ietfa.amsl.com>; Wed, 4 Jul 2018 09:54:55 -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 5qoDoUWAg6_d for <tls@ietfa.amsl.com>; Wed, 4 Jul 2018 09:54:52 -0700 (PDT)
Received: from mail-yw0-x230.google.com (mail-yw0-x230.google.com [IPv6:2607:f8b0:4002:c05::230]) (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 0EAA0130E80 for <tls@ietf.org>; Wed, 4 Jul 2018 09:54:52 -0700 (PDT)
Received: by mail-yw0-x230.google.com with SMTP id l189-v6so2111821ywb.10 for <tls@ietf.org>; Wed, 04 Jul 2018 09:54:52 -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=pGYUSLesNrK7b4Jp/esbq1zYE8YzoDetPAqf0HcBxDs=; b=FlzjYIf+zbWOYFh5x/qMGCJHTFuMlyEXaX+zFCek9A8bEmyob/UBrIJHixSBGbzn3Z mdKQhTZjynA0m6Eifu8ugsDignPegfqPjKzIdvOEwz4ibee2T28ida4ALnePqzESZJbN BFhXsiEsKICE/V28v5riKglGauVack1pIfIn6kMLDKsLxx0JT7PghWi2ehzlIQCLTT6v tYKJhyhdltMSfrSXcwgeTKP8qMrYGGQxYfhklhPBFOAqXP1DLGpUFmAPsV2jfG8OAZTE cnsqQIPqMilvLKOrOakjJ14C2m9GXfCb56Gt9WPSYsVSsJnHOXMY/u03lJxhATew4e3/ 5OXA==
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=pGYUSLesNrK7b4Jp/esbq1zYE8YzoDetPAqf0HcBxDs=; b=tBDyGgILvYqgGTsCvbC0dngdcBqqFzEgkIqung2+uP8NAnt7pJN5U2+2urEo6hR/5S jH/7jxbCqcEhR0GQnv+RNkQMvO0rMiEQdJAOUCEpSOpNrIda9pV6HoyAVzkcm8rbUl1v suhN0VB5CbTm3OTGL4n5IWdIjylUP7yWaoE5Nz6gZ/OoiQgtjQBNC+fy3drlWk7P38VK F+x4BLb3jQstvOnr6Sj3NHWROX3Jj17XZTQobaJEyDQ8TbcVQ1vqi91jfag/odwr4a6C 99A29BBSf7i9JTFUEqdv+5ylsIFgfiqwn1Ike8MHhMipXvY3NOSOjch4voMTIbuA3KDp EbBg==
X-Gm-Message-State: APt69E05dQ/Nbt/wkC7X/d2XL05/REOEYH1VcELgunYHBSar8hMtgi9G f7Nd+QXtDjbLI5RtZtoDDXzX43JqZ+LiatfYFm9XN2G2
X-Google-Smtp-Source: AAOMgpdlZrLzZERHdZysrU48PgBnnjuWY6WqjiPwLoboJl+7FwusH2gihO9XOXh9v7AwSQoWuX05SMyShQKGFql14wE=
X-Received: by 2002:a0d:f286:: with SMTP id b128-v6mr1275546ywf.489.1530723291313; Wed, 04 Jul 2018 09:54:51 -0700 (PDT)
MIME-Version: 1.0
Received: by 2002:a81:6b83:0:0:0:0:0 with HTTP; Wed, 4 Jul 2018 09:54:10 -0700 (PDT)
In-Reply-To: <10346670.25GZR1XrEq@pintsize.usersys.redhat.com>
References: <2069745.MLjj786GGa@pintsize.usersys.redhat.com> <CABcZeBOFTKBUbCTGT-cLpqyfK9J2zre4EFmFz-9b8S-nQhJ=cg@mail.gmail.com> <10346670.25GZR1XrEq@pintsize.usersys.redhat.com>
From: Eric Rescorla <ekr@rtfm.com>
Date: Wed, 04 Jul 2018 09:54:10 -0700
Message-ID: <CABcZeBOAamJ-agBeKObjVEM9w-MUV1nYtDctBc1iexmGta+gDg@mail.gmail.com>
To: Hubert Kario <hkario@redhat.com>
Cc: "<tls@ietf.org>" <tls@ietf.org>
Content-Type: multipart/alternative; boundary="00000000000007507405702f4a80"
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/81bLIUIWPnKg6jyOf9i4u3JJNLQ>
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 16:55:09 -0000

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

> On Wednesday, 4 July 2018 15:00:18 CEST Eric Rescorla wrote:
> > I think it's a close call, because the length is sort of external to the
> > language.
>
> which language? the decode_error alert description literally says "length
> of
> the message was incorrect."
>

The protocol definition language.

-Ekr


> > 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.
>
> but the text is explicit, if a message continues past message boundary,
> the
> correct response is decode_error. Decode_error is also consistent with the
> way
> above-expected length Client Hello MUST be handled.
>
> Just because the description of the message uses a single opaque array
> doesn't
> make this message syntactically any different from other Handshake
> protocol
> message.
>
> if the interpretation of "I know this _message_ _length_ is wrong because
> of
> some other values I negotiated before, so I'll send illegal_parameter" was
> correct, then overflow_error, decrypt_error and probably few others would
> also
> need to be replaced with illegal_parameter...
>
> > -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
>
>
> --
> 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
>