Re: Non-Last Small IPv6 Fragments

Tom Herbert <tom@herbertland.com> Sat, 12 January 2019 00:30 UTC

Return-Path: <tom@herbertland.com>
X-Original-To: ipv6@ietfa.amsl.com
Delivered-To: ipv6@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id C8A0612D4F2 for <ipv6@ietfa.amsl.com>; Fri, 11 Jan 2019 16:30:59 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.041
X-Spam-Level:
X-Spam-Status: No, score=-2.041 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_MED=-0.142, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=herbertland-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 KWRV4dFANwuh for <ipv6@ietfa.amsl.com>; Fri, 11 Jan 2019 16:30:57 -0800 (PST)
Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) (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 D3D93130DC0 for <ipv6@ietf.org>; Fri, 11 Jan 2019 16:30:56 -0800 (PST)
Received: by mail-qk1-x72d.google.com with SMTP id y78so7576590qka.12 for <ipv6@ietf.org>; Fri, 11 Jan 2019 16:30:56 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=herbertland-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=5rRyNYJM4hNVZoN3vX0l9boemepddl4V7Ps/GqcKflY=; b=YBmRz6L5NUOptI29/kRcK5agh4eGhNvux7y4ogqwxXo58T0qr4KKFIdeCciCmYWSSv 6DOXlTeZ0uKBp2bsyog/i4tZA8czzz5DAumINciYGvtZi5jCSrAfruCmPPRXWYwA4s+H FeZhjpFP7VQoOCFHZ1Zq8tMCd/tDKN4+8vWdIvEn0FcmpzQtMaK4MSZmSkHzBKCf0X/N 3XL65UsDyXdj4wcWzbCKZkE3mI/l+iWM8TTk2VRpgOhoRU+RaDu05HZAD5C0J4ct8ECd ON++4hej2fiLJaY4T33lmXcP7fV98K1S4Uowm3z2Yfe1mWRgkNEu6Q9zTWFcDQ1sooMW EZ1A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=5rRyNYJM4hNVZoN3vX0l9boemepddl4V7Ps/GqcKflY=; b=KA/PlyhnU+1M4ylxzQm+DKj10wlaqna6Si4vhNzzulnXmWS6PLoiOF0UH1mJvaef1x TCWC7iuBAKUvcGxpbZ6cYa/3H2ZC4J0UXmcxqbrNqRYpxORLoEg76shjzUnQAqDtEhMT 2LEkK7sE3ebqetAr4T588iRAcuQNwnYbHuGpF0K4KE5dSBIFtOb9Q68vNuU8UAskqCf8 sAUc+NQtXz7X+uyqzVqKo3XzwEXW02YJlGKRtHqVtbCwlnKsfnjl2MeCJHlIRDJw+5ON FvZch6wk6bzbKPMxfJd9HHDCSSCt0ixRBtg1Oa8hZIhW0kd2q2AM1e5cpAhpUAaEr2sC xQ8w==
X-Gm-Message-State: AJcUukdoPqz1x2yhGGG/LRjdtBFdj2sl7HpJ1kGijduAwThvTNRnNj8J T+kUKT7eNXB9Sr4VMmlLGPDMobpc13iFy3AtL8PZ1g==
X-Google-Smtp-Source: ALg8bN6/ZFtZ8t/mw4u0CKARM4+pHK4LXKr68zSD9ungzMi4o71AVYg96YdH14se7WZEl2xKcH4k+RdGBtsm0WSxycM=
X-Received: by 2002:a37:d4d9:: with SMTP id s86mr14981296qks.190.1547253055659; Fri, 11 Jan 2019 16:30:55 -0800 (PST)
MIME-Version: 1.0
References: <CAOSSMjV0Vazum5OKztWhAhJrjLjXc5w5YGxdzHgbzi7YVSk7rg@mail.gmail.com> <2AB3F16C-FC0E-4EF7-B1ED-1A97F2CEC69B@gmail.com> <BYAPR05MB42458F851962F26AE1E15CC4AE840@BYAPR05MB4245.namprd05.prod.outlook.com> <CAAedzxofmhokstWuq7mRWnd5PTz5WQaiDNnE8O_VHXF_PbK6nw@mail.gmail.com> <BYAPR05MB4245388FB800873A5A8ED12AAE840@BYAPR05MB4245.namprd05.prod.outlook.com> <66bf652a-2bc0-6814-6ded-a63eece7fbe2@gmail.com> <BYAPR05MB4245B9305E6EC57EDD45509FAE840@BYAPR05MB4245.namprd05.prod.outlook.com> <7453645f-ff91-e866-b087-e7d4f1450ab6@gmail.com> <0e792b48-4360-6977-9ae8-9cdfdc78c7b8@gmail.com> <16A642DC-D3A4-452C-B7D1-20CA0EEEDDA2@lists.zabbadoz.net> <CAOSSMjWS9po2XuBHJ5hbN9hfNDKZ1diecH08Kt697-15jRtAvg@mail.gmail.com> <0e0c3141-889e-ff60-2787-2889b3a9af6b@si6networks.com> <748DA428-5AB2-4487-A4FB-F2DABF5BF8BE@thehobsons.co.uk> <8b43af81-1c49-5cea-6472-97703674e661@si6networks.com> <CAN-Dau1HwG5RndacpSA+si+zKuTdpSvA=QA1A11A==rMNe=4+w@mail.gmail.com> <CALx6S35KNhV2gFp9OdU+M1zy5WUuEAEvXkDXNDWWxi7uQ4e_cw@mail.gmail.com> <CAN-Dau0rTdiiF2SjByxcMG6nhPCEjUH2pYBCOeK_FSGJ_ucDQw@mail.gmail.com> <CALx6S34AyV9OpvnjQhQc56n5vfeVgU5Zd3kheP0g+XvsMbBV9g@mail.gmail.com> <CAN-Dau1kTNztYhtzQHfRc1U3zE771iKEp_fLo0E6HXFZDHGztQ@mail.gmail.com>
In-Reply-To: <CAN-Dau1kTNztYhtzQHfRc1U3zE771iKEp_fLo0E6HXFZDHGztQ@mail.gmail.com>
From: Tom Herbert <tom@herbertland.com>
Date: Fri, 11 Jan 2019 16:30:44 -0800
Message-ID: <CALx6S37yq+sw3qCbZcAHHW5mB_=j73S95K-erfqiJPrL+ZAVMw@mail.gmail.com>
Subject: Re: Non-Last Small IPv6 Fragments
To: David Farmer <farmer@umn.edu>
Cc: Fernando Gont <fgont@si6networks.com>, IPv6 List <ipv6@ietf.org>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/ipv6/u8-C5vKGmky4C6JNK7iImf9MQ1s>
X-BeenThere: ipv6@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "IPv6 Maintenance Working Group \(6man\)" <ipv6.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ipv6>, <mailto:ipv6-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ipv6/>
List-Post: <mailto:ipv6@ietf.org>
List-Help: <mailto:ipv6-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ipv6>, <mailto:ipv6-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sat, 12 Jan 2019 00:31:00 -0000

On Fri, Jan 11, 2019 at 4:11 PM David Farmer <farmer@umn.edu> wrote:
>
>
> On Fri, Jan 11, 2019 at 4:47 PM Tom Herbert <tom@herbertland.com> wrote:
>>
>> On Fri, Jan 11, 2019 at 2:33 PM David Farmer <farmer@umn.edu> wrote:
>> >
>> >
>> > On Fri, Jan 11, 2019 at 3:27 PM Tom Herbert <tom@herbertland.com> wrote:
>> >>
>> >> On Fri, Jan 11, 2019 at 1:13 PM David Farmer <farmer@umn.edu> wrote:
>> >> >
>> >> > On Fri, Jan 11, 2019 at 1:58 PM Fernando Gont <fgont@si6networks.com> wrote:
>> >> >>
>> >> >> On 11/1/19 15:38, Simon Hobson wrote:
>> >> >> > Fernando Gont <fgont@si6networks.com> wrote:
>> >> >> >
>> >> >> >> ... enforce limits ...
>> >> >> >
>> >> >> > The guidance also needs to suggest sensible limits - otherwise what one implementer (eg the Linux stack that discards any small fragment that isn't the last)
>> >> >>
>> >> >> IMO, this is bad behavior advice. As an attacker, I'd fire 1280-sized
>> >> >> frags, and your check hasn't achieved anything.
>> >> >>
>> >> >>
>> >> >> >may not interoperate with another (eg make the last two fragments approximately equal in size). In a significant part, that seems to
>> >> >> > have been what this thread has been about - what is reasonable
>> >> >> guidance for this.
>> >> >>
>> >> >> In general, what you do is AIMD (additive increase, multiplicative
>> >> >> decrease). The numbers limits are a few thousand packets. Which allow
>> >> >> fragments to work for some cases - few connections, rather low
>> >> >> throughput, but will not allow system breakage when the attacker wants
>> >> >> to play.
>> >> >>
>> >> >> Dropping small frags as in Linux is bad, because you hurt
>> >> >> interoperability without any significant/real gain.
>> >> >>
>> >> >> OTOH, limiting the number of frags is good, because limits kick in at a
>> >> >> point in which "you need to do something, because otherwise - DoS".
>> >> >>
>> >> >> Obviously, you cannot expect big pipes with fragmentation to work. Given
>> >> >> high bandwith, multiply 60s * throughput, and you'll need a lot of
>> >> >> memory to hold the frags.
>> >> >>
>> >> >> Adapting the Frag reassembly time out can also help -- there's not much
>> >> >> of a point to keep a frag in memory for 60s, particularly when under
>> >> >> heavly load. -- well before that TCP timers will fire, or the frag si
>> >> >> not useful anymore, anyway.
>> >> >
>> >> >
>> >> > I just had a thought for the guidance;
>> >> >
>> >> > 1. System-wide limit the number of fragments based on the overall system resources available.
>> >> > 2. As you near said limit, maybe 75% of the limit, drop outright, or at a high probability, non-final fragments smaller than (1280/2) 640 bytes.
>> >> >
>> >> > The reasonable fragmentation algorithms I can think of do not generate non-final fragments that are less than 640 bytes. Nevertheless, such fragments SHOULD NOT be dropped except for when the system is under stress.
>> >> >
>> >> > What do others think?
>> >>
>> >> I don't see any practical purpose of sending tiny fragments with eight
>> >> byte payloads in non-first fragments, these can only happens under DOS
>> >> attack or synthetic testing. So I do believe it's prudent to have some
>> >> guidance on setting limits for minimal sizes of non-first fragments.
>> >> The limit should probably be configurable with some recommended
>> >> default value. I believe the 1280 limit in Linux is too high, but
>> >> there are some compelling arguments for 640.
>> >
>> >
>> > Why non-first fragments? Did you mean non-final? Maybe both first and last should be exempted?
>> >
>> Yes.
>>
>> > I mostly agree with you, but on the other hand is there any compelling reason to potentially break anything if the host isn't under stress?
>>
>> That depends on what resource is "under stress" in the host.
>> Reassembly is an expensive packet processing operation that requires
>> one lookup to find the state for the ID being reassembled, and then a
>> second lookup to find the position of the fragment in the queue.
>> Because fragmentation is considered to be rare, there hasn't been a
>> lot of work to optimize these operations or rely on hardware offload
>> (there is UDP fragmentation offload, but that is not ubiquitous). I
>> would be concerned that a well crafted attack with small packets could
>> be bad for low powered devices. A limit on the fragment size not only
>> caps the amount of memory burned, but also caps the packet rate and
>> hence CPU needed for reassmbly.
>
>
> I'd be fine with adding something like the following;
>
> Destination nodes SHOULD NOT drop non-final fragments shorter than 640 bytes unless they are under stress. However, highly constrained devices, such as devices with minimal memory or CPU, or very low-power devices, could be considered as always under stress, and therefore it might be prudent for such devices to always drop non-final fragments shorter than 640 bytes.
>
> Would that cover your issues?

David,

It make sense from a receiver point of view, but not the transmitter
who wouldn't know that its peer is a such a device. There should be
guidance to senders to the effect that if you want to maximize the
chances your fragments are reassembled then make them at least this
size. From a pragmatic point a view, given that we've identified a
potential DOS attack, I think it's likely that we'll end up setting
the default limit, in Linux at least, probably to 640 anyway unless
there is good argument otherwise that doing so would break operability
(with real implementations and not just in synthetic conformance
tests).

Tom

>
> --
> ===============================================
> David Farmer               Email:farmer@umn.edu
> Networking & Telecommunication Services
> Office of Information Technology
> University of Minnesota
> 2218 University Ave SE        Phone: 612-626-0815
> Minneapolis, MN 55414-3029   Cell: 612-812-9952
> ===============================================