Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1pcHXj-0000E6-VA for mharc-grub-devel@gnu.org; Tue, 14 Mar 2023 23:11:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pcHXj-0000Du-59 for grub-devel@gnu.org; Tue, 14 Mar 2023 23:11:11 -0400 Received: from mail-qv1-xf31.google.com ([2607:f8b0:4864:20::f31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pcHXh-00032E-GV for grub-devel@gnu.org; Tue, 14 Mar 2023 23:11:10 -0400 Received: by mail-qv1-xf31.google.com with SMTP id op8so14628336qvb.11 for ; Tue, 14 Mar 2023 20:11:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20210112.gappssmtp.com; s=20210112; t=1678849868; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=NfiuPaXqKtQc4bmJBqi9dig23cFvFEkyBtt8f1epclc=; b=H1ZVPn9Bq2ir54+Wktr3fRul5ogvGJe8/R2UoGDDk+oAVgzHubJ3cuI62XWcrefWFE 1hN4eqmCP2l7qLIhTpLyZ0y/dAfitUD8eUTZJ88yhGeWCI8MYjKJ7Zw9VriphkeVXA3U A1tc2TepEdgqpzRw4J+jurzVDTSCXbIWN2sAA5yJ5XcCv1K+ORz7VL+ZwujjYU2WYJBF UJVcsvOHCtvJ53Khx4t8k9TSx9Bd2mEj+ZcomlemkhR5JPpMADNc6pekUzf079S1gfwS vqjOllKApRh/2NdMckKLD2uym0zgU251zUx/Pt9Vpyk82Skv6SlRDzI3nErIUSdtJT46 TWqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678849868; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NfiuPaXqKtQc4bmJBqi9dig23cFvFEkyBtt8f1epclc=; b=6qpS1xE/nbyVSFuNYKsdc/Aq2Gq9hZY0pU9ZNF3QbmXYoVWuxOxU6EeQ8B8C6WkP6S HXAtsr84Ca4cm/bZto3FzuZK3PonbI1+evBdUlPHJeTMZuOlTU2svqZnw30o49osEILZ JvhOhG2CZOTa+GaDARdW4jRTm5I6BQqqzyJnmVP9TqKxLkJtMI5VSSHsxPo2bOauJdPN P8ivGh+MwAumTjmGVJD6GsTgCZsiye5TD0edUHJXwk94e+Th8PwOlb1pxoL8hlVvbNSM W8kTBhEXyrtahuiT36hDtZEDSYZlaNFk1FbJA/f9XemhU7FrmfrYddbuXAA7qc3aEkPA ZmrA== X-Gm-Message-State: AO0yUKXGujZODJWWvqnAMxgDi4+rImxAj6bFipKDyIhH6j0k0ZRLNKEF U1dJeCPZQw5C45icMlJk6L72RQ== X-Google-Smtp-Source: AK7set8yHI+ELkhLfnvzzSq/WM3QjAcAdOWCSDM90VyIWUh6Vp/bJujpyaP4e4LrgJ7+KNqfGM2zfw== X-Received: by 2002:ac8:5b93:0:b0:3bf:d179:f964 with SMTP id a19-20020ac85b93000000b003bfd179f964mr38196134qta.34.1678849868064; Tue, 14 Mar 2023 20:11:08 -0700 (PDT) Received: from [10.41.0.171] ([37.218.244.251]) by smtp.gmail.com with ESMTPSA id d78-20020a376851000000b0074571b64f0fsm2931893qkc.53.2023.03.14.20.11.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Mar 2023 20:11:07 -0700 (PDT) Message-ID: Date: Wed, 15 Mar 2023 03:11:05 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [RFC PATCH] gdb: Add more support for debugging on EFI platforms Content-Language: en-US To: Daniel Kiper , Peter Jones Cc: Robbie Harwood , grub-devel@gnu.org References: <20230227213526.2379718-1-development@efficientek.com> <26ffb698-9dc5-405c-b916-5a84218f0fd2@uncooperative.org> <20230313122721.6tnkx4zmvxlwqr4e@tomti.i.net-space.pl> From: Glenn Washburn In-Reply-To: <20230313122721.6tnkx4zmvxlwqr4e@tomti.i.net-space.pl> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::f31; envelope-from=development@efficientek.com; helo=mail-qv1-xf31.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Mar 2023 03:11:11 -0000 On 3/13/23 12:27, Daniel Kiper wrote: > On Fri, Mar 10, 2023 at 03:27:13PM -0500, Peter Jones wrote: >> On Thu, Mar 09, 2023 at 06:00:04PM -0500, Robbie Harwood wrote: >>> Glenn Washburn writes: >>>> 2. Why should the load command not be printed when secure boot is enabled? >>>> * This was also requested by Daniel, I assume because of infomation leakage >>>> that may be a security concern. >>> >>> I seem to have also missed Daniel's reply about this earlier, which was: >>> >>>>> I think leaking info about the GRUB image addresses on the Secure >>>>> Boot enabled systems is not the best idea. Or do you think having >>>>> this feature enabled by default overweight potential dangers coming >>>>> from its misuse? >>> >>> I don't know how these could help an attacker. They'd need access to >>> console out to retrieve the values, and some way to send input... and >>> that's basically physical presence: at the very least, if they have >>> those, I imagine they'd just edit the menu entries, or drop to the grub >>> shell. >> >> I'd like to also point out that we currently don't have anything like >> ASLR in the pre-boot space, nor much hope of meaningfully getting it, >> and typically have an identity memory mapped. So, a serious attacker >> can take a workflow like: >> >> 1) make a rough guess what kind of system they're attacking - vendor, >> product line, minimum memory size, etc. >> 2) get two or three similar machines on ebay >> 3) build a certificate chain that's got the exact same topology and cert >> sizes as the real one >> 4) enroll that the normal way >> 5) rebuild the grub binary with the "should we print this line" test >> inverted, so it's literally 1 bit different (i.e. jz -> jnz) >> 6) sign it >> 7) watch the load patterns on each of those machines and build a pretty >> simple model for candidate addresses >> 8) try them all when trying to exploit whatever bug they've found, >> either on individual attempts or possibly multiple at once if >> they're clever >> >> If they're also using the shotgun method of identifying targets - i.e. >> they've already used some other technique to get root on a bunch of >> machines and now they're trying to escalate however many they can to >> have Secure Boot breakouts - they're going to have a fair degree of >> success with this method, and hiding the addresses will be an incredibly >> minor speed bump for them. >> >> I think worrying about exposing load addresses on the console with open >> source firmware and no ASLR is not worth the trouble. > > Good points! I was thinking about using lsefimmap to leak info about > memory usage. Of course this does not directly shows you GRUB memory > allocations but it is enough to infer them by comparison of lists of > memory regions with and without the GRUB. So, taking into account above > it looks printing the GRUB load address does not give potential attacker > much advantage and we can print the load address unconditionally. Until > I do not hear otherwise... Ok, so I'm understanding that I can move the printing of the gdb command out of the !secureboot condition and have it always print. I'm also understanding that I should not disable the gdbinfo command in lockdown mode, correct? Glenn