[lkml]   [2010]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH RFC] Restrictions on module loading
On Sun, Nov 07, 2010 at 08:23:59PM -0500, Dan Rosenberg wrote:
> A significant portion of kernel vulnerabilities do not affect core code,
> but rather individual modules. Unfortunately, there is no global kernel
> setting to restrict unprivileged users from triggering the automatic
> loading of kernel modules, for example by creating a socket using a
> packet family that is compiled as a module and not already loaded. On
> most distributions, this creates a significant attack surface, and
> requires maintenance of blacklists and other inelegant solutions to a
> general problem.
> The below patch replaces the existing "modules_disable" sysctl with a
> finer-grained "modules_restrict" sysctl. By default, this is set at 0,
> which results in no deviation from normal module loading behavior. When
> set to 1, unprivileged users cannot trigger the automatic loading of
> modules. This behavior is based on grsecurity's GRKERNSEC_MODHARDEN
> setting. The current check is against current_uid(), since several
> distributions explicitly remove CAP_SYS_MODULE from root processes, some
> of which incidentally cause (and rely on) the automatic loading of
> modules. I expect this to be a point of discussion.
> When set to 2, modules may not be loaded or unloaded by anyone, and the
> sysctl may not be changed from that point forward. This is designed to
> provide protection against kernel module rootkits.
> Signed-off-by: Dan Rosenberg <>

Acked-by: Kees Cook <>

This looks great to me. There will be a small amount of pain for people
that are already using modules_disabled=1, but I think the audience is so
small that it won't be a problem to switch to modules_restrict=2.


Kees Cook
Ubuntu Security Team

 \ /
  Last update: 2010-11-08 06:17    [W:0.330 / U:2.604 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site