From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932834AbdK2OuU (ORCPT ); Wed, 29 Nov 2017 09:50:20 -0500 Received: from shards.monkeyblade.net ([184.105.139.130]:58924 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753339AbdK2OuS (ORCPT ); Wed, 29 Nov 2017 09:50:18 -0500 Date: Wed, 29 Nov 2017 09:50:14 -0500 (EST) Message-Id: <20171129.095014.1909386937628805919.davem@davemloft.net> To: gnomes@lxorguk.ukuu.org.uk Cc: keescook@chromium.org, mcgrof@kernel.org, tixxdz@gmail.com, luto@kernel.org, akpm@linux-foundation.org, james.l.morris@oracle.com, ben.hutchings@codethink.co.uk, solar@openwall.com, serge@hallyn.com, jeyu@kernel.org, rusty@rustcorp.com.au, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, kernel-hardening@lists.openwall.com, corbet@lwn.net, mingo@kernel.org, netdev@vger.kernel.org, peterz@infradead.org, torvalds@linux-foundation.org Subject: Re: [PATCH v5 next 1/5] modules:capabilities: add request_module_cap() From: David Miller In-Reply-To: <20171129134612.72ccb53d@alans-desktop> References: <20171128211659.GP729@wotan.suse.de> <20171129134612.72ccb53d@alans-desktop> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Wed, 29 Nov 2017 06:50:17 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alan Cox Date: Wed, 29 Nov 2017 13:46:12 +0000 > I really don't care what the module loading rules end up with and > whether we add CAP_SYS_YET_ANOTHER_MEANINGLESS_FLAG but what is > actually needed is to properly incorporate it into securiy ruiles > for whatever LSM you are using. I'm surprised we're not using the SHA1 hashes or whatever we compute for the modules to make sure we are loading the foo.ko that we expect to be. Then even if someone can rename every file on the system they cannot force a rogue module to load unless they build one with a proper hash collision. Ie. transform module load strings at build time: ppp.ko --> ppp.ko:SHA1 Or something like that. And the kernel refuses to load a ppp.ko with a mismatching SHA1. All of this capability stuff seems to dance a circle around the problem rather than fix it. From mboxrd@z Thu Jan 1 00:00:00 1970 From: davem@davemloft.net (David Miller) Date: Wed, 29 Nov 2017 09:50:14 -0500 (EST) Subject: [PATCH v5 next 1/5] modules:capabilities: add request_module_cap() In-Reply-To: <20171129134612.72ccb53d@alans-desktop> References: <20171128211659.GP729@wotan.suse.de> <20171129134612.72ccb53d@alans-desktop> Message-ID: <20171129.095014.1909386937628805919.davem@davemloft.net> To: linux-security-module@vger.kernel.org List-Id: linux-security-module.vger.kernel.org From: Alan Cox Date: Wed, 29 Nov 2017 13:46:12 +0000 > I really don't care what the module loading rules end up with and > whether we add CAP_SYS_YET_ANOTHER_MEANINGLESS_FLAG but what is > actually needed is to properly incorporate it into securiy ruiles > for whatever LSM you are using. I'm surprised we're not using the SHA1 hashes or whatever we compute for the modules to make sure we are loading the foo.ko that we expect to be. Then even if someone can rename every file on the system they cannot force a rogue module to load unless they build one with a proper hash collision. Ie. transform module load strings at build time: ppp.ko --> ppp.ko:SHA1 Or something like that. And the kernel refuses to load a ppp.ko with a mismatching SHA1. All of this capability stuff seems to dance a circle around the problem rather than fix it. -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Wed, 29 Nov 2017 09:50:14 -0500 (EST) Message-Id: <20171129.095014.1909386937628805919.davem@davemloft.net> From: David Miller In-Reply-To: <20171129134612.72ccb53d@alans-desktop> References: <20171128211659.GP729@wotan.suse.de> <20171129134612.72ccb53d@alans-desktop> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: [kernel-hardening] Re: [PATCH v5 next 1/5] modules:capabilities: add request_module_cap() To: gnomes@lxorguk.ukuu.org.uk Cc: keescook@chromium.org, mcgrof@kernel.org, tixxdz@gmail.com, luto@kernel.org, akpm@linux-foundation.org, james.l.morris@oracle.com, ben.hutchings@codethink.co.uk, solar@openwall.com, serge@hallyn.com, jeyu@kernel.org, rusty@rustcorp.com.au, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, kernel-hardening@lists.openwall.com, corbet@lwn.net, mingo@kernel.org, netdev@vger.kernel.org, peterz@infradead.org, torvalds@linux-foundation.org List-ID: From: Alan Cox Date: Wed, 29 Nov 2017 13:46:12 +0000 > I really don't care what the module loading rules end up with and > whether we add CAP_SYS_YET_ANOTHER_MEANINGLESS_FLAG but what is > actually needed is to properly incorporate it into securiy ruiles > for whatever LSM you are using. I'm surprised we're not using the SHA1 hashes or whatever we compute for the modules to make sure we are loading the foo.ko that we expect to be. Then even if someone can rename every file on the system they cannot force a rogue module to load unless they build one with a proper hash collision. Ie. transform module load strings at build time: ppp.ko --> ppp.ko:SHA1 Or something like that. And the kernel refuses to load a ppp.ko with a mismatching SHA1. All of this capability stuff seems to dance a circle around the problem rather than fix it.