Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1iNe0t-0001s7-J1 for mharc-grub-devel@gnu.org; Thu, 24 Oct 2019 10:22:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38012) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNe0p-0001gj-BV for grub-devel@gnu.org; Thu, 24 Oct 2019 10:22:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNe0m-00071Y-RX for grub-devel@gnu.org; Thu, 24 Oct 2019 10:22:49 -0400 Received: from smtpsal1.cc.upv.es ([158.42.249.61]:47786 helo=smtpsalv.upv.es) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNe0m-0006zY-9i for grub-devel@gnu.org; Thu, 24 Oct 2019 10:22:48 -0400 Received: from smtpx.upv.es (smtpxv.cc.upv.es [158.42.249.46]) by smtpsalv.upv.es (8.14.7/8.14.7) with ESMTP id x9OEMjQ1013254 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 24 Oct 2019 16:22:45 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upv.es; s=default; t=1571926965; bh=ovAfbs8PkAVJLx8qV0mo6QbrJzJ/o2cBPE9zr/9L/FE=; h=Subject:From:To:Cc:References:Date:In-Reply-To:From; b=ki7H0g+KPj2gI+OrykEt1UUxLOL5umizRQuyHIhi7i/9L+MAZ/AAZ8D472biX4QDe WpY1TILKN2fA9tH4E0py2XEEJu408JgW0cKXNjg+jXqYh5aCozn+hmWHXWsBiIVsj9 7lyCHDdKRInzrToJqZTdvpvBWUNoHX2tVA6frnNYkU2RcYPMgW4hvLR2KYyGmj3BY2 qvPTwSiVVVksjVtSwVA79D0ks33g/83DwQV8E0N7XrgmnmWdPt3kV8KUlK+5CsbQmJ LhB4rb9Tc/LG3ZaKEUXEL20AcZ676HLLdG63ZCgt1gUPNNHzBIjzDamAO0uewy9BDD B8Q14kBULq6QA== Received: from smtp.upv.es (smtpv.cc.upv.es [158.42.249.16]) by smtpx.upv.es (8.14.7/8.14.7) with ESMTP id x9OEMjLa027631; Thu, 24 Oct 2019 16:22:45 +0200 Received: from [10.16.13.226] ([146.191.95.1]) (authenticated bits=0) by smtp.upv.es (8.14.7/8.14.7) with ESMTP id x9OEMhSF000624 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Oct 2019 16:22:44 +0200 Subject: Re: [PATCH] Fix security issue when reading username and password From: Hector Marco To: Daniel Kiper Cc: Javier Martinez Canillas , grub-devel@gnu.org, Ismael Ripoll-Ripoll References: <20191018123901.13945-1-javierm@redhat.com> <20191023101406.yrrlihinqlblkmyx@tomti.i.net-space.pl> <183c3cc5-cf99-ceae-49d7-a80834495221@upv.es> Openpgp: preference=signencrypt Message-ID: Date: Thu, 24 Oct 2019 15:22:43 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <183c3cc5-cf99-ceae-49d7-a80834495221@upv.es> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 158.42.249.61 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 14:22:53 -0000 Hello Daniel, Something went wrong in my last email, what I wanted to say is: The patch prevents that "cur_len" underflows. No negative values for "cur_len" so no way to underflow the "cur_len" variable and therefore no vulnerability. Hector. On 24/10/2019 15:13, Hector Marco wrote: > Hello Daniel, > > The patch prevents that "cur_len" underflows. No negative values for > "cur_len" so way to underflow the "cur_len" variable and therefore > > I hope this helps, > > Hector. > > > > On 23/10/2019 11:14, Daniel Kiper wrote: >> On Fri, Oct 18, 2019 at 02:39:01PM +0200, Javier Martinez Canillas wrote: >>> From: Hector Marco-Gisbert >>> >>> This patch fixes two integer underflows at: >>> * grub-core/lib/crypto.c >>> * grub-core/normal/auth.c >>> >>> Resolves: CVE-2015-8370 >>> >>> Signed-off-by: Hector Marco-Gisbert >>> Signed-off-by: Ismael Ripoll-Ripoll >>> Signed-off-by: Javier Martinez Canillas >>> --- >>> >>> grub-core/lib/crypto.c | 2 +- >>> grub-core/normal/auth.c | 2 +- >>> 2 files changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c >>> index ca334d5a40e..e6c78d16d39 100644 >>> --- a/grub-core/lib/crypto.c >>> +++ b/grub-core/lib/crypto.c >>> @@ -468,7 +468,7 @@ grub_password_get (char buf[], unsigned buf_size) >>> break; >>> } >>> >>> - if (key == '\b') >>> + if (key == '\b' && cur_len) >>> { >>> if (cur_len) >>> cur_len--; >>> diff --git a/grub-core/normal/auth.c b/grub-core/normal/auth.c >>> index 6be678c0de1..c35ce972473 100644 >>> --- a/grub-core/normal/auth.c >>> +++ b/grub-core/normal/auth.c >>> @@ -172,7 +172,7 @@ grub_username_get (char buf[], unsigned buf_size) >>> break; >>> } >>> >>> - if (key == GRUB_TERM_BACKSPACE) >>> + if (key == GRUB_TERM_BACKSPACE && cur_len) >>> { >>> if (cur_len) >>> { >> >> TBH, I do not understand how this patch helps. It only delays continue >> execution to the next "if (!grub_isprint (key))" if cur_len == 0. >> >> Daniel >> >