有两种方法保护您的系统免受 LKM 伤害, 主动防护和被动防护. 检测工作可能是简单和轻松的, 或是麻烦和繁重的, 这和采取的方法有关.
The advantage of this kind of defense is that it prevents damage to the system in the first place. One such strategy is getting there first, that is, loading an LKM designed to protect the system from other malicious LKMs. A second strategy is to remove capabilities from the kernel itself. For example, you can remove the capability of loadable kernel modules entirely. Note, however, that there are rootkits which might work even in this case, there are some that tamper with /dev/kmem
(kernel memory) directly to make themselves undetectable.
Debian GNU/Linux 仅提供很少的软件包用于挂载一个主动防御防护:
lcap - A user friendly interface to remove
capabilities (kernel-based access control) in the kernel, making the system more secure. For example, executing
lcap CAP_SYS_MODULE
will remove module loading capabilities (even for the root user).
There is some (old) information on capabilities at Jon Corbet's
http://lwn.net/1999/1202/kernel.php3 section on LWN (dated December 1999).
如果您的 GNU/Linux 系统确实不需要那么多的内核特性, 您可能想在内核配置阶段取消可加载模块支持. 禁用可加载模块支持, 只要在构建内核的配置阶段或者在 .config
文件中设置 CONFIG_MODULES=n 就可以了. 这将能防止 LKM root-kits, 但是你也将丧失 Linux 内核的强大特性. 同时, 有时对可加载的支持是必须的, 禁用可加载模块可能会引起内核过载.
被动防护的优点是不必重载系统资源. 其通过将系统与一个已知干净系统的清单 System.map
相比较. 当然, 被动防护只能在系统被攻克以后通知管理员.
Detection of some root-kits in Debian can be accomplished with the
chkrootkit package. The
http://www.chkrootkit.org program checks for signs of several known root-kits on the target system, but is not a definitive test.