Information
Monitor the loading and unloading of kernel modules. All the loading / listing / dependency checking of modules is done by kmod via symbolic links.
The following system calls control loading and unloading of modules:
- create_module - create a loadable module entry
- query_module - query the kernel for various bits pertaining to modules
Any execution of the loading and unloading module programs and system calls will trigger an audit record with an identifier of modules
Monitoring the use of all the various ways to manipulate kernel modules could provide system administrators with evidence that an unauthorized change was made to a kernel module, possibly compromising the security of the system.
Satisfies: SRG-OS-000062-GPOS-00031, SRG-OS-000037-GPOS-00015, SRG-OS-000042-GPOS-00020, SRG-OS-000062-GPOS-00031, SRG-OS-000392-GPOS-00172, SRG-OS-000462-GPOS-00206, SRG-OS-000471-GPOS-00215, SRG-OS-000471-GPOS-00216, SRG-OS-000477-GPOS-00222
Solution
Note:
- The -w option is deprecated and the rule should be updated in accordance with the Remediation Procedure.
- For best performance, the arch field should be supplied in the rule. The individual permissions will cause the selection of specific system calls that use that kind of access. Not supplying the arch will cause the selection of all system calls which will affect performance as all system calls will be evaluated.
- Edit or create a file in the /etc/audit/rules.d/ directory, ending inrules extension, with the relevant rules to monitor kernel module modification.
Example:
# printf "
-a always,exit -F arch=b64 -S create_module,query_module -F auid>=1000 -F auid!=unset -k kernel_modules
" >> /etc/audit/rules.d/50-kernel_modules.rules
Note : The auid>= value should be set to the same value as UID_MIN value in /etc/login.defs
<xhtml:ol start="2"> - Merge and load the rules into active configuration:
# augenrules --load <xhtml:ol start="3"> - Check if reboot is required:
# if [[ $(auditctl -s | grep "enabled") =~ "2" ]]; then printf "Reboot required to load rules\n"; fi