sequence by host.id, process.pid with maxspan=1s
[process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
process.name != null and process.thread.capabilities.effective : ("CAP_CHOWN", "CAP_FOWNER") and
process.command_line : ("*sudoers*", "*passwd*", "*shadow*", "*/root/*") and user.id != "0"]
[file where host.os.type == "linux" and event.action == "changed-file-ownership-of" and event.type == "change" and
event.outcome == "success" and file.path in (
"/etc/passwd",
"/etc/shadow",
"/etc/sudoers",
"/root/.ssh/*"
) and user.id != "0"
]
Install detection rules in Elastic Security
Detect Privilege Escalation via CAP_CHOWN/CAP_FOWNER Capabilities 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).