Detection Engineering — تكتب Detection بتشتغل فعلاً
Sigma و KQL و Splunk — تقلّل false positives وتغطّي ATT&CK
- المستوى
- خبير
- المدة
- 110m
- الترتيب
- الدرس 57 من 85
Detection Engineer vs SOC Analyst — مين بيشتغل ايه؟
- طب يا حضرتك، أنا analyst كويس، يعني أنا detection engineer برضو؟؟
لأ يا مستجد. كنت متوقّع كالعادة في السؤال ده. السؤال عند الـ engineer مش "المهاجم جوّه؟". السؤال "لو دخل النهارده، هشوفه؟". الفرق دقيق بس بيفرّق بين blue team محترم وبين dashboard شغّال.
طب لو الـ Analyst بس عندك، انت مش بتراقب — انت بتـ react. الـ adversary لو عرف انت بتراقب ايه (وده سهل يعرفه)، هيدخل من اللي مش بتراقبه. الـ Detection Engineering بتقفل السكة دي: تكتب rules، تختبرها بـ Atomic Red Team، تقيس coverage على ATT&CK، وتـ tune عشان تقلّل الـ FP من غير ما تفقد الـ TP. ده الفرق بين blue team محترم وبين SOC شغّال على alerts الـ vendor الافتراضية.
دورة حياة قاعدة الكشف — من الفكرة لحد الـ runbook
Sigma — لغة قواعد الكشف الموحدة
Sigma هو YAML format مش مرتبط بأي SIEM. اكتب القاعدة مرة، و ترجمها لـ Splunk SPL أو KQL أو Elasticsearch عن طريق sigmac. توفير وقت و عقل.
title: LSASS Memory Dump via comsvcs.dll
id: a8e2d456-1234-5678-9abc-def012345678
status: stable
description: Detects MiniDump of LSASS using rundll32 and comsvcs.dll
references:
- https://attack.mitre.org/techniques/T1003/001/
author: Detection Eng Team
date: 2026/01/15
tags:
- attack.credential_access
- attack.t1003.001
logsource:
product: windows
service: sysmon
detection:
selection_proc:
EventID: 10
TargetImage|endswith: '\lsass.exe'
selection_caller:
SourceImage|endswith: '\rundll32.exe'
CallTrace|contains: 'comsvcs.dll'
condition: selection_proc and selection_caller
falsepositives:
- Microsoft tools that legitimately call MiniDumpWriteDump (rare)
level: highKQL — Microsoft Defender / Sentinel
// Same hypothesis in KQL against DeviceProcessEvents
DeviceProcessEvents
| where Timestamp > ago(7d)
| where FileName == "rundll32.exe"
| where ProcessCommandLine has_all ("comsvcs.dll", "MiniDump")
| where ProcessCommandLine has "lsass" or ProcessCommandLine matches regex @"\b\d{3,5}\b"
| project Timestamp, DeviceName, AccountName, ProcessCommandLine, InitiatingProcessFileName
| sort by Timestamp desc
// Pivot: who logged on to that host before the dump?
DeviceLogonEvents
| where DeviceName == "WS-EXEC-04"
| where Timestamp between ((ago(2h)) .. (now()))
| project Timestamp, AccountName, LogonType, RemoteIPSplunk SPL
index=sysmon EventCode=10 TargetImage="*\\lsass.exe"
| where match(SourceImage,"rundll32\.exe")
| where match(CallTrace,"comsvcs\.dll")
| stats count by host, SourceImage, GrantedAccess, _time
| where count > 0
// Hunting variant: any process that accessed LSASS with high rights
index=sysmon EventCode=10 TargetImage="*lsass.exe" GrantedAccess IN (0x1010, 0x1410, 0x1438)
| stats values(SourceImage) as accessors, count by host
| where count > 5تقليل الـ False Positives — مفيش حد بيسمع جرس بيطن طول الليل
تلات تقنيات أساسية بتفرق:
قياس التغطية — ATT&CK Navigator
لوّن مصفوفة ATT&CK حسب اللي قواعدك بتكشفه. الناتج = خريطة "أنا شايف إيه" قصاد "المهاجم بيعمل إيه". الفجوة دي بتقولك الأولوية الجاية.
الخلاصة الناشفة
Detection engineering مش "كتابة rules". ده engineering discipline كامل. data sources -> hypothesis -> query -> test -> tune -> runbook -> metrics.
لو ما عندكش CI/CD للـ detections، انت ما عندكش detection engineering. عندك "list of queries". الفرق كبير.
ولو الـ analyst بيـ disable rules بدل ما يـ tune-هم، انت ما عندكش SOC. عندك dashboard.
اكتبها على الحيطة اللي قصاد شاشتك: قاعدة من غير runbook = قاعدة ميتة. وقاعدة بـ 95% FP = قاعدة بتعلّم الـ analyst يقفل عينه.
مصادر للتعمق
- Sigma Project — github.com/SigmaHQ/sigma
- Atomic Red Team — Red Canary
- The DFIR Report — حالات حقيقية + queries جاهزة
- SpecterOps — Detection Engineering Methodology
- Florian Roth blog — Sigma و detection engineering
علّمه علشان تفضل عارف انت فين على السكة.