Re: [tsvwg] L4S & VPN anti-replay interaction: Explanation

Bob Briscoe <ietf@bobbriscoe.net> Mon, 17 May 2021 23:51 UTC

Return-Path: <ietf@bobbriscoe.net>
X-Original-To: tsvwg@ietfa.amsl.com
Delivered-To: tsvwg@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 770E23A13D2 for <tsvwg@ietfa.amsl.com>; Mon, 17 May 2021 16:51:34 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.433
X-Spam-Level:
X-Spam-Status: No, score=-1.433 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, NICE_REPLY_A=-0.001, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=bobbriscoe.net
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 66rp4la6nL2y for <tsvwg@ietfa.amsl.com>; Mon, 17 May 2021 16:51:29 -0700 (PDT)
Received: from mail-ssdrsserver2.hosting.co.uk (mail-ssdrsserver2.hosting.co.uk [185.185.85.90]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2A23A3A13D0 for <tsvwg@ietf.org>; Mon, 17 May 2021 16:51:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bobbriscoe.net; s=default; h=Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:Cc:From:References:To:Subject:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=BQgYGa1xG9k1RXxJDiLWTXKAIdsQYmybFnGyl1fa2wg=; b=lTZmY9z/enAAo95Hxp9ROcb8K6 m7QOMPwLWk5AufcplZt7jKkjLfiDpI7VAG1jxkjJbHHpZcRRq5lfy3fOUhnaZ82obDoraEfROD0lk 4enpGSaFfhi+DzDYC/eA5PLtyomJkVP48pMh5P7t/BMGoAqNR8gxlEjg9dSsQ35eAPVeQUUX7VvdF NWMXPTldPdgTIh4muwWk/ZOb5RNNesJl0Xq0ngaojxKK659Yx7vWf1tgiXRWV2cFly0xb5KlwHCL9 yC0ApHRv2M2HQLPhNhryLQzBODaYtGaz0KgxefhV9pA4AWtcyO1FQbuk4KUz27prvi9IxDuoriXVB l/tVOtxQ==;
Received: from 67.153.238.178.in-addr.arpa ([178.238.153.67]:46816 helo=[192.168.1.11]) by ssdrsserver2.hosting.co.uk with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from <ietf@bobbriscoe.net>) id 1lin1E-0007zU-O5; Tue, 18 May 2021 00:51:25 +0100
To: "Black, David" <David.Black@dell.com>
References: <MN2PR19MB4045206ECB759EEE5FA3C60383539@MN2PR19MB4045.namprd19.prod.outlook.com>
From: Bob Briscoe <ietf@bobbriscoe.net>
Cc: "tsvwg@ietf.org" <tsvwg@ietf.org>
Message-ID: <54329b8c-f56e-f72c-138e-6c700648080a@bobbriscoe.net>
Date: Tue, 18 May 2021 00:51:24 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1
MIME-Version: 1.0
In-Reply-To: <MN2PR19MB4045206ECB759EEE5FA3C60383539@MN2PR19MB4045.namprd19.prod.outlook.com>
Content-Type: multipart/alternative; boundary="------------9CC0EEAA598A73720B3CB223"
Content-Language: en-GB
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - ssdrsserver2.hosting.co.uk
X-AntiAbuse: Original Domain - ietf.org
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - bobbriscoe.net
X-Get-Message-Sender-Via: ssdrsserver2.hosting.co.uk: authenticated_id: in@bobbriscoe.net
X-Authenticated-Sender: ssdrsserver2.hosting.co.uk: in@bobbriscoe.net
X-Source:
X-Source-Args:
X-Source-Dir:
Archived-At: <https://mailarchive.ietf.org/arch/msg/tsvwg/xs_JHiAdROOMXnvdfREbfAX0m-Q>
Subject: Re: [tsvwg] L4S & VPN anti-replay interaction: Explanation
X-BeenThere: tsvwg@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Transport Area Working Group <tsvwg.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/tsvwg>, <mailto:tsvwg-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/tsvwg/>
List-Post: <mailto:tsvwg@ietf.org>
List-Help: <mailto:tsvwg-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/tsvwg>, <mailto:tsvwg-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 17 May 2021 23:51:35 -0000

David,

On 11/05/2021 15:56, Black, David wrote:
>
> This message is the explanation of the interaction of L4S and VPN 
> anti-replay that I promised to send during the interim meeting 
> yesterday.  I'm writing (explaining) as an individual, not as a WG chair.
>
> This explanation is for IPsec VPNs, although it applies in principle 
> to any VPN that propagates the ECN field to outer IP headers.
>
> For IPsec, the primary RFCs involved are RFC 4301 (IPsec architecture, 
> https://datatracker.ietf.org/doc/rfc4301/ 
> <https://datatracker.ietf.org/doc/rfc4301/>) and RFC 4303 (ESP – 
> Encapsulating Security Payload, 
> https://datatracker.ietf.org/doc/rfc4303/ 
> <https://datatracker.ietf.org/doc/rfc4303/>).  RFC 4302 (AH – 
> Authentication Header, https://datatracker.ietf.org/doc/rfc4302/ 
> <https://datatracker.ietf.org/doc/rfc4302/>) was mentioned in 
> discussion, but that RFC is not generally applicable to VPNs because 
> AH does not encrypt its payload. As a result, this explanation focuses 
> on ESP anti-replay functionality, as specified in Section 3.4.3 of RFC 
> 4303 (https://datatracker.ietf.org/doc/html/rfc4303#section-3.4.3 
> <https://datatracker.ietf.org/doc/html/rfc4303#section-3.4.3>). This 
> explanation also assumes a tunnel-mode IPsec VPN, where the outer IP 
> header is applied and removed by the VPN sender and receiver.  
> Tunnel-mode is a common configuration, as it separates VPN IP 
> addressing (in inner IP headers) from Internet IP addressing (in outer 
> IP headers).
>

[BB] The reason I focused on AH is that replay attacks are a lot harder 
to mount when blind (i.e. when traffic is encrypted). But I accept that 
replay protection is normally used on encrypted VPNs, whether or not the 
replay protection is actually necessary. Then of course the ESP VPN is 
prone to this interaction. But AH exhibits the more difficult tradeoff, 
because it's more critical to keep replay protection enabled.

> Here's a simplified summary of how ESP anti-replay works:
>
>   * The VPN sender numbers each packet with a sequence number that is
>     incremented for each packet.
>   * The VPN receiver uses a sliding sequence number window to
>     scoreboard (track) which packets have been received and reject
>     duplicates.
>       o There's a bit per packet within the window that indicates
>         whether that packet has been received.
>       o The scoreboard is initialized with all bits cleared to '0'.
>         Setting a bit to '1' indicates that the corresponding packet
>         has been received.
>   * Receipt of a packet whose sequence number is within the sliding
>     window causes the VPN receiver to check the bit for that sequence
>     number:
>       o If that bit is already set to '1', the packet is a duplicate
>         and is discarded.
>       o If that bit is cleared to '0', that bit is set to '1' and the
>         packet is processed and forwarded.
>   * Receipt of a packet whose sequence number is larger than the range
>     covered by the sliding window causes the window to advance to
>     include that sequence number (clearing new scoreboard bits to
>     '0'), and then proceeds as above because the packet's sequence
>     number is within the window after the advance.
>       o The packet sequence number is included in ESP crypto
>         computations, so rogue packets injected by an attacker who
>         does not know the relevant VPN key(s) are discarded without
>         advancing the window.
>   * Receipt of a packet with a sequence number less than the range
>     covered by the window always causes the packet to be discarded.
>   * Here's the entire paragraph on scoreboard window size (last
>     paragraph in Section 3.4.3 of RFC 4303):
>
>             A minimum window size of 32 packets MUST be supported when 32-bit
>             sequence numbers are employed; a window size of 64 is preferred and
>             SHOULD be employed as the default.  Another window size (larger than
>             the minimum) MAY be chosen by the receiver.  (The receiver does NOT
>             notify the sender of the window size.)  The receive window size
>             should be increased for higher-speed environments, irrespective of
>             assurance issues.  Values for minimum and recommended receive window
>             sizes for very high-speed (e.g., multi-gigabit/second) devices are
>             not specified by this standard.
>
>   * Prior discussion on this list indicates that the 32 and 64 window
>     size values are present in some running code, at least as defaults.
>
> L4S can exhibit undesirable interactions with ESP anti-replay based 
> only on ECT(0) and ECT(1) in the outer headers as follows:
>
>  1. Simultaneously send L4S flows (ECT(1) in ECN field) and Classic
>     flows (ECT(0) in ECN field) through the same VPN.
>  2. The VPN sender assigns in-order sequence numbers to the packets
>     independent of which type of flow they belong to.
>  3. The VPN sender propagates the ECN field in each packet to the
>     outer IP header, as required by the tables in Sections 5.1.2.1 and
>     5.1.2.2 of RFC 4301.
>  4. One or more network node bottlenecks between the VPN sender and
>     receiver apply L4S treatment to the L4S ECT(1) packets, causing
>     them to advance past some Classic ECT(0) packets.
>
> At the VPN receiver, the received L4S packets drive advancing the 
> sliding window to higher sequence numbers.  If the sequence numbers in 
> the arriving L4S packets get ahead of the sequence numbers in the 
> arriving Classic packets by the size of the sliding window or more, 
> the arriving Classic packets are dropped *even though they are not 
> duplicates* (!).
>
> The problem arises at step 1 – mixing L4S and non-L4S traffic in the 
> same VPN.  IPsec has addressed the analogous problem for Diffserv by 
> requiring (MUST) support of multiple VPN sessions (which IPsec calls 
> Security Associations, SAs) between the same endpoints, and strongly 
> recommending (SHOULD) that traffic in different Diffserv classes use 
> different SAs (RFC 4301, Section 4.1, paragraph spanning pp.13-14).
>

[BB] In the thread where Sebastian first pointed out this interaction, I 
asked if you knew how prevalent it is for IPsec implementations to 
follow that SHOULD. Indeed, are you aware of any implementations at all 
that follow it?

You might have noticed the Cisco troubleshooting guide I found about how 
to remedy Diffserv interacting with replay-protection, which implies 
that the different DSCPs do not always have separate SAs:
https://www.cisco.com/c/en/us/support/docs/ip/internet-key-exchange-ike/116858-problem-replay-00.html

It occurs to me that multiple application sessions can come and go 
within a VPN. So it might be some time after the set up of a VPN when an 
application is launched that starts to use different DSCPs within the 
VPN. The VPN would not have known this in advance, so then it would have 
to set up a new SA on the fly. Then it would have to either buffer or 
discard the new Diffserv packets while it did the new key exchange.

Seems unlikely that an implementer would have gone to all this trouble, 
rather than just using one SA, which is allowed by the SHOULD in the spec.
It strikes me that this SHOULD in RFC4301 might be easy to say but 
infeasible to implement.

On a host with an L4S CC enabled, a VPN would never need more than two 
SAs for the two types of ECN. So it would be more feasible to ensure 
that a VPN sets up two SAs in advance (for ECT1 or NotECT&ECT0). But 
that would require an L4S-specific patch to the VPN code. That would be 
do-able but probably only reasonable to expect it to be officially 
maintained in a VPN if L4S one day became standards track. And by then 
ECT0 might be on the decrease anyway.


> At least two incorrect assertions have been made about IPsec 
> anti-replay in list discussion and/or in the interim meeting:
>
>   * The undesirable anti-replay interaction is neither specific to nor
>     caused by L4S.
>       o That is incorrect because RFC 4301 has addressed the
>         anti-replay interaction for Diffserv.  In contrast, L4S is new
>         wrt RFC 4301.
>

[BB] Correct, RFC4301 doesn't ask for ECT1 to be in a separate SA 'cos 
(obviously) L4S didn't exist when 4301 was written.

But that first sentence ("RFC 4301 has addressed the anti-replay 
interaction for Diffserv") might not be the whole story, if the SHOULD 
is infeasible to implement (see above).

>      o
>
>
>   * The undesirable anti-replay interaction only occurs if CE marks
>     are present in some of the packets involved.
>       o This is incorrect because ECT(0) and ECT(1) values in the ECN
>         field suffice to create the problem, see above.
>

[BB] Correct (if ECT0 and ECT1 are in the same SA).

I was thinking of the corner-case where the VPN ingress places ECT1 into 
a separate SA, but there are multiple bottlenecks between the two ends 
of the VPN as in the unlikely CE reordering problem with L4S discussed 
before:
1. VPN ingress
2. Classic ECN AQM
3. L4S DualQ AQM
4. VPN egress

If both AQMs are simultaneously bottlenecked (unusual) then, any ECT0 
packets that the Classic AQM marks as CE will be classified into the L4S 
queue of the DualQ, along with the packets in the ECT1 SA. Then replay 
protection in the VPN egress could drop some Classic traffic.


> I'll close by noting that if L4S flows carried a DSCP that differed 
> from Classic flows, that would enable a "reduce to previous case" line 
> of reasoning (yes, I used to be a mathematician) that reuses the IPsec 
> provisions for Diffserv to address this anti-replay interaction with 
> L4S.  That reuse won't prevent all reordering-caused anti-replay 
> problems that could occur, but it would take advantage of 
> existing/known techniques for dealing with them.
>

[BB] That would only make a difference if the VPN actually implemented 
separating DSCPs into separate SAs (which I questioned earlier).
It might be as feasible for the VPN to separate ECT1 into a separate SA, 
as discussed earlier.



Bob

> Thanks for reading this far, --David
>
> *David L. Black, *Sr. Distinguished Engineer, Technology & Standards
>
> Infrastructure Solutions Group,*Dell Technologies*
>
> mobile +1 978-394-7754 David.Black@dell.com <mailto:David.Black@dell.com>
>

-- 
________________________________________________________________
Bob Briscoe                               http://bobbriscoe.net/