Communitygithub.com

analyzing-windows-event-logs-in-splunk

分析 Splunk 中的 Windows 安全性、系統和 Sysmon 事件記錄

analyzing-windows-event-logs-in-splunk 是什麼?

此技能專門用於分析 Splunk 中由 Windows 安全性 (Security)、系統 (System) 和 Sysmon (System Monitor) 所產生的事件記錄。它為 SOC 分析師、威脅獵捕人員及事件應變人員提供了一個結構化的工作流程,涵蓋從偵測暴力破解與密碼噴濺等驗證攻擊,到探查權限提升、持續性機制、橫向移動,以及最終建立完整的鑑識時間線。此技能支援 Splunk Enterprise 平台,並假設資料已透過 WEF 或 Sysmon 代理導入,且啟用了 Splunk CIM 模型以標準化查詢。透過預先建立的 SPL 查詢、事件代碼說明以及 MITRE ATT&CK 對應表,使用者能夠快速識別威脅、進行優先級排序並產出標準化的分析報告,大大提升了 Windows 端點威脅分析與應變的效率。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mukul975/Anthropic-Cybersecurity-Skills/tree/main/skills/analyzing-windows-event-logs-in-splunk

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

在 Splunk 中分析 Windows 事件記錄

使用時機

在以下情況使用此技能:

  • SOC 分析師調查與 Windows 驗證、程序執行或 AD 變更相關的警示
  • 檢測工程師為基於 Windows 的威脅檢測建立 SPL 查詢
  • 事件應變人員需要 Windows 端點或網域控制站活動的鑑識時間線
  • 定期威脅獵捕活動針對 Windows 特定的 ATT&CK 技術

請勿使用於 Linux/macOS 端點分析或僅限網路的調查。

先決條件

  • 已導入 Windows 事件記錄資料的 Splunk(資料來源類型 WinEventLog:Security、WinEventLog:System、XmlWinEventLog:Microsoft-Windows-Sysmon/Operational)
  • 端點已部署 Sysmon 且採用 SwiftOnSecurity 或 Olaf Hartong 組態
  • 已啟用端點和驗證資料模型的 CIM 資料模型加速
  • 熟悉 Windows 安全性事件識別碼與 Sysmon 事件類型

工作流程

步驟 1:驗證攻擊偵測

暴力破解偵測(事件代碼 4625 — 登入失敗):

index=wineventlog sourcetype="WinEventLog:Security" EventCode=4625
| stats count, dc(TargetUserName) AS unique_users, values(TargetUserName) AS targeted_users
  by src_ip, Logon_Type, Status
| where count > 20
| eval attack_type = case(
    Logon_Type=3, "網路暴力破解",
    Logon_Type=10, "RDP 暴力破解",
    Logon_Type=2, "互動式暴力破解",
    1=1, "其他"
  )
| eval status_meaning = case(
    Status="0xc000006d", "使用者名稱或密碼錯誤",
    Status="0xc000006a", "密碼錯誤(有效使用者)",
    Status="0xc0000234", "帳戶已鎖定",
    Status="0xc0000072", "帳戶已停用",
    1=1, Status
  )
| sort - count
| table src_ip, attack_type, status_meaning, count, unique_users, targeted_users

密碼噴濺偵測:

index=wineventlog sourcetype="WinEventLog:Security" EventCode=4625 Logon_Type=3
| bin _time span=10m
| stats dc(TargetUserName) AS unique_users, count AS total_attempts,
  values(TargetUserName) AS users_targeted by src_ip, _time
| where unique_users > 10 AND total_attempts < unique_users * 3
| eval spray_confidence = if(unique_users > 25, "高", "中")

失敗後的成功登入(入侵指標):

index=wineventlog sourcetype="WinEventLog:Security"
(EventCode=4625 OR EventCode=4624) src_ip!="127.0.0.1"
| sort _time
| stats earliest(_time) AS first_seen, latest(_time) AS last_seen,
  sum(eval(if(EventCode=4625,1,0))) AS failures,
  sum(eval(if(EventCode=4624,1,0))) AS successes
  by src_ip, TargetUserName, ComputerName
| where failures > 10 AND successes > 0
| eval time_to_success = round((last_seen - first_seen)/60, 1)
| sort - failures

步驟 2:權限提升偵測

新增管理員帳戶(T1136.001):

