Kernel Module Load from Unusual Location

Last updated 5 days ago on 2026-02-20
Created 5 days ago on 2026-02-20

About

This rule detects the loading of a kernel module from an unusual location. Threat actors may use this technique to maintain persistence on a system by loading a kernel module into the kernel namespace. This behavior is strongly related to the presence of a rootkit on the system.
Tags
Domain: EndpointOS: LinuxUse Case: Threat DetectionTactic: PersistenceTactic: Defense EvasionThreat: RootkitData Source: Elastic DefendLanguage: eql
Severity
high
Risk Score
73
MITRE ATT&CK™

Persistence (TA0003)(external, opens in a new tab or window)

Defense Evasion (TA0005)(external, opens in a new tab or window)

License
Elastic License v2(external, opens in a new tab or window)

Definition

Rule Type
Event Correlation Rule
Integration Pack
Prebuilt Security Detection Rules
Index Patterns
logs-endpoint.events.process*
Related Integrations

endpoint(external, opens in a new tab or window)

Query
text code block:
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and ( (process.name == "kmod" and process.args == "insmod" and process.args like~ "*.ko*") or (process.name == "kmod" and process.args == "modprobe" and not process.args in ("-r", "--remove")) or (process.name == "insmod" and process.args like~ "*.ko*") or (process.name == "modprobe" and not process.args in ("-r", "--remove")) ) and ( process.working_directory like ( "/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/*", "/var/run/*", "/home/*/*", "/root/*", "/var/www/*", "/boot/*", "/srv/*", "/mnt/*" ) or process.parent.working_directory like ( "/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/*", "/var/run/*", "/home/*/*", "/root/*", "/var/www/*", "/boot/*", "/srv/*", "/mnt/*" ) or process.args like ( "/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/*", "/var/run/*", "/home/*/*", "/root/*", "/var/www/*", "/boot/*", "/srv/*", "/mnt/*", "./*" ) ) and not ( process.parent.executable == "/usr/bin/podman" or process.working_directory like "/tmp/newroot" )

Install detection rules in Elastic Security

Detect Kernel Module Load from Unusual Location in the Elastic Security detection engine by installing this rule into your Elastic Stack.

To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).