From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965695AbdKQIz4 (ORCPT ); Fri, 17 Nov 2017 03:55:56 -0500 Received: from lhrrgout.huawei.com ([194.213.3.17]:44580 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751322AbdKQIzr (ORCPT ); Fri, 17 Nov 2017 03:55:47 -0500 Subject: Re: [PATCH v2 00/15] ima: digest list feature To: Kees Cook CC: Mimi Zohar , , linux-security-module , "linux-fsdevel@vger.kernel.org" , , LKML , References: <20171107103710.10883-1-roberto.sassu@huawei.com> <1510061855.3425.113.camel@linux.vnet.ibm.com> From: Roberto Sassu Message-ID: Date: Fri, 17 Nov 2017 09:55:29 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Originating-IP: [10.220.96.228] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/17/2017 2:08 AM, Kees Cook wrote: > On Tue, Nov 7, 2017 at 8:45 AM, Roberto Sassu wrote: >> On 11/7/2017 2:37 PM, Mimi Zohar wrote: >>> Normally, the protection of kernel memory is out of scope for IMA. >>> This patch set introduces an in kernel white list, which would be a >>> prime target for attackers looking for ways of by-passing IMA- >>> measurement, IMA-appraisal and IMA-audit. Others might disagree, but >>> from my perspective, this risk is too high. > > BTW, which part of the series does the whitelist? I'd agree generally, > though: we don't want to make things writable if they're normally > read-only. Patch 5/15 introduces the hash table ima_digests_htable and the functions to add/search file digests Patches 6-7-8/15 add file digests to ima_digests_htable Patch 10/15 searches file digests in ima_digests_htable Original files containing digest lists are discarded after being parsed. >> It would be much easier for an attacker to just set ima_policy_flag to >> zero. > > That's a fair point. I wonder if ima_policy_flag could be marked > __ro_after_init? Most of the writes are from __init sections, but I > haven't looked closely at when ima_update_policy() gets called. Unfortunately not. New policies can be loaded by writing to a file in the securityfs filesystem. They could enable different actions (measurement/appraisal/audit). Roberto -- HUAWEI TECHNOLOGIES Duesseldorf GmbH, HRB 56063 Managing Director: Bo PENG, Qiuen PENG, Shengli WANG