Query Details
// RID Hijacking Technique and Detection // https://asec.ahnlab.com/en/85942/ let EPwithNewLocalAccount = DeviceEvents | where Timestamp > ago(1h) | where ActionType == "UserAccountCreated" and AccountName has "$" | distinct DeviceName; DeviceRegistryEvents | where RegistryKey has "HKEY_LOCAL_MACHINE\\SAM\\SAM\\Domains\\Account\\Users" | where DeviceName has_any(EPwithNewLocalAccount)
This KQL (Kusto Query Language) query is designed to detect a potential security threat known as RID Hijacking. Here's a simple breakdown of what the query does:
Identify New Local Accounts:
Timestamp > ago(1h)) to find instances where a new user account has been created (ActionType == "UserAccountCreated").AccountName has "$"), which is often used in system accounts or hidden accounts.DeviceName) where these new accounts were created.Check Registry for Suspicious Activity:
HKEY_LOCAL_MACHINE\\SAM\\SAM\\Domains\\Account\\Users).DeviceName has_any(EPwithNewLocalAccount).In summary, this query is looking for devices where new, potentially suspicious local accounts have been created and then checks if there have been any registry changes on those devices that could indicate RID Hijacking, a technique used by attackers to escalate privileges.

Steven Lim
Released: January 26, 2025
Tables
Keywords
Operators