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).