Suspicious Kernel Feature Activity

Last updated 15 days ago on 2025-04-29
Created 15 days ago on 2025-04-29

About

This rule detects the modification and reading of kernel features through built-in commands. Attackers may collect information, disable or weaken Linux kernel protections. For example, an attacker may modify ASLR protection by disabling kernel.randomize_va_space, allow ptrace by setting kernel.yama.ptrace_scope to 0, or disable the NMI watchdog by setting kernel.nmi_watchdog to 0. These changes may be used to impair defenses and evade detection.
Tags
Domain: EndpointOS: LinuxUse Case: Threat DetectionTactic: Defense EvasionTactic: DiscoveryData Source: Elastic DefendLanguage: eql
Severity
low
Risk Score
21
MITRE ATT&CK™

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

Discovery (TA0007)(opens in a new tab or window)

License
Elastic License v2(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(opens in a new tab or window)

Query
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
process.command_line : (
  "*/etc/sysctl.conf*", "*/etc/sysctl.d/*", "*/proc/sys/kernel/nmi_watchdog*",
  "*/proc/sys/vm/nr_hugepages*", "*/proc/sys/kernel/yama/ptrace_scope*",
  "*/proc/sys/kernel/randomize_va_space*", "*/proc/sys/vm/drop_caches*",
  "*/proc/sys/kernel/sysrq*", "*grsecurity*", "*exec-shield*",
  "*kernel.randomize_va_space*", "*kernel.yama.ptrace_scope*",
  "*kernel.nmi_watchdog*", "*vm.nr_hugepages*", "*vm.drop_caches*",
  "*kernel.sysrq*"
) and
process.parent.executable != null and 
(
  (process.name == "tee" and process.args like "-*a*") or // also detects --append
  (process.name == "cat" and not process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish")) or
  (process.name == "grep" and process.args_count == 3 and not process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish")) or
  (process.name == "sysctl" and process.args like ("*-w*", "*--write*", "*=*")) or
  (process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and process.args == "-c" and process.args : "*echo *")
)

Install detection rules in Elastic Security

Detect Suspicious Kernel Feature Activity 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(opens in a new tab or window).