Credential Access (TA0006)(external, opens in a new tab or window)
text code block:authentication where host.os.type == "windows" and event.code in ("4624", "4625") and winlog.logon.type == "Network" and winlog.event_data.AuthenticationPackageName == "NTLM" and endswith~(user.name, "$") and user.name != "$" and source.ip != null and source.ip != "::1" and source.ip != "127.0.0.1" and /* Filter for a machine account that matches the hostname */ startswith~(host.name, substring(user.name, 0, -1)) and /* Verify the machine account matches the full hostname, not just a prefix substring */ (startswith~(substring(user.name, 0, -1), host.name) or startswith~(host.name, concat(substring(user.name, 0, -1), "."))) and /* Verify if the Source IP belongs to the host */ not endswith(string(source.ip), string(host.ip)) and indexOf(string(host.ip), string(source.ip)) == null
Install detection rules in Elastic Security
Detect Potential Computer Account NTLM Relay 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(external, opens in a new tab or window).