Iniciar sesión

Practice: detection engineering

15 min · 2 ejercicio(s)

From hunt to rule

A good detection rule is specific (few false positives), robust (survives small attacker changes) and explained (the analyst knows what to do). Before you ship a rule:

  1. Run it over at least a week of data and count the hits.
  2. Read every hit. If you would not want to be woken up for it, tune the rule.
  3. Map it to MITRE ATT&CK and write a short triage note.

Robust conditions

Fragile Robust
process.command_line == "wevtutil.exe cl Security" process.name : "wevtutil.exe" and process.args : ("cl", "clear-log")
process.name == "PsExec64.exe" process.name : "psexesvc.exe" on the target (the service name is hard to change)
file.path == "C:\\ProgramData\\rc\\rclone.exe" process.executable : ("*\\ProgramData\\*", "*\\AppData\\*") combined with network behaviour

Rule types in Elastic Security

  • Custom query (KQL): single events.
  • EQL: single events with richer logic, and sequences.
  • ES|QL: aggregations, e.g. "more than 50 failed logons per source IP in 5 minutes".
  • Threshold, machine learning, indicator match and new terms for special cases.

Ejercicios prácticos de esta lección

Resuelve estos ejercicios con una consulta en el laboratorio Elasticsearch real. Inicia sesión gratis para acceder al laboratorio, las pistas y la corrección automática.

  1. 1. Cleared event logs

    Write a detection for clearing Windows event logs: wevtutil.exe with the argument cl. Graded by result.

  2. 2. Scheduled task persistence

    How many times was schtasks.exe started with the argument /create?