index=wineventlog sourcetype="WinEventLog:Security" EventCode=4720
| join TargetUserName type=left [
    search index=wineventlog EventCode=4732 TargetUserName="Administrators"
    | rename MemberName AS TargetUserName
  ]
| table _time, SubjectUserName, TargetUserName, ComputerName
| eval alert = "已建立新帳戶並新增至 Administrators 群組"

指派特殊權限(事件代碼 4672):

index=wineventlog sourcetype="WinEventLog:Security" EventCode=4672
SubjectUserName!="SYSTEM" SubjectUserName!="LOCAL SERVICE" SubjectUserName!="NETWORK SERVICE"
| stats count, values(PrivilegeList) AS privileges by SubjectUserName, ComputerName
| where count > 0
| search privileges IN ("SeDebugPrivilege", "SeTcbPrivilege", "SeBackupPrivilege",
  "SeRestorePrivilege", "SeAssignPrimaryTokenPrivilege")

權杖操縱偵測(T1134):

index=sysmon EventCode=10 TargetImage="*\\lsass.exe"
GrantedAccess IN ("0x1010", "0x1038", "0x1fffff", "0x40")
| stats count by SourceImage, SourceUser, Computer, GrantedAccess
| where NOT match(SourceImage, "(svchost|csrss|wininit|MsMpEng|CrowdStrike)")
| sort - count

步驟 3:持續性機制偵測

排程工作建立(T1053.005):

index=wineventlog (sourcetype="WinEventLog:Security" EventCode=4698)
  OR (sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
      Image="*\\schtasks.exe")
| eval task_info = coalesce(TaskContent, CommandLine)
| search task_info="*powershell*" OR task_info="*cmd*" OR task_info="*http*" OR task_info="*\\Temp\\*"
| table _time, Computer, SubjectUserName, TaskName, task_info

登錄 Run 機碼修改(T1547.001):

index=sysmon EventCode=13
TargetObject IN (
  "*\\CurrentVersion\\Run\\*",
  "*\\CurrentVersion\\RunOnce\\*",
  "*\\CurrentVersion\\RunServices\\*",
  "*\\Explorer\\Shell Folders\\*"
)
| stats count by Computer, Image, TargetObject, Details
| where NOT match(Image, "(explorer\.exe|msiexec\.exe|setup\.exe)")
| sort - count

WMI 事件訂閱(T1546.003):

index=sysmon EventCode=20 OR EventCode=21
| stats count by Computer, Operation, Consumer, EventNamespace
| where count > 0

步驟 4:橫向移動偵測

遠端服務利用(T1021.002 — SMB/Windows 管理共用):

index=wineventlog sourcetype="WinEventLog:Security" EventCode=4624 Logon_Type=3
| stats dc(ComputerName) AS unique_destinations, values(ComputerName) AS targets
  by src_ip, TargetUserName
| where unique_destinations > 3
| sort - unique_destinations
| table src_ip, TargetUserName, unique_destinations, targets

PsExec 偵測(T1021.002):

index=sysmon EventCode=1
(Image="*\\psexec.exe" OR Image="*\\psexesvc.exe"
 OR ParentImage="*\\psexesvc.exe"
 OR OriginalFileName="psexec.c")
| table _time, Computer, User, ParentImage, Image, CommandLine

RDP 橫向移動(T1021.001):

index=wineventlog sourcetype="WinEventLog:Security" EventCode=4624 Logon_Type=10
| stats count, dc(ComputerName) AS rdp_targets, values(ComputerName) AS destinations
  by src_ip, TargetUserName
| where rdp_targets > 2
| sort - rdp_targets

步驟 5:建立鑑識時間線

為受危害主機建立全面的時間線:

(index=wineventlog OR index=sysmon) Computer="WORKSTATION-042"
earliest="2024-03-14T00:00:00" latest="2024-03-16T00:00:00"
| eval event_description = case(
    EventCode=4624, "登入:".TargetUserName." (類型 ".Logon_Type.")",
    EventCode=4625, "登入失敗:".TargetUserName,
    EventCode=4688 OR (sourcetype="XmlWinEventLog:*Sysmon*" AND EventCode=1),
      "程序:".Image." CMD:".CommandLine,
    EventCode=4698, "排程工作:".TaskName,
    EventCode=3, "網路:".DestinationIp.":".DestinationPort,
    EventCode=11, "檔案已建立:".TargetFilename,
    EventCode=13, "登錄:".TargetObject,
    1=1, "事件 ".EventCode
  )
