Security Event Admin SD Holder Modifications
Query
SecurityEvent
| where EventID == 5136 and EventData has "AdminSDHolder"
| project TimeGenerated, Computer, Account, AccountType, SubjectLogonId, Activity, OperationType, EventData
| mv-apply Auxiliar = parse_xml(EventData)["EventData"]["Data"] on (
summarize BagToUnpack = make_bag(bag_pack(tostring(Auxiliar["@Name"]), tostring(Auxiliar["#text"])))
)
| evaluate bag_unpack(BagToUnpack, OutputColumnPrefix = "EventData_", columnsConflict="keep_source")
| project-reorder
TimeGenerated,
Computer,
Account,
AccountType,
SubjectLogonId,
Activity,
OperationType,
EventData,
EventData_*Explanation
This KQL (Kusto Query Language) query is designed to analyze security events related to changes in the "AdminSDHolder" object, which is a special security descriptor in Active Directory. Here's a simplified breakdown of what the query does:
-
Filter Events: It starts by filtering the
SecurityEventtable to only include events with anEventIDof 5136, which typically indicates a directory service change, and where theEventDatacontains the term "AdminSDHolder". -
Select Columns: It selects specific columns to display:
TimeGenerated,Computer,Account,AccountType,SubjectLogonId,Activity,OperationType, andEventData. -
Parse XML Data: The query uses
mv-applyto parse theEventDatafield, which is in XML format. It extracts the data within the<Data>tags and creates a key-value pair (a "bag") for each piece of data. -
Unpack Data: It then uses
evaluate bag_unpackto expand these key-value pairs into separate columns, prefixing them with "EventData_". This step helps in making the data more accessible and easier to analyze. -
Reorder Columns: Finally, it reorders the columns to ensure that the original selected columns are followed by the newly unpacked
EventData_columns.
In summary, this query is extracting and organizing detailed information about changes to the AdminSDHolder object from security events, making it easier to analyze specific changes and their context.