Privilege Escalation (TA0004)(external, opens in a new tab or window)
text code block:file where host.os.type in ("linux", "macos") and event.type in ("creation", "change") and file.path like ("/etc/sudoers*", "/private/etc/sudoers*") and not ( process.name in ("dpkg", "platform-python", "puppet", "yum", "dnf") or process.executable in ("/opt/chef/embedded/bin/ruby", "/opt/puppetlabs/puppet/bin/ruby", "/usr/bin/dockerd") )
Install detection rules in Elastic Security
Detect Sudoers File Modification 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).