| sort _time
| table _time, EventCode, event_description, User, src_ip

步驟 6:建立查詢表以進行擴充

建立 Windows 事件識別碼內容的參考查詢表:

| inputlookup windows_eventcode_lookup.csv
| table EventCode, Description, ATT_CK_Technique, Severity

若查詢表不存在,請建立它:

EventCode,Description,ATT_CK_Technique,Severity
4624,成功登入,T1078,資訊
4625,登入失敗,T1110,低
4648,明確認證登入,T1078,中
4672,指派特殊權限,T1134,中
4688,已建立新程序,T1059,資訊
4698,已建立排程工作,T1053.005,中
4720,已建立使用者帳戶,T1136.001,高
4732,成員已新增至安全性群組,T1098,高
4768,已要求 Kerberos TGT,T1558,資訊
4769,Kerberos 服務票證,T1558.003,低
4771,Kerberos 預先驗證失敗,T1110,低

關鍵概念

術語定義
EventCode 4624成功登入事件 — Logon_Type 2 (互動式)、3 (網路)、10 (RDP)、7 (解除鎖定)
EventCode 4625登入失敗事件 — 狀態碼指示失敗原因 (密碼錯誤、帳戶鎖定、停用)
Sysmon EventCode 1程序建立,包含完整的命令列、父程序與雜湊資訊
Sysmon EventCode 3程序發起的網路連線 — 來源/目的 IP、連接埠與程序上下文
登入類型 3網路登入 (SMB、WMI、PowerShell 遠端管理) — 橫向移動的關鍵指標
登入類型 10透過 RDP/終端機服務的遠端互動式登入

工具與系統

  • Splunk Enterprise:SIEM 平台,具備 SPL 查詢引擎,用於 Windows 事件記錄分析與關聯
  • Sysmon (System Monitor):Microsoft Sysinternals 工具,提供詳細的程序、網路與檔案活動記錄
  • Splunk CIM:通用資訊模型,將 Windows 事件對應至正規化欄位,以便進行跨來源查詢
  • Windows Event Forwarding (WEF):Windows 內建機制,用於將事件記錄集中至收集伺服器

常見情境

  • Kerberoasting (T1558.003):針對非標準服務帳戶,偵測加密類型為 0x17 (RC4) 的 EventCode 4769
  • DCSync (T1003.006):從非 DC 來源偵測具有 DS-Replication-Get-Changes 的 EventCode 4662
  • Golden Ticket (T1558.001):偵測具有異常票證屬性 (長效期、非標準加密) 的 EventCode 4769
  • Pass-the-Hash (T1550.002):從非預期來源偵測使用 NTLM 驗證的 EventCode 4624 Logon_Type 3
  • DLL Side-Loading (T1574.002):Sysmon EventCode 7 顯示已由合法程序載入未簽署的 DLL

輸出格式

WINDOWS 事件記錄分析 — 主機:WORKSTATION-042
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
期間:        2024-03-14 至 2024-03-15
事件:        總計 12,847 (安全性:9,231 | Sysmon:3,616)

驗證摘要:
  成功登入 (4624):    487 (類型 3:312, 類型 10:45, 類型 2:130)
  登入失敗 (4625):    847 (來自 192.168.1.105 — 暴力破解)
  明確認證 (4648):    12

可疑發現:
  [高]   847 次登入失敗後於 14:35 成功登入,來源為 192.168.1.105
  [高]   在 14:38 建立新使用者 "backdoor_admin" (4720)
  [高]   在 14:38 將使用者新增至 Administrators 群組 (4732)
  [中]   schtasks.exe 在 14:42 建立持續性工作
  [中]   PowerShell 編碼命令在 14:45 執行

ATT&CK 對應:
  T1110.001 — 密碼猜測 (847 次登入失敗)
  T1136.001 — 本機帳戶建立 (backdoor_admin)
  T1053.005 — 排程工作 (持續性)
  T1059.001 — PowerShell (編碼執行)

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

abusing-dpapi-for-credential-access

Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys) online or offline using SharpDPAPI, SharpChrome, Mimikatz, or Impacket

abusing-shadow-credentials-for-privesc

Take over Active Directory accounts by writing attacker-controlled public keys to msDS-KeyCredentialLink (Shadow Credentials) with pyWhisker, Whisker, or Certipy, then authenticate via PKINIT to recover the target

achieving-cmmc-level-2-compliance

>-

acquiring-disk-image-with-dd-and-dcfldd

Create forensically sound bit-for-bit disk images with dd or dcfldd on a Linux forensic workstation, preserving evidence integrity through hash verification (MD5/SHA) during acquisition. Use when imaging a suspect drive, USB device, or memory card for investigation, preserving volatile disk evidence during incident response, or producing a verified copy for legal or law-enforcement proceedings before any destructive analysis.

analyzing-active-directory-acl-abuse

Detect dangerous ACL misconfigurations in Active Directory using ldap3

analyzing-android-malware-with-apktool

Perform static analysis of Android APK malware using apktool for resource decompilation, jadx for Java source recovery, and androguard for manifest inspection, dangerous permission-combination detection, and identification of obfuscated code, dynamic code loading, and reflection-based API calls. Use to statically triage a suspicious APK without executing it or to build mobile malware detection rules.

analyzing-api-gateway-access-logs

Parses API Gateway access logs (AWS API Gateway, Kong, Nginx) to detect

analyzing-apt-group-with-mitre-navigator

Query ATT&CK data with attackcti, mitreattack-python, and stix2, then build MITRE ATT&CK Navigator layers and multi-layer heatmap overlays mapping one or more APT groups

analyzing-azure-activity-logs-for-threats

Queries Azure Monitor activity logs and sign-in logs via azure-monitor-query

analyzing-bootkit-and-rootkit-samples

Analyzes bootkit and advanced rootkit malware infecting the Master

analyzing-browser-forensics-with-hindsight

Parse Chromium-based browser databases with Hindsight to extract and correlate browsing history, downloads, cookies, cached content, autofill data, saved passwords, and extensions from Chrome, Edge, Brave, Opera, and Vivaldi into a unified timeline (XLSX, JSON, or SQLite output). Use during incident response, insider-threat investigations, or criminal cases when you need to reconstruct a user

analyzing-campaign-attribution-evidence

Systematically evaluate cyber-campaign evidence to attribute an operation to a threat actor, using the Diamond Model and Analysis of Competing Hypotheses (ACH) to weigh infrastructure overlaps, TTP consistency, malware code similarity, and timing/language artifacts into confidence-weighted attribution assessments. Use when an incident investigation needs a defensible attribution confidence level.

analyzing-certificate-transparency-for-phishing

Monitor Certificate Transparency logs using crt.sh and Certstream to

analyzing-cloud-storage-access-patterns

Detect abnormal access in AWS S3, GCS, and Azure Blob Storage by analyzing CloudTrail Data Events, GCS audit logs, and Azure Storage Analytics for after-hours bulk downloads, new-IP access, and API-call spikes (e.g. GetObject) via statistical baselines and time-series anomaly detection. Use when investigating suspected cloud data exfiltration or building related detection rules.

analyzing-cobalt-strike-beacon-configuration

Extract and analyze Cobalt Strike beacon configuration from PE files

analyzing-cobaltstrike-malleable-c2-profiles

Parse and analyze Cobalt Strike Malleable C2 profiles with dissect.cobaltstrike (profiles and beacon-payload configs) and pyMalleableC2 (AST parsing) to extract HTTP/DNS transforms, URIs, headers, sleep/jitter, and injection behavior, then generate network detection signatures. Use when reverse-engineering a captured malleable profile or building detections against Cobalt Strike Beacon traffic.

analyzing-command-and-control-communication

Analyzes malware C2 communication over HTTP, HTTPS, DNS, and custom

analyzing-cyber-kill-chain

Analyzes intrusion activity against the Lockheed Martin Cyber Kill Chain

analyzing-disk-image-with-autopsy

Perform comprehensive forensic analysis of raw (dd), E01, or AFF disk images with Autopsy and The Sleuth Kit, recovering deleted files, examining metadata and embedded artifacts, keyword searching, and building investigation timelines with visual reports. Use for structured analysis of a forensic disk image or when stakeholders need visual reports from evidence.

analyzing-dns-logs-for-exfiltration

Analyzes DNS query logs to detect data exfiltration via DNS tunneling,

相關技能