Re: [PATCH v5 next 1/5] modules:capabilities: add request_module_cap()
From: David Miller
Date: Wed Nov 29 2017 - 09:50:24 EST
From: Alan Cox <gnomes@xxxxxxxxxxxxxxxxxxx>
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.