Detection rules › Kusto
Suspicious TGT Request with a DC Account
Below query detects TGT requests from a DC account with an IP that doesn't belong to a DC. It detect PetitPotam and any other attacks that uses a stolen DC certificate/account to perform operations.
If you make it a detection rule, take ingestion delay into account.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Credential Access | No specific technique |
Event coverage
| Provider | Event | Title |
|---|---|---|
| Security-Auditing | Event ID 4768 | A Kerberos authentication ticket (TGT) was requested. |
Rule body kusto
// Author : Cyb3rMonk(https://twitter.com/Cyb3rMonk, https://mergene.medium.com)
//
// Link to original post:
// https://posts.bluraven.io/detecting-petitpotam-and-other-domain-controller-account-takeovers-d3364bd9ee0a
//
// Description : This query detects if a computer account of a Domain Controller is stolen and used from a Non-DC device.
// computer account of a DC can bu used to obtain a TGT.
//
// Query parameters:
//
// list of DCs
let DCs = dynamic(["yourdc1.yourdomain.local"]);
// list of DC IPs
let DC_IPs = dynamic(["IP of the DCs including IPv6 addresses"]);
//
SecurityEvent
| where EventID == 4768
| where Computer in~ (DCs)
| where TargetUserName endswith "$"
| where DCs has replace_string(TargetUserName,"$","")
| where IpAddress <> "::1"
| extend IpAddress = replace_string(IpAddress, "::ffff:", "")
| where IpAddress !in (DC_IPs)
| project-reorder Computer, TargetUserName, IpAddress
Stages and Predicates
Parameters
let DCs = dynamic(["yourdc1.yourdomain.local"]);
let DC_IPs = dynamic(["IP of the DCs including IPv6 addresses"]);
Stage 1: source
SecurityEvent
Stage 2: where
| where EventID == 4768
Stage 3: where
| where Computer in~ (DCs)
Stage 4: where
| where TargetUserName endswith "$"
Stage 5: where
| where DCs has replace_string(TargetUserName,"$","")
Stage 6: where
| where IpAddress <> "::1"
Stage 7: extend
| extend IpAddress = replace_string(IpAddress, "::ffff:", "")
Stage 8: where
| where IpAddress !in (DC_IPs)
Stage 9: project-reorder
| project-reorder Computer, TargetUserName, IpAddress
Exclusions
Top-level NOT(...) conjuncts: predicates this rule actively suppresses.
| Field | Kind | Excluded values |
|---|---|---|
IpAddress | eq | DC_IPs |
Indicators
Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.
| Field | Kind | Values |
|---|---|---|
Computer | in |
|
EventID | eq |
|
IpAddress | ne |
|
TargetUserName | ends_with |
|
Output fields
Fields the rule emits when it matches. Chronicle authors list these in the outcome block; they appear on the detection and $risk_score drives alerting. Sentinel / Defender XDR rules build them up through project / summarize / extend stages. Sentinel maps these into alert fields via entityMappings and customDetails; Defender XDR custom detections surface them as alert fields directly.
| Field | Source |
|---|---|
IpAddress | extend |