Re: [IPsec] I-D Action: draft-ietf-ipsecme-ikev2-fragmentation-03.txt

"Valery Smyslov" <svanru@gmail.com> Thu, 10 October 2013 06:10 UTC

Return-Path: <svanru@gmail.com>
X-Original-To: ipsec@ietfa.amsl.com
Delivered-To: ipsec@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 91F9311E8121 for <ipsec@ietfa.amsl.com>; Wed, 9 Oct 2013 23:10:16 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[AWL=0.000, BAYES_00=-2.599]
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 rwt77eiEY-dl for <ipsec@ietfa.amsl.com>; Wed, 9 Oct 2013 23:10:16 -0700 (PDT)
Received: from mail-lb0-x230.google.com (mail-lb0-x230.google.com [IPv6:2a00:1450:4010:c04::230]) by ietfa.amsl.com (Postfix) with ESMTP id DFD9C11E8133 for <ipsec@ietf.org>; Wed, 9 Oct 2013 23:10:11 -0700 (PDT)
Received: by mail-lb0-f176.google.com with SMTP id y6so1691467lbh.35 for <ipsec@ietf.org>; Wed, 09 Oct 2013 23:10:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:cc:references:subject:date:mime-version :content-type:content-transfer-encoding; bh=Zrjxdr8DHn9oZXIKxpSrGLSJSYRCI8zndKrC6ARioKA=; b=KpMAVmvbmBPDl+8kTqGfGw1pNBs2iiBpt4BGnQd6GfrtFmKUlCkmniZRmBMnjr+dcN OwEoa8MS1GGKDAqfjvvNs6BwqeyZXdmgeI2niTTHWjC8D2nUtBRobzCP5XkeRV71xz1r TLRSPtirda2A0lYw1AtOtNohscnbko2yC9x+GauNW3W7/4fGJzJs9v9G5BYDVMOesbq9 N7kG5dOJqHddZnIYLzKODFgz6GOevvR0HiBRqK48oBVAB+kpwSIPYH/yP9Iz5eznzhl8 jTYi8IvNcJt+xBt3kQ//ITCYYmbXAJb/h/itZjTh/c/SUtzj+XJyolc725OS+mz9phpm IgXg==
X-Received: by 10.152.8.115 with SMTP id q19mr9988296laa.16.1381385404831; Wed, 09 Oct 2013 23:10:04 -0700 (PDT)
Received: from buildpc ([93.188.44.200]) by mx.google.com with ESMTPSA id mr1sm28627707lbc.16.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 09 Oct 2013 23:10:04 -0700 (PDT)
Message-ID: <9371D0D218044FE79F26DFC1637FA821@buildpc>
From: Valery Smyslov <svanru@gmail.com>
To: Paul Wouters <paul@cypherpunks.ca>, Tero Kivinen <kivinen@iki.fi>
References: <20131004123552.12797.87073.idtracker@ietfa.amsl.com> <44D6A1836A274C98907D95D59E530FE6@buildpc> <524EC6D8.9040006@gmail.com> <8B0A76CCEF2F4C65A9101BBD717B5C0F@buildpc> <alpine.LFD.2.10.1310041144500.10965@bofh.nohats.ca> <E46CD124E88F442495758F38BC026897@chichi> <21077.17123.827427.858811@fireball.kivinen.iki.fi> <alpine.LFD.2.10.1310090936090.5047@bofh.nohats.ca>
Date: Thu, 10 Oct 2013 10:10:10 +0400
MIME-Version: 1.0
Content-Type: text/plain; format="flowed"; charset="iso-8859-1"; reply-type="response"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2900.5931
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157
Cc: ipsec@ietf.org
Subject: Re: [IPsec] I-D Action: draft-ietf-ipsecme-ikev2-fragmentation-03.txt
X-BeenThere: ipsec@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Discussion of IPsec protocols <ipsec.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ipsec>, <mailto:ipsec-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/ipsec>
List-Post: <mailto:ipsec@ietf.org>
List-Help: <mailto:ipsec-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ipsec>, <mailto:ipsec-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 10 Oct 2013 06:10:16 -0000

Hi Paul,

>>   o  Check message validity - in particular, check whether values of
>>      Fragment Number and Total Fragments in Encrypted Fragment Payload
>>      are valid.  If not - message MUST be silently discarded.
>>
>> should be changed to say:
>>
>>   o  Check message validity - in particular, check whether values of
>>      Fragment Number (must be <= Total Fragments) and Total Fragments
>>      (must be >= previously seen Total Fragments for this message) in
>>      Encrypted Fragment Payload are valid. If not - message MUST be
>>      silently discarded.
>>
>> It should clearly say that if Total Fragments is less than previously
>> seen then this fragment needs to be discarded.
>
> But you must only do that after the decryption/authentication of the
> fragment or we are back at square one with an easy DoS this whole
> mechanism was supposed to protect us from.
>
> Which of course means an attacker can just send crap faster that you can
> verify it is crap after performing crypto on the fragment.

Not necessary. It depends on the state receiver currently is in.

When you receive very first fragment and start reassembly you
remember its Total Fragments field (of course after you validate message).

After that you have the following possibilities.

1. You receive fragment with the same Total Fragments.You continue
reassembling, adding this fragment to the queue, or discarding it
if it is a duplicate packet

2. You receive fragment with the smaller Total Fragments. It may either
be a late packet from the previous set of fragments (larger in size)
that accidently reach us, or it may be attack packet, or it may be
packet from broken peer. In any case it is safe to discard it
without any verification.

3. You receive fragment with greater Total Fragments. In this case,
if you already successfully reassembled message and send a response,
it most probably means that response didn't reach peer. In this
case it is safe to retransmit response without any verification
of fragment authenticity, it won't hurt peer even if it was faked fragment.
You may rate limit such responses or you may verify fragment before - as you 
wish.
And if you support PMTU discovery, you may refragment response
into smaller fragments, but in this case it is better to verify
fragment before, as refragmentation cost is not zero.
If you still in the process of reassembling, than yes, you need
to verify fragment and, if it is valid, discard all received so
far fragments and start reassembling over, as it becomes clear
that peer decreased fragmen size and retransmits new set
of fragments, so its pointless for you to wait for the rest of
fragments from previous set.