RE: How does a server identify a new connection?

Mike Bishop <mbishop@evequefou.be> Thu, 29 November 2018 19:07 UTC

Return-Path: <mbishop@evequefou.be>
X-Original-To: quic@ietfa.amsl.com
Delivered-To: quic@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 92258130E6D for <quic@ietfa.amsl.com>; Thu, 29 Nov 2018 11:07:04 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.36
X-Spam-Level:
X-Spam-Status: No, score=-3.36 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_MED=-1.459, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=evequefou.onmicrosoft.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 yMkP33QvLoTI for <quic@ietfa.amsl.com>; Thu, 29 Nov 2018 11:07:01 -0800 (PST)
Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-eopbgr770102.outbound.protection.outlook.com [40.107.77.102]) (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 3E179130E69 for <quic@ietf.org>; Thu, 29 Nov 2018 11:07:01 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=evequefou.onmicrosoft.com; s=selector1-evequefou-be; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RGJEA6Dhc3KS116SRW/GmSJYdXQHaySyDPU13pWSTkU=; b=qBqfhOYHdqFyHM+3BolBtV+MrxQIN09QqPutSIM+CQhhBL0yqKryYf5Dfr2K4gE13yx0GzVaMTUsnsuWVfHZd6ueAq3drbYst0ecjxKGVjj7Gc29lVDq7/I8wGVQCFzjSB10HmKxWZ1ONkgWgYfDJwaChO42f3uYsnCWb2htERQ=
Received: from CY4PR22MB0983.namprd22.prod.outlook.com (10.171.171.20) by CY4PR22MB0277.namprd22.prod.outlook.com (10.173.194.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1361.19; Thu, 29 Nov 2018 19:06:58 +0000
Received: from CY4PR22MB0983.namprd22.prod.outlook.com ([fe80::e456:e301:9ed5:5f3a]) by CY4PR22MB0983.namprd22.prod.outlook.com ([fe80::e456:e301:9ed5:5f3a%6]) with mapi id 15.20.1361.019; Thu, 29 Nov 2018 19:06:58 +0000
From: Mike Bishop <mbishop@evequefou.be>
To: "Lubashev, Igor" <ilubashe@akamai.com>, Kazuho Oku <kazuhooku@gmail.com>, Martin Thomson <martin.thomson@gmail.com>
CC: IETF QUIC WG <quic@ietf.org>
Subject: RE: How does a server identify a new connection?
Thread-Topic: How does a server identify a new connection?
Thread-Index: AQHUh4udqDnjQZvud0Gpd8GyHNtJT6VmCcuAgAABMACAAAKMgIAAAxAAgADXowCAACWzIA==
Date: Thu, 29 Nov 2018 19:06:58 +0000
Message-ID: <CY4PR22MB09837FF9D76CA77FCAA0E808DAD20@CY4PR22MB0983.namprd22.prod.outlook.com>
References: <CANatvzzaW-y6y6qN-K4W91WL+3A0fV3SLbOqcq5+SB=qXDpRXw@mail.gmail.com> <CABkgnnV9ONF5LEuCnpy8BsOHnFGidFbVKoMOeM9EohabMBMV6A@mail.gmail.com> <CANatvzxyUm86dNYAwiXeY_xHtcQBKuVWxa_3=9rgmFJtC4u+yw@mail.gmail.com> <CABkgnnUwK37q7jMSiKseJJtWUN1dxv-uV3M9btdjNurHw_NG9w@mail.gmail.com> <CANatvzxDcBz77F07wnJyPnHwJCj08DhbVi_2wtWYquroZtODxg@mail.gmail.com> <67268dd11a054e6eb7101abaafb0faa8@ustx2ex-dag1mb5.msg.corp.akamai.com>
In-Reply-To: <67268dd11a054e6eb7101abaafb0faa8@ustx2ex-dag1mb5.msg.corp.akamai.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: spf=none (sender IP is ) smtp.mailfrom=mbishop@evequefou.be;
x-originating-ip: [2601:600:8080:701:59ad:b0d9:9782:2580]
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; CY4PR22MB0277; 6:x2hs0cYlrLmjUdaQuuV5y4vbWriu0YuHwgByQSG4g4cEFRbqgn+EDH9Qm2jfRI6rRQC1O4qExqgQJin5rOZEw788efuuhHJFf0KcgEXJhac3GktaW98Rxe3t/wwBUR+BSeD49i4ujoFqKQPYWXDMShwtLOjKdGg/SVFFhJv4HJQ3qwxDdNU85pegBK1EPt8HGMDko56wTfmSsRpmF/RxyWd0CVuDCBQIMpCzAxJ8U1Dm4sgfb7CNnDFC9ah2iEf7G4gsd9gfkY5onC6uZv3aawql67ykBPEU4aRGpDZ7jt0Mn6n+jOSbhkmK520Td1V5WT4rpQnR18/TGBmiZtEWaETKOuKv1C9mfRpx+dAObjQQhJPnmuEL5+BO7rdLzCUz53IfhVLwO8Q1UnyxfnTGTQJhkyG6MAUG4i76oNop6NJBUC2u52nwBgIbhymc2u7uzpjT3rzNqSURWNmc+gi9lA==; 5:ecCtjTEpqj3sL9sDzrPkCIgbkI+iGFFhazmuqqvqMSBcp+Glt59cElHlKBiBhE13pmefHpGXyo1daWwhVFGrRtBtkH3jDpjf8GAn0fxq/db3z3qeX1VKVDpihlz/6VvPxSi2Vk1Slc0KcUZ+spSV2QcTBKBcWR0ou3kxH/JMGF8=; 7:iM10yGyAVrFG3jXsIAVPl0dT08JExe/b3EJNYvePmaa3cH2AzWt7bdA25IpOSfvGSqihvKT+jpDAB7GZX1gP2Un13eHeyr8KMJg13QzeHoG2uue1IKvbPKzhLAm81RHKbXYuCHS0u0DD4Z6bxSnZng==
x-ms-exchange-antispam-srfa-diagnostics: SOS;
x-ms-office365-filtering-correlation-id: 28542246-1e8b-4e80-e890-08d6562dd62c
x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(7021145)(8989299)(5600074)(711020)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(2017052603328)(7153060)(7193020); SRVR:CY4PR22MB0277;
x-ms-traffictypediagnostic: CY4PR22MB0277:
x-microsoft-antispam-prvs: <CY4PR22MB027744807D17F911E22065B6DAD20@CY4PR22MB0277.namprd22.prod.outlook.com>
x-ms-exchange-senderadcheck: 1
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231453)(999002)(944501410)(52105112)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(2016111802025)(6043046)(201708071742011)(7699051)(76991095); SRVR:CY4PR22MB0277; BCL:0; PCL:0; RULEID:; SRVR:CY4PR22MB0277;
x-forefront-prvs: 0871917CDA
x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(39830400003)(366004)(376002)(396003)(346002)(13464003)(60444003)(199004)(189003)(236005)(14444005)(446003)(8676002)(53936002)(9686003)(4326008)(54896002)(6306002)(55016002)(5660300001)(6246003)(256004)(74316002)(6116002)(105586002)(316002)(790700001)(186003)(110136005)(39060400002)(99286004)(6506007)(7696005)(76176011)(53546011)(46003)(7736002)(6436002)(106356001)(102836004)(81156014)(81166006)(33656002)(8936002)(229853002)(2906002)(561944003)(25786009)(68736007)(86362001)(476003)(74482002)(71200400001)(14454004)(508600001)(97736004)(11346002)(71190400001)(93886005)(486006); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR22MB0277; H:CY4PR22MB0983.namprd22.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1;
received-spf: None (protection.outlook.com: evequefou.be does not designate permitted sender hosts)
x-microsoft-antispam-message-info: MBft+b992JXTpA/dVf1iac2oSQBuphPaxLLyY2EGgCamVn86zkaYoESAnMIqRNZYhBah9TKBxemClplBGRLy7L5yKm91CpNESRxk6ziMZ49x5/wg2pfbvubFzBWXhpdX6+EJSVHHHnui6cpghNvGSK/RA9Ewcswn4VC8KPRV+gxxOL+WTqKmEmnv4+dfjTpAC3AZmEfGP1bpAWvEJ1/VxQqdjOVH4XF5E0f61RSGRe23n2rSFcuG7UxIAZNPTTMzblGNO6zM4qp3swgwjQbeZZFlkheAv2SuFV+1suT34tquPDIVT4MtGqdkXdvjtFZ8Xvcx6vP3F2NqSnHIdLglNit0J4QB14S3v3Pka3F34iQ=
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: multipart/alternative; boundary="_000_CY4PR22MB09837FF9D76CA77FCAA0E808DAD20CY4PR22MB0983namp_"
MIME-Version: 1.0
X-OriginatorOrg: evequefou.be
X-MS-Exchange-CrossTenant-Network-Message-Id: 28542246-1e8b-4e80-e890-08d6562dd62c
X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2018 19:06:58.3005 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 41eaf50b-882d-47eb-8c4c-0b5b76a9da8f
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR22MB0277
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/Fp6xER3aOfnpmgkFGQIOuAYD0Bw>
X-BeenThere: quic@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Main mailing list of the IETF QUIC working group <quic.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/quic>, <mailto:quic-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/quic/>
List-Post: <mailto:quic@ietf.org>
List-Help: <mailto:quic-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/quic>, <mailto:quic-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 29 Nov 2018 19:07:04 -0000

The layering on using CH is problematic.  If the server is supposed to ignore the attacker's packet, that implies that it pre-parses the contents of the Initial into the TLS data before deciding whether to actually injest the packet.  I don't think a productive solution lies there.  At the same time, I agree it would be nice to be able to protect against these attacks, iff we can find a straightforward way.  I think some of the ideas here are heading in the right direction.



IIUC, the attack is that the attacker races an Initial containing a different ClientHello, some DCID (maybe same as client’s, maybe different), the same SCID as the client (easy if the client uses zero-length), and spoofs the client’s source IP:port.



Then:

  *   If attacker uses same DCID as client but modifies the ClientHello, server can discard the packet without processing it and await the real packet
  *   If attacker uses different CID from client, server sees it as a separate connection attempt; client can identify and discard these packets (even if it used a zero-length SCID).



With no shared context, this is a challenging problem.  Handshake packets will already have this property – decryption will fail and they’ll get dropped if it’s in response to the attacker’s Initial.  But if the Initial packet received from the server was responsive to the attacker, the client will generate the wrong Handshake key and drop the real Handshake packets as well, so the attack succeeds.



If the server were to reflect back something to uniquely identify the Initial that it received, the client could discard responses to the attacker and wait for the response to its own message.  As Mikkel suggests, the authentication tag might work here, which would give us the second property.  If clients retransmit with different packet numbers, they simply remember multiple outstanding tags.  A sufficiently unique SCID is a weaker defense, but still requires the attacker to see the real packet before crafting the false one.



For the first property, Igor’s idea seems sensible.  If the initial DCID were a hash of the unencrypted packet payload, that doesn’t require interpreting the ClientHello, just the bytes at the transport.  Then the server would accept Initials with either this property or a valid token from a Retry.



HRR makes that more difficult; perhaps the client’s second Initial similarly includes proof / identification of which server Initial it’s responding to.



Of course, if clients just always used a non-zero-length SCID, this attack would be less likely to work.  Maybe the simpler change is to require a non-zero-length SCID during the handshake, then provide a way to switch to a zero-length CID post-handshake?  It doesn’t close the door as effectively, but it makes the attack harder and is a much smaller change this late in the process.



-----Original Message-----
From: QUIC <quic-bounces@ietf.org> On Behalf Of Lubashev, Igor
Sent: Thursday, November 29, 2018 7:53 AM
To: Kazuho Oku <kazuhooku@gmail.com>; Martin Thomson <martin.thomson@gmail.com>
Cc: IETF QUIC WG <quic@ietf.org>
Subject: RE: How does a server identify a new connection?



A simpler way would be making Client Initial CID be not just a random string of bits but a hash of the rest of the CI packet.



If the H(CI) is not included in the server's initial, how does the client know which of the SI packets is a reply to the attacker's CI and which is a reply to client's own CI?



- Igor





> -----Original Message-----

> From: Kazuho Oku <kazuhooku@gmail.com<mailto:kazuhooku@gmail.com>>

> Sent: Wednesday, November 28, 2018 10:02 PM

> To: Martin Thomson <martin.thomson@gmail.com<mailto:martin.thomson@gmail.com>>

> Cc: IETF QUIC WG <quic@ietf.org<mailto:quic@ietf.org>>

> Subject: Re: How does a server identify a new connection?

>

> 2018年11月29日(木) 11:50 Martin Thomson <martin..thomson@gmail.com<mailto:martin..thomson@gmail.com>>:

> >

> > On Thu, Nov 29, 2018 at 1:41 PM Kazuho Oku <kazuhooku@gmail.com<mailto:kazuhooku@gmail.com>>

> wrote:

> > > The question is what happens if a man-on-the-side attacker races

> > > an Initial packet with the same 5-tuple, same SCID / DCID, but

> > > having different values in other fields.

> >

> > Yep, can't guarantee a win here.

>

> My proposal is that we _can_ guarantee a win, if we use a hash value

> derived from ClientHello as an identifier of a connection attempt.

>

> This is because ClientHello is the only thing that could be different

> to cause a connection establishment attempt to fail, assuming that we adopt PR #2045.

>

> > So that makes me inclined to say

> > that we don't put it in the draft.  If it turns out to be useful, we

> > can regret it later, but writing down a defense that doesn't really

> > work that well doesn't seem right.

>

>

>

> --

> Kazuho Oku