file where event.code == "5145" and endswith(user.name, "$") and
/* compare computername with user.name and make sure they match */
startswith~(winlog.computer_name, substring(user.name, 0, -1)) and
/* exclude local access */
not endswith(string(source.ip), string(host.ip)) and
source.ip != "::" and source.ip != null and source.ip != "::1" and source.ip != "127.0.0.1"
Install detection rules in Elastic Security
Detect Potential Machine Account Relay Attack via SMB 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).