Skip to content

Commit fe611c4

Browse files
committed
Initial commit with detection configurations and Mordor APT log datasets
0 parents  commit fe611c4

File tree

11 files changed

+4432
-0
lines changed

11 files changed

+4432
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Detection as Code Factory
2+
3+
# Bu robot ne zaman çalışacak? (Ana dala kod itildiğinde veya PR açıldığında)
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- main
11+
workflow_dispatch:
12+
13+
jobs:
14+
sigma-ci-cd:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: 1. Kodu GitHub'dan Çek
19+
uses: actions/checkout@v3
20+
21+
- name: 2. Python Ortamını Kur
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: '3.10'
25+
26+
- name: 3. Sigma CLI ve Eklentilerini Yükle
27+
run: |
28+
pip install sigma-cli
29+
sigma plugin install splunk
30+
sigma plugin install elasticsearch
31+
sigma plugin install sysmon
32+
33+
- name: 4. Kuralları Test Et (Syntax & Linting)
34+
run: |
35+
echo "Kuralların yapısı kontrol ediliyor..."
36+
sigma check rules/sigma/
37+
38+
- name: 5. Kuralları SIEM Dillerine Çevir (Build Aşaması)
39+
run: |
40+
mkdir -p build/splunk build/elastic
41+
echo "Splunk SPL'e dönüştürülüyor..."
42+
sigma convert -t splunk -p sysmon rules/sigma/ > build/splunk/windows_detections.spl
43+
44+
echo "Elasticsearch Query'e dönüştürülüyor..."
45+
sigma convert -t lucene -p sysmon rules/sigma/ > build/elastic/windows_detections.txt
46+
47+
- name: 6. Üretilen Kodları Göster (Loglar için)
48+
run: |
49+
echo "==== ÜRETİLEN SPLUNK SORGUSU ===="
50+
cat build/splunk/windows_detections.spl
51+
echo -e "\n==== ÜRETİLEN ELASTICSEARCH SORGUSU ===="
52+
cat build/elastic/windows_detections.txt

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.vscode/
2+
__pycache__/
3+
*.exe
4+
*.dll
5+
*.log
6+
build/
7+
.env
8+
tests/dataset/T1053.005_Scheduled_Task/schtasks_create.json
9+
tests/dataset/T1053.005_Scheduled_Task/

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# 🛡️ Detection-as-Code (DaC) Factory: Sigma Pack for Windows Security
2+
3+
> **Transforming threat hunting from a manual task into a continuous engineering pipeline.**
4+
5+
## 🚀 Proje Vizyonu (Ruleset Philosophy)
6+
Modern Güvenlik Operasyon Merkezleri (SOC), kural yazımını ve test süreçlerini manuel olarak yönetmenin ötesine geçmelidir. Bu proje, geleneksel SIEM sorgu yazarlığını bir **Yazılım Mühendisliği (CI/CD)** disiplinine dönüştürmek amacıyla "Detection-as-Code" (DaC) felsefesiyle inşa edilmiştir.
7+
8+
Amacımız; platform bağımsız (vendor-agnostic) Sigma kuralları yazmak, bu kuralları sektör standardı olan **Mordor APT simülasyon logları** ile otomatik olarak test etmek ve GitHub Actions aracılığıyla saniyeler içinde Splunk (SPL) ve Elasticsearch (Lucene/KQL) dillerine dönüştürmektir.
9+
10+
## 🏗️ Sistem Mimarisi (Pipeline Otomasyonu)
11+
12+
1. **Code:** Yeni tehdit istihbaratı (CTI) YAML formatında (Sigma) yazılır.
13+
2. **Commit:** Kod GitHub'a pushlanır.
14+
3. **CI/CD (GitHub Actions):** - YAML syntax kontrolü yapılır (Linting).
15+
- Mantıksal doğrulama gerçekleştirilir.
16+
- Kurallar otomatik olarak `/build` klasörüne **Splunk** ve **Elasticsearch** dilleri için derlenir (Build).
17+
4. **Deploy:** Üretilen sorgular SIEM sistemlerine entegre edilmeye hazırdır.
18+
19+
## 🎯 MITRE ATT&CK Kapsam Matrisi (Coverage Matrix)
20+
21+
Mevcut tespit kurallarımızın kapsadığı taktik ve teknikler aşağıda haritalandırılmıştır:
22+
23+
| Tactic | Technique ID | Technique Name | Sigma Rule | Status |
24+
| :--- | :--- | :--- | :--- | :---: |
25+
| **Credential Access** | `T1003.001` | LSASS Memory Dumping | `proc_access_win_lsass_susp_access.yml` | 🟢 Active |
26+
| **Execution** | `T1059.001` | PowerShell | `proc_creation_win_powershell_encoded.yml` | 🟢 Active |
27+
| **Persistence** | `T1053.005` | Scheduled Task/Job | `proc_creation_win_schtasks_creation.yml` | 🟢 Active |
28+
| **Impact** | `T1490` | Inhibit System Recovery (Ransomware) | `proc_creation_win_vssadmin_delete_shadows.yml` | 🟢 Active |
29+
30+
## 🧪 Altın Veri Seti (Golden Dataset) İle Doğrulama
31+
Bu projede tekerleği yeniden icat etmemek ve endüstri standartlarında kalibrasyon sağlamak için **OTRF Mordor** açık kaynak veri seti kullanılmıştır. Kurallarımız, `/tests/dataset/` dizinindeki gerçek dünya (APT29 vb.) simülasyonlarına ait loglar üzerinde kalite kontrolünden (Security QA) geçmektedir.
32+
33+
## 🛠️ Nasıl Çalıştırılır?
34+
35+
Projeyi kendi ortamınızda test etmek veya SIEM sorgularını üretmek için:
36+
37+
```bash
38+
# Bağımlılıkları yükleyin
39+
pip install sigma-cli
40+
sigma plugin install splunk azure
41+
42+
# Tüm kuralları Splunk'a dönüştürün
43+
sigma convert -t splunk -p sysmon rules/sigma/
44+
45+
# Elasticsearch için dönüştürün
46+
sigma convert -t lucene -p sysmon rules/sigma/
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
title: Suspicious Access to LSASS Process
2+
id: 32d0d3e2-e58d-4d41-926b-18b520b2b32d
3+
status: experimental
4+
description: Detects suspicious access to the LSASS process, which is often an indicator of credential dumping tools like Mimikatz.
5+
author: Senin Adın
6+
date: 2026-03-20
7+
tags:
8+
- attack.credential_access
9+
- attack.t1003.001
10+
logsource:
11+
category: process_access
12+
product: windows
13+
# Sysmon Event ID 10 (ProcessAccess) loglarına bakacağımızı belirtiyoruz
14+
detection:
15+
selection:
16+
TargetImage|endswith: '\lsass.exe'
17+
GrantedAccess:
18+
- '0x1010'
19+
- '0x1410'
20+
- '0x143a'
21+
- '0x1f0fff'
22+
filter_system:
23+
# Yanlış pozitifleri (False Positive) önlemek için sistemin kendi normal işlemlerini hariç tutuyoruz
24+
SourceImage|startswith: 'C:\Windows\System32\'
25+
condition: selection and not filter_system
26+
falsepositives:
27+
- Antivirüs yazılımlarının LSASS taramaları (Eğer varsa SourceImage kısmına eklenmeli)
28+
level: high
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
title: Suspicious PowerShell Encoded Command
2+
id: 3d304fda-78aa-43ed-975c-d740798a49c1
3+
status: experimental
4+
description: Detects the use of encoded commands in PowerShell, a common technique used by malware and attackers to evade detection.
5+
author: kbugra
6+
date: 2026-03-20
7+
tags:
8+
- attack.execution
9+
- attack.t1059.001
10+
logsource:
11+
category: process_creation
12+
product: windows
13+
detection:
14+
selection:
15+
Image|endswith:
16+
- '\powershell.exe'
17+
- '\pwsh.exe'
18+
CommandLine|contains:
19+
- ' -enc '
20+
- ' -EncodedCommand '
21+
- ' -ec '
22+
condition: selection
23+
falsepositives:
24+
- Yönetici (Admin) tarafından çalıştırılan meşru otomasyon scriptleri
25+
level: high
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
title: Suspicious Scheduled Task Creation
2+
id: 92626ddd-662c-49e3-ac59-f6535f12d189
3+
status: experimental
4+
description: Detects the creation of a new scheduled task using schtasks.exe, often used by attackers for persistence.
5+
author: kbugra
6+
date: 2026-03-20
7+
tags:
8+
- attack.persistence
9+
- attack.t1053.005
10+
logsource:
11+
category: process_creation
12+
product: windows
13+
detection:
14+
selection:
15+
Image|endswith: '\schtasks.exe'
16+
CommandLine|contains|all:
17+
- '/create'
18+
- '/tn'
19+
- '/tr'
20+
filter:
21+
# SCCM veya Windows update gibi sistem işlemlerini hariç tutabiliriz
22+
User: 'NT AUTHORITY\SYSTEM'
23+
condition: selection and not filter
24+
falsepositives:
25+
- Meşru yazılım kurulumları veya sistem güncellemeleri
26+
level: medium
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
title: Ransomware Behavior - Deleting Shadow Copies
2+
id: c947b146-0abc-4c87-9c64-b17e9d7274a2
3+
status: experimental
4+
description: Detects the deletion of volume shadow copies via vssadmin.exe, a critical precursor to ransomware encryption.
5+
author: Senin Adın
6+
date: 2026-03-20
7+
tags:
8+
- attack.impact
9+
- attack.t1490
10+
logsource:
11+
category: process_creation
12+
product: windows
13+
detection:
14+
selection:
15+
Image|endswith: '\vssadmin.exe'
16+
CommandLine|contains|all:
17+
- 'delete'
18+
- 'shadows'
19+
condition: selection
20+
falsepositives:
21+
- Çok nadir olarak yetkili sistem yöneticisi (SysAdmin) bakımları
22+
level: critical
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"EventID": 1, "ProviderGuid": "{5770385f-c22a-43e0-bf4c-06f5698ffbd9}", "Image": "C:\\Windows\\System32\\schtasks.exe", "CommandLine": "schtasks.exe /create /tn \"WindowsUpdate\" /tr \"C:\\Windows\\Temp\\malware.exe\" /sc onstart /ru System", "User": "NT AUTHORITY\\SYSTEM", "ProcessId": 2048, "ParentImage": "C:\\Windows\\System32\\cmd.exe", "UtcTime": "2023-10-25 16:45:12.000", "Computer": "WORKSTATION-01.local"}

0 commit comments

Comments
 (0)