Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp203822iob; Mon, 2 May 2022 17:07:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyehfMaee72TrR5kpQCbUB8SZFe023PO4G3dQdqUNYJLObjq/MnMCs8YqaL0Lupw+WGhAL2 X-Received: by 2002:a17:90b:1e49:b0:1dc:81d9:2d97 with SMTP id pi9-20020a17090b1e4900b001dc81d92d97mr408130pjb.221.1651536471934; Mon, 02 May 2022 17:07:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651536471; cv=none; d=google.com; s=arc-20160816; b=RaxoUgkXMCv2fMkWg2h8rD2d0i6E0iHge2a/5scqCgI8vA4lV/7qS9WTIeIzas09/3 apLTZ9SkOE8ZaLCc3GhlE05u1iiCic5mkQD0TqjlCL+G0eQ4mIwpa83S9w9RmiUIucwC uD4WOHFz2qRfkNqUBoDbaLJEGI9/OInAHeCLa5wtM7gD8V5TpjtPH7FMOZQ7ouUTIS36 CIj1a4ZEUr2T1imhpePpULpDzoVMgMtRFiZ7fjuqnVToMKZRHsYVBITisWpnfofGDRbg E81xypScvGDkPdoiBgV7SOx3qCILzSKLWDxsr/RNhQF8MTRCB8OHUJh1mhuklAxIJCOH fYZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=nNObXm8eZPOKR1gMvUkxAJ0vd4VlAABOO7mBK5Xrdtw=; b=CWtumOBSYqECidF6vP2a038jmEu7guxAr/GOy7hMs1+o2jSkT8WB4mrOnpoEfRY46v 1D6TunpqynRtwTUO+NkawcpVkbDmj5WRmfgkiRcWEHaergWnurINikWv9aFZNo3PYT6d yy6QeJqUJ0aHXb6DPS/DCn4LBll4Zm7pn8sjgaez5Wk5KrYa65yzB4yDAmEoOGnV5Opw 44NBCCM7PewxuctqXOXR5rr/EKg4sbw0rAtjiB/J+wHiEGR6Jf7dG6F2kS2bYYvZKnbw 4ze+1zd+pt9BFTCG3qcOwSoeUuHpLAmJZL8Xnuy2eIb9Y6Fe25qwikqGOiv0z5QvMRXs AWSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g11-20020a656ccb000000b003816043f089si16133199pgw.638.2022.05.02.17.07.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 17:07:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A3EB626CD; Mon, 2 May 2022 17:07:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235921AbiEAAx7 (ORCPT + 99 others); Sat, 30 Apr 2022 20:53:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232966AbiEAAxv (ORCPT ); Sat, 30 Apr 2022 20:53:51 -0400 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AF2D63E7; Sat, 30 Apr 2022 17:50:25 -0700 (PDT) Received: from penguin.thunk.org (rrcs-69-75-72-162.west.biz.rr.com [69.75.72.162]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 2410nvLC001587 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 30 Apr 2022 20:49:59 -0400 Received: by penguin.thunk.org (Postfix, from userid 1000) id B068E3D5B5; Sat, 30 Apr 2022 20:49:55 -0400 (EDT) Date: Sat, 30 Apr 2022 17:49:55 -0700 From: tytso To: "Jason A. Donenfeld" Cc: nadiah@cs.ucsd.edu, noahsd@gmail.com, dodis@cs.nyu.edu, tessaro@cs.washington.edu, torvalds@linux-foundation.org, djb@cr.yp.to, jeanphilippe.aumasson@gmail.com, jann@thejh.net, keescook@chromium.org, gregkh@linuxfoundation.org, peter@cryptojedi.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: is "premature next" a real world rng concern, or just an academic exercise? Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=1.5 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Spam-Level: * On Wed, Apr 27, 2022 at 03:58:51PM +0200, Jason A. Donenfeld wrote: > > 3) More broadly speaking, what kernel infoleak is actually acceptable to > the degree that anybody would feel okay in the first place about the > system continuing to run after it's been compromised? A one-time kernel infoleak where this might seem most likely is one where memory is read while the system is suspended/hibernated, or if you have a VM which is frozen and then replicated. A related version is one where a VM is getting migrated from one host to another, and the attacker is able to grab the system memory from the source "host" after the VM is migrated to the destination "host". Merely reseeding the CRNG from the input pool isn't going to help, since the attacker could have grabed not only the CRNG pool, but the input pool as well. In the case where the guest image is "freeze dried" and then reconstituted multiple times, and where the attacker hasn't actually grabed state, then all you need to do is to mix in some kind of nonce, such as the current time (which hopefully will vary across different VM "reconstitutions"), or some kind none (for example the VM ID, if that can be obtained somehow). But if the attacker can actually obtain internal state from one reconstituted VM, and use that to attack another reconstituted VM, and the attacker also knows what the nonce or time seed that was used so that different reconstituted VMs will have unique CRNG streams, this might be a place where the "premature next" attack might come into play. The simplest mitigation is if you have some kind of external RNG which you can actually trust, or at least mostly trust. e.g., either some kind of CPU-based hwrng, such as RDRAND, or a hypervisor-provided hwrng, such as Virtio-RNG. And if the hypervisor is going to playing games with reconstituting freeze-dried VM's, I'd argue it can d*mned well provide a virtio-rng facility. And the same argument could be made just as easily with live migration scenario, with the hypervisor providing some kind of notification that VM had just gotten live migrated, so it should really reseed from the virtio-rng facility right away. That leaves the variant where the kernel infoleak happened while the system was suspended. And in that case, we're talking about an attacker which had physical access to the machine (say, an "evil maid" attack while the laptop was left suspended in a hotel room in Moscow or Beijing). And in that case, there are probably far simpler ways that an "evil amid" with temporary physical access to the hardware could compromise the secuity of the unattended laptop. > Is "premature next" just an academic exercise, rather than a real world > RNG concern? I'd say it's mostly an academic exercise. Given our current model, where we only reseed the CRNG periodically, and we're hopefully getting some amount of uncertainty into the input pool, there will be a certain amount of "catastrophic reseeding" going on, which I don't think is a bad thing. But personally, I don't think the complexity of N levels of Fortuna pools are worth it. - Ted