Detection rules › Kusto

Certified Pre-Owned - TGTs requested with certificate authentication

Status
available
Severity
medium
Time window
1h
Source
github.com/Azure/Azure-Sentinel

This query identifies someone using machine certificates to request Kerberos Ticket Granting Tickets (TGTs).

MITRE ATT&CK coverage

TacticTechniques
Stealth

Telemetry coverage

Rule body

id: b838a13c-052e-45b8-a5ac-7d3eb62efa11
name: Certified Pre-Owned - TGTs requested with certificate authentication
description: |
  This query identifies someone using machine certificates to request Kerberos Ticket Granting Tickets (TGTs).
severity: Medium
status: Available
requiredDataConnectors:
  - connectorId: SecurityEvents
    dataTypes:
      - SecurityEvent
  - connectorId: WindowsSecurityEvents
    dataTypes:
      - SecurityEvent
queryFrequency: 1h
queryPeriod: 1h
triggerOperator: gt
triggerThreshold: 0
tactics:
  - DefenseEvasion
relevantTechniques:
  - T1036
query: |
  let timeframe=1h;
  SecurityEvent
  | where TimeGenerated >= ago(timeframe)
  | where EventID == 4768
  | project TimeGenerated, Computer, TargetAccount, EventData=parse_xml(EventData)
  | mv-apply d=EventData.EventData.Data on
  (
    where d["@Name"]=="CertIssuerName"
    | project CIN=tostring(d["#text"])
  )
  | where not(isempty(CIN))
  // <DECISION - 1>
  // In some environments, we see a lot of certs starting with a sid and containing live.com. Comment out the next line if you have that as well.
  //| where not(CIN startswith "S-1-")
  // <DECISION - 2>
  // If you're seeing a significant number of machine accounts, it might be due to 802.1X or SCCM. https://twitter.com/MagnusMOD/status/1407800853088591872?s=20.
  // The following line allows you to filter out all endpoints. This does introduce a blindspot, and you need a custom function which provides data about (on-prem) AD machines.
  // Alternatively, you can use DeviceInfo, if you're ingesting that data from MDE.
  | parse CIN with "CN=" MachineName
  //| join kind=leftouter  MyCustomLookupFunction on $left.MachineName == $right.CN
  //| where not(OperatingSystem startswith "Windows 10")
entityMappings:
  - entityType: Account
    fieldMappings:
      - identifier: FullName
        columnName: TargetAccount
version: 1.0.1
kind: Scheduled

Stages and Predicates

Parameters

let timeframe = 1h;

Stage 1: source

SecurityEvent

Stage 2: where

| where TimeGenerated >= ago(timeframe)

Stage 3: where

| where EventID == 4768

Stage 4: project

| project TimeGenerated, Computer, TargetAccount, EventData=parse_xml(EventData)

Stage 5: kusto:mv-apply

| mv-apply d=EventData.EventData.Data on
(
  where d["@Name"]=="CertIssuerName"
  | project CIN=tostring(d["#text"])
)

Stage 6: where

| where not(isempty(CIN))

Stage 7: parse

| parse CIN with "CN=" MachineName

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
CINis_null(no value, null check)excludes:CIN

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
@Nameeq
  • CertIssuerName
field:"@Name" kind:eq value:"CertIssuerName"
EventIDeq
  • 4768 corpus 14 (splunk 11, kusto 2, elastic 1)
field:"EventID" kind:eq value:"4768"

Output fields

These fields are emitted when the rule matches.

FieldSource
Computerproject
EventDataproject
TargetAccountproject
TimeGeneratedproject