Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp720978pxb; Fri, 14 Jan 2022 15:00:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJyRhACMDVFabl986ol0kFXbQbA/wy3IHPd6wU/G7A1iPgLJtfMbnTxXX4GD7f7eLZZvIkSY X-Received: by 2002:a17:906:c156:: with SMTP id dp22mr8617143ejc.283.1642201210947; Fri, 14 Jan 2022 15:00:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642201210; cv=none; d=google.com; s=arc-20160816; b=sCEcd9uVQXmnXKRTTQY+TxF6BwxUO24mqTv5sPl2eiVeSr/RtmostM4s9YkGYWym5e pbTv0p2VQILwJtbwO3BPO2OVItI/Nt6YI+HPuuB63FZk+IsJyjyhHIDAwzCMusHudrdE Ld3LzWO1UI3ObzaUDc6bzoOrupTNwgq7TBIBWV5k2rVHOopmYfIidkEwy+5a4arfQni/ uS2DrWVGFTmU/4dghwcBU/Pq9LZa2jh1rIOAeewFA3wkIONb5nclCtACddvmyAan6xrZ BwQux6Udk7x9y68nj7uNl71zXSyxS5Z60vcci+dvDbefMagZSG6HmhaYGRxaR3SUbnb2 W84w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:dkim-signature:dkim-signature; bh=XC8x7KXAcVBSo+8COeedpg7cEMYqOq1otu+UETusZEE=; b=HDFE2fSJXE2ZfzkTLVqoTOhakl3Lef3ilBOAUNx1EZcGY9agHuVDvuvDijYrm63Chg RyGn1KZeXYY5xjk8nWvfcG9EIU3f8flrfFVlOyId/Zazl1pko4CpWvftp3G/+bAIeSPh QEdSfgwGqNVb2cVSosqlLzbT8ViQ8HpnsKJ8uEVSTbQnZ7iisA99C5zd0dL9B4KtmmTJ fSj1svMo7a7u4ixFqS7AdGV7wJ2Z8U+PKp0cEnuvHs1J3sP8cMTPbe7mO62/7Z10S7NK k3Om0dIPk0fBRfzRZVWkBlL6DnJoAdyGOqHZ9DjTZLeYFRB7dYgC23vERLvoI7gpYkUI saYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@stressinduktion.org header.s=fm2 header.b=JkO4dr9O; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=XxcYTeuC; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qk42si3652394ejc.935.2022.01.14.14.59.46; Fri, 14 Jan 2022 15:00:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@stressinduktion.org header.s=fm2 header.b=JkO4dr9O; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=XxcYTeuC; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234374AbiANRoM (ORCPT + 99 others); Fri, 14 Jan 2022 12:44:12 -0500 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:42241 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243918AbiANRoM (ORCPT ); Fri, 14 Jan 2022 12:44:12 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 2FEE5580183; Fri, 14 Jan 2022 12:44:09 -0500 (EST) Received: from imap48 ([10.202.2.98]) by compute4.internal (MEProxy); Fri, 14 Jan 2022 12:44:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= stressinduktion.org; h=mime-version:message-id:in-reply-to :references:date:from:to:cc:subject:content-type; s=fm2; bh=XC8x 7KXAcVBSo+8COeedpg7cEMYqOq1otu+UETusZEE=; b=JkO4dr9OnXIi2E5oBM5K t66ge8M1MdOaiKC+cg+WCGTYPSOwvSHo58qUkzgvqULeHC1fZrOPnn3cvQ6Tf2vJ lxuoYGE4+5Ec0LULpqmhcN2kcyeEzlo7N3cuBeWugdDNbK13fRUuNVqeM0rCBS9b ddQIRMTYADY49oMEc1U0JRssBs8MX9sL49QHb196zqP8yHGD/7xEhyZhu+6QXv8A cQ8KNKhfmiBKqDOibsRYi711kfuBvekag0zW6rYmT8bEAiG+iHctt5F8n1b0PEuj U+mgmXBnQUnahqUky2UZczB84TlelCxsWyhg2kxr97EWeAqib+DNq+7QYnKEDYCn 2g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=XC8x7K XAcVBSo+8COeedpg7cEMYqOq1otu+UETusZEE=; b=XxcYTeuCtnlGC7MarUYPyU ddvAlD8qIyyumQtLdcNmyBqPSY6bdaBIdld6+Mgc0lD4ShzjMtBhh8AeP+30iO9G rxqYC6i9zUuEd02xgX143G5o2jNxd3YwEDEhlLNCoUI20plomMgnylK5AsGt2NpB N4nERzqjE6+bMxjDK8l3kkILv7mmwWc4qevzfVe2+fVDbxeYc66U3KxxsUcXAWwH Zs92EJTLSbS/L6ZPkMj3fZUsNLGuq74mJR+xEllfbYqIUNrx1h3O4Agv0B/5jo61 pYMOQTXo0ACFFHhAtqR/WT6X2ziLjVzed/Cg0wLbebL4JCawb2QhdVTUGpdT2G0w == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrtdehgddutdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfjrghn nhgvshcuhfhrvgguvghrihgtucfuohifrgdfuceohhgrnhhnvghssehsthhrvghsshhinh guuhhkthhiohhnrdhorhhgqeenucggtffrrghtthgvrhhnpeehieeggeethedtgfdvtdek ffduudegueevffekheefjeegvedugeetveffteetleenucffohhmrghinhepgihktggurd gtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep hhgrnhhnvghssehsthhrvghsshhinhguuhhkthhiohhnrdhorhhg X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 7B93821E006E; Fri, 14 Jan 2022 12:44:07 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-4569-g891f756243-fm-20220111.001-g891f7562 Mime-Version: 1.0 Message-Id: <3db9c306-ea22-444f-b932-f66f800a7a28@www.fastmail.com> In-Reply-To: References: <20220112131204.800307-1-Jason@zx2c4.com> <20220112131204.800307-3-Jason@zx2c4.com> <87r19cftbr.fsf@toke.dk> <55d185a8-31ea-51d0-d9be-debd490cd204@stressinduktion.org> Date: Fri, 14 Jan 2022 18:41:58 +0100 From: "Hannes Frederic Sowa" To: "Jason A. Donenfeld" Cc: =?UTF-8?Q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , Netdev , LKML , "Geert Uytterhoeven" , "Herbert Xu" , "Ard Biesheuvel" , "Jean-Philippe Aumasson" , "Linux Crypto Mailing List" , "Erik Kline" , "Fernando Gont" , "Lorenzo Colitti" , "Hideaki Yoshifuji" Subject: Re: [PATCH RFC v1 2/3] ipv6: move from sha1 to blake2s in address calculation Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hello, On Fri, Jan 14, 2022, at 17:07, Jason A. Donenfeld wrote: > On Thu, Jan 13, 2022 at 12:15 PM Hannes Frederic Sowa > wrote: >> > I'm not even so sure that's true. That was my worry at first, but >> > actually, looking at this more closely, DAD means that the address can >> > be changed anyway - a byte counter is hashed in - so there's no >> > guarantee there. >> >> The duplicate address detection counter is a way to merely provide basic >> network connectivity in case of duplicate addresses on the network >> (maybe some kind misconfiguration or L2 attack). Such detected addresses >> would show up in the kernel log and an administrator should investigate >> and clean up the situation. > > I don't mean to belabor a point where I'm likely wrong anyway, but > this DAD business has kept me thinking... > > Attacker is hanging out on the network sending DAD responses, forcing > those counters to increment, and thus making SHA1(stuff || counter) > result in a different IPv6 address than usual. Outcomes: > 1) The administrator cannot handle this, did not understand the > semantics of this address generation feature, and will now have a > broken network; > 2) The administrator knows what he's doing, and will be able to handle > a different IPv6 address coming up. > > Do we really care about case (1)? That sounds like emacs spacebar > heating https://xkcd.com/1172/. And case (2) seems like something that > would tolerate us changing the hash function. Taking a step back, there is the base case where we don't have duplicate addresses on the network nor an attack is on-going. We would break those setups with that patch. And those are the ones that matter most. In particular those stable-random addresses are being used in router advertisements for announcing the next-hop/default gateway on the broadcast domain. During my time in IPv6 land I have seen lots of setups where those automatic advertisements got converted into static configuration for the sake of getting hands on a cool looking IPv6 address on another host (I did that as well ;) ). In particular, in the last example, you might not only have one administrator at hand to handle the issue, but probably multiple roles are involved (host admin and network admin maybe from different organizations - how annoying - but that's a worst case scenario). Furthermore most L2 attacks nowadays are stopped by smarter switches or wifi access points(?) anyway with per-port MAC learning and other hardening features. Obviously this only happens in more managed environments but probably already also at smaller home networks nowadays. Datacenters probably already limit access to the Layer 2 raw network in such a way that this attack is probably not possible either. Same for IoT stuff where you probably have a point-to-point IPv6 connection anyway. The worst case scenario is someone upgrading their kernel during a trip away from home, rebooting, and losing access to their system. If we experience just one of those cases we have violated Linux strict uAPI rules (in my opinion). Thus, yes, we care about both, (1) and (2) cases. I don't think we can argue our way out of this by stating that there are no guarantees anyway, as much as I would like to change the hash function as well. As much as I know about the problems with SHA1 and would like to see it removed from the kernel as well, I fear that in this case it seems hard to do. I would propose putting sha1 into a compilation unit and overwrite the compiler flags to optimize the function optimized for size and maybe add another mode or knob to switch the hashing algorithm if necessary. >> Afterwards bringing the interface down and >> up again should revert the interface to its initial (dad_counter == 0) >> address. > > Except the attacker is still on the network, and the administrator > can't figure it out because the mac addresses keep changing and it's > arriving from seemingly random switches! Plot twist: the attack is > being conducted from an implant in the switch firmware. There are a > lot of creative different takes on the same basic scenario. The point > is - the administrator really _can't_ rely on the address always being > the same, because it's simply out of his control. This is a very pessimistic scenario bordering a nightmare. I hope the new hashing algorithm will protect them. ;) > Given that the admin already *must* be prepared for the address to > change, doesn't that give us some leeway to change the algorithm used > between kernels? > > Or to put it differently, are there _actually_ braindead deployments > out there that truly rely on the address never ever changing, and > should we be going out of our way to support what is arguably a > misreading and misdeployment of the feature? Given the example above, users might hardcode this generated IP address as a default gateway in their configs on other hosts. This is actually a very common thing to do. > (Feel free to smack this line of argumentation down if you disagree. I > just thought it should be a bit more thoroughly explored.) I haven't investigated recent research into breakage of SHA1, I mostly remember the chosen-image and collision attacks against it. Given the particular usage of SHA1 in this case, do you think switching the hashing function increases security? I am asking because of the desire to decrease the instruction size of the kernel, but adding a switch will actually increase the size in the foreseeable future (and I agree with Toke that offloading this decision to distributions is probably not fair). Maybe at some point the networking subsystem will adapt a generic knob like LD_ASSUME_KERNEL? ;) Bye, Hannes