Re: [TLS] Sending fatal alerts over TCP

Bodo Moeller <bmoeller@acm.org> Wed, 21 December 2011 19:50 UTC

Return-Path: <SRS0=wbl3=7B=acm.org=bmoeller@srs.kundenserver.de>
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 527B71F0C5C for <tls@ietfa.amsl.com>; Wed, 21 Dec 2011 11:50:45 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -99.066
X-Spam-Level:
X-Spam-Status: No, score=-99.066 tagged_above=-999 required=5 tests=[AWL=-2.440, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, GB_SUMOF=5, HELO_EQ_DE=0.35, HTML_MESSAGE=0.001, 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 b2m2hf8m1m99 for <tls@ietfa.amsl.com>; Wed, 21 Dec 2011 11:50:44 -0800 (PST)
Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.8]) by ietfa.amsl.com (Postfix) with ESMTP id 1D73F1F0C51 for <tls@ietf.org>; Wed, 21 Dec 2011 11:50:43 -0800 (PST)
Received: from mail-qy0-f172.google.com (mail-qy0-f172.google.com [209.85.216.172]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0Lb96v-1Qy1hg2siv-00kFGk; Wed, 21 Dec 2011 20:50:42 +0100
Received: by qcsf15 with SMTP id f15so5660685qcs.31 for <tls@ietf.org>; Wed, 21 Dec 2011 11:50:40 -0800 (PST)
MIME-Version: 1.0
Received: by 10.224.98.8 with SMTP id o8mr9919391qan.79.1324497040678; Wed, 21 Dec 2011 11:50:40 -0800 (PST)
Received: by 10.224.19.196 with HTTP; Wed, 21 Dec 2011 11:50:40 -0800 (PST)
In-Reply-To: <201112211913.pBLJDXBM014049@fs4113.wdf.sap.corp>
References: <CADMpkcKW0BomJCpKNPyjT+G9Ch3zNEOdivX4vryRdC+6N9JGzA@mail.gmail.com> <201112211913.pBLJDXBM014049@fs4113.wdf.sap.corp>
Date: Wed, 21 Dec 2011 20:50:40 +0100
Message-ID: <CADMpkcJ2P+AV4GJuXZRs4c_4f_xkQy2kivsrmqS0pBTmpZPD+g@mail.gmail.com>
From: Bodo Moeller <bmoeller@acm.org>
To: tls@ietf.org
Content-Type: multipart/alternative; boundary="20cf3074d9a69d9d9604b49f7f6c"
X-Provags-ID: V02:K0:gWw5ndvUkqfKgIZUsgQYk/eKHSZgjvDVHkXBPyCIG32 A1wAeBaGaaD/TjWNAj40eIqL0mtZskDET+gfXBd7C4CEc0LvUy SFQhJta1+gqgACLzDAVHjUCLPsL2aUDW10XF+nAm9NYZ9drW/I PumqYwvGX59dDk7Uq8EELeHCSIP/I1JZp6fub6I+JYvpcjzkSq RQ+c/Y/LiK+lTu+vvgWFwzNnfUDtVQjHJ1FCErgIfnEpMhIrk5 kWwFbkdMlFeYcsFFkP07qb2ejdrA1yfs/HNcgdEflHorL6hCZK EkOZ7Kw9zZyDZZYZk1H+j/Xm6kQRZFtQ8apJCAkKmE3kH0yRxY HZNYedVEJC9Satd3+IErkE/u4O8b6j4kdUU36rFhRuEriE2w2e lYcb/GVf0r3LrDDQieKscRqfVbFmMgpFC67eRP3rMQL+hkJefk eXE4q
Subject: Re: [TLS] Sending fatal alerts over TCP
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.12
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: <http://www.ietf.org/mail-archive/web/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, 21 Dec 2011 19:50:47 -0000

On Wed, Dec 21, 2011 at 8:13 PM, Martin Rex <mrex@sap.com> wrote:


> > > > > (1)  X sends a fatal TLS alert to Y
> > > > > (2)  X shuts down the connection
> > > > > (3)  Y sends data to X
> > > > > (4)  X receives from Y, sends RST to signal data loss to Y
> > > > > (5)  Y receives RST
> > > > >
> > > > > (6) At this point, when Y tries to send further data,
> > > > > it will receive EPIPE from the sockets API.
> > > > > When it tries to read data, it will receive ECONNRESET.
>


> > > As long as Y does not call shutdown() on the socket, it will
> > > receive all data that arrived on the socket prior to seeing
> > > End-of-file (X with SO_LINGER) or ECONNRESET (X without SO_LINGER)
> > > on recv().
>


> > That's not right.  Upon receiving RST, Y's TCP will reset the state for
> > this connection and discard any data already buffered; no further data
> can
> > be received by the application (in this case, by the TLS implementation);
> > check RFC 793 for RST processing details.  If X doesn't want that, it
> must
> > not send an RST.
>

Specified processing for X in (CLOSED):
>


>    If the incoming segment has an ACK field, the reset takes its
>    sequence number from the ACK field of the segment, otherwise the
>    reset has sequence number zero and the ACK field is set to the sum
>    of the sequence number and segment length of the incoming segment.
>    The connection remains in the CLOSED state.
>
>
> which means that X must send an RST with a SEQ number of 0!
>

The segment sent by Y in step (3) will have the ACK bit set, so the RST
sent by X in (4) will have the appropriate sequence number that causes Y to
accept the RST in step (5), and thus to discard all data.

(By the way, I think the Linux TCP implementation will send a RST in that
situation if close() has been used to shut down the connection regardless
of SO_LINGER settings.  Stevens doesn't describe that particular TCP
implementation.)

Bodo