DETECT hunt Build detections

ProductionBuild, Validate

One detection in seven languages

Write the detection once in Sigma, in rule.yml, and the pipeline converts it for each of the 13 targets in targets.yml that reads its log source. Here is DET-0001, the Kerberoasting detection, in 6 of them, with tips for writing and reviewing queries in each language. The other 5 are listed at the end.

ReferenceFramework v0.136.0. Every query below is the approved copy the repository checks conversions against.

Do it in the browser Translate a query

Remember

  • Review the Sigma file. The pipeline generates each platform's query from it and checks that query against an approved copy.
  • Field names differ between platforms. The pipeline maps them, so confirm the mapped names against a real event.
  • Case sensitivity differs between languages. Check how your platform compares text before you trust an exclusion.
  • Replay each converted query against the fixtures on its own engine before deploying it.

SigmaThe source every other query is generated from.

Sigma is the source. Every query below is generated from this file, and review happens here.

title: Kerberoasting - RC4 Service Ticket Request for a User Account
id: 6f1c2d4e-9a3b-4c5d-8e7f-0a1b2c3d4e5f
status: experimental
description: Someone requested a Kerberos service ticket with the weak RC4 encryption for a service that runs under a user account. Attackers make exactly this request when they want to take the ticket away and crack the service account's password offline, the technique called Kerberoasting.
references:
  - https://attack.mitre.org/techniques/T1558/003/
author: Habibullah Tora
date: 2026-09-12
tags:
  - attack.credential_access
  - attack.t1558.003
  - detect.DET-0001
logsource:
  product: windows
  service: security
detection:
  selection:
    EventID: 4769
    TicketEncryptionType: '0x17'
    Status: '0x0'
  filter_machine_accounts:
    ServiceName|endswith: '$'
  filter_krbtgt:
    ServiceName: 'krbtgt'
  condition: selection and not 1 of filter_*
fields:
  - TargetUserName
  - ServiceName
  - IpAddress
  - TicketEncryptionType
falsepositives:
  - Older applications that still ask for RC4 tickets. After the 7-day count, exclude them by ServiceName in a pull request, never in the SIEM's interface
level: high

Tips for Sigma

  • Write each detection once in Sigma and review that file.
  • Set logsource accurately. Each backend uses the product and service to choose indexes and field names.
  • Use field modifiers such as |endswith, |contains, and |re, and keep wildcards out of values.
  • Put known false positives in named filter_ selections, so the condition reads 'selection and not 1 of filter_*'.
  • Tag the ATT&CK technique, for example attack.t1558.003, so coverage can be counted.
  • Keep the status field honest. The pipeline maps experimental, test, and stable to lifecycle stages.

SPLSplunk.

Written to replay in CI against a Splunk Enterprise and Splunk Cloud service container. The fixtures load in, the query runs, and Validate passes only when it matches the true-positive events and ignores the rest. This adapter has run end to end against the engine by hand, and the outside checks page has the run. Its CI job has not run yet.

source="WinEventLog:Security" EventCode=4769 TicketEncryptionType="0x17" Status="0x0" NOT (ServiceName IN ("*$", "krbtgt")) | table TargetUserName,ServiceName,IpAddress,TicketEncryptionType

Tips for SPL

  • Start with index plus sourcetype or source, so Splunk reads only the events that can match.
  • Put field filters before the first pipe, and transforming commands such as stats and table after them.
  • Avoid join and transaction. A stats by the shared field correlates the same events faster, with no subsearch row limit.
  • A leading wildcard such as "*$" checks every value of the field. Narrow the search first so fewer events reach it.
  • For high-volume scheduled detections, use tstats against an accelerated data model.
  • Set the earliest and latest times to match the schedule, with a small overlap to cover indexing delay.
  • Search terms and field values are case-insensitive by default, but field names are case-sensitive.
  • Throttle alerts per entity so one attacker does not produce 100 notifications.

KQLMicrosoft Sentinel, over the SecurityEvent table. Defender XDR's Device tables have their own target, kusto_xdr.

Written to replay in CI against the Kusto emulator (kustainer). The fixtures load in, the query runs, and Validate passes only when it matches the true-positive events and ignores the rest. This adapter has run end to end against the engine by hand, and the outside checks page has the run. Its CI job has not run yet.

SecurityEvent
| where (EventID == 4769 and TicketEncryptionType =~ "0x17" and Status =~ "0x0") and (not((ServiceName in~ ("krbtgt") or ServiceName endswith "$")))

Tips for KQL

  • Filter on TimeGenerated first, then on the most selective fields, as early in the query as possible.
  • Use has for whole-term matches. It uses the term index and runs faster than contains.
  • == is case-sensitive and =~ is not. The converted query uses =~ for that reason.
  • Use project to keep only the columns the analyst needs.
  • For thresholds, summarize with bin(TimeGenerated, 1h) or a window that matches the rule frequency.
  • Map entities such as Account, Host, and IP in the analytics rule, so related alerts group into one incident.
  • Make the rule's lookback longer than its frequency, so the windows overlap and cover ingestion delay.

SQLData warehouses and databases, including Snowflake, BigQuery, and Databricks.

Replayed in CI with no infrastructure. The fixtures load into an in-memory database and the query runs against them. Validate passes only when the query matches the true-positive events and ignores the rest. This adapter has run end to end.

SELECT * FROM detect_fixtures WHERE (EventID=4769 AND TicketEncryptionType='0x17' AND Status='0x0') AND (NOT (ServiceName LIKE '%$' ESCAPE '\' OR ServiceName='krbtgt'))

Tips for SQL

  • Filter on the event time column first, so the warehouse prunes files before it reads them.
  • Extract only the JSON fields you use, and cast them once in a CTE.
  • Declare thresholds, windows, and allowlists as variables.
  • Use QUALIFY or a window function to keep one alert per entity.
  • Case sensitivity depends on the database and its collation settings. Check before trusting an exclusion.
  • Every scheduled run uses compute. Match the schedule and warehouse size to the latency you need.

ES|QLElastic Security.

Written to replay in CI against an Elasticsearch service container. The fixtures load in, the query runs, and Validate passes only when it matches the true-positive events and ignores the rest. This adapter has run end to end against the engine by hand, and the outside checks page has the run. Its CI job has not run yet.

from detect_fixtures metadata _id, _index, _version | where winlog.channel=="Security" and event.code=="4769" and winlog.event_data.TicketEncryptionType=="0x17" and winlog.event_data.Status=="0x0" and not (ends_with(service.name, "$") or service.name=="krbtgt")

Tips for ES|QL

  • Start with FROM and a narrow index pattern, and filter with WHERE before any STATS.
  • String comparison with == is case-sensitive. Use TO_LOWER on both sides for a case-insensitive match.
  • Use the Elastic Common Schema field names, such as event.code. The pipeline maps Sigma names to them.
  • Keep METADATA _id, _index, and _version in a rule with no aggregation. Elastic uses them to deduplicate alerts.
  • Use KEEP to return only the fields the analyst needs.

EQLElastic Security, for event sequences.

Converted and diffed only. No public test instance exists, so CI checks the conversion against the approved copy and cannot check how the query behaves. Treat it as a draft until it has run on a real instance.

any where winlog.channel:"Security" and ((event.code:"4769" and winlog.event_data.TicketEncryptionType:"0x17" and winlog.event_data.Status:"0x0") and (not (service.name like~ ("*$", "krbtgt"))))

Tips for EQL

  • Use EQL when the detection needs a sequence, for example sequence by host.id with one step per event.
  • Name the event category, such as process where or network where. any where searches every category.
  • The : operator is case-insensitive and == is case-sensitive.
  • like~ is a case-insensitive wildcard match, which is why the converted query uses it.
  • Keep maxspan on a sequence as short as the behavior allows. Long spans carry more state.

LogScaleCrowdStrike Falcon LogScale.

Converted and diffed only. No public test instance exists, so CI checks the conversion against the approved copy and cannot check how the query behaves. Treat it as a draft until it has run on a real instance.

EventID=4769 TicketEncryptionType=/^0x17$/i Status=/^0x0$/i not (ServiceName=/\$$/i or ServiceName=/^krbtgt$/i)

Tips for LogScale

  • A query runs as a pipeline from left to right, so put the most selective filters first.
  • Filter on tag fields, the ones that start with #, where you can. They narrow the data before the rest of the query runs.
  • A regex ending in /i is case-insensitive.
  • Anchor a regex with ^ and $ when you mean an exact match. An unanchored regex also matches inside longer values.
  • Keep the converted query and the Sigma file in step. Change the Sigma file, then convert again.

Other targets

The pipeline also converts to Elasticsearch and Kibana, Grafana Loki (convert only), NetWitness (convert only), OpenSearch, Panther (convert only). Their approved copies sit beside these in detections/DET-0001/golden/ in the repository: elastic_lucene.lucene, loki.logql, netwitness.nw, opensearch.opensearch, panther.py.

Microsoft Defender XDR advanced hunting (convert only) converts only process, image-load, file, registry, and network rules, since its tables carry no Windows Security log. DET-0001 reads the Windows Security log, so it has no copy there, and convert.py reports the target as skipped for it.

Google SecOps (convert only) converts only process, registry, file, network, and DNS rules, since Google's data model lacks fields for most others, such as Kerberos ticket types. DET-0001 reads the Windows Security log, so it has no copy there, and convert.py reports the target as skipped for it.

For detections that run as scheduled warehouse queries, Detections in SQL shows the same detection with declared variables and a Snowflake task.