skills/analyzing-security-logs-with-splunk/SKILL.md
利用 Splunk Enterprise Security 和 SPL(Search Processing Language,搜索处理语言),通过日志关联、时间线重建和异常检测来调查安全事件。涵盖 Windows 事件日志、防火墙日志、代理日志和认证数据分析。适用于 Splunk 调查、SPL 查询、SIEM 日志分析、安全事件关联或基于日志的事件调查相关请求。
npx skillsauth add killvxk/cybersecurity-skills-zh analyzing-security-logs-with-splunkInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
不适用于实时数据包级别分析;全流量分析请使用 Wireshark 或 Zeek。
search 和 accelerate_search 能力的基于角色的访问权限根据事件分诊数据定义搜索参数:
| 设置初始调查范围
index=windows OR index=firewall OR index=proxy
earliest="2025-11-14T00:00:00" latest="2025-11-16T00:00:00"
(host="WKSTN-042" OR src_ip="10.1.5.42" OR user="jsmith")
| stats count by index, sourcetype, host
| sort -count
此查询确定哪些日志源包含调查时间段和受影响资产的相关数据。
使用 Windows 安全事件日志调查可疑认证模式:
| 检测暴力破解和撞库攻击
index=windows sourcetype="WinEventLog:Security" EventCode=4625
earliest=-24h
| stats count as failed_attempts, values(src_ip) as source_ips,
dc(src_ip) as unique_sources by TargetUserName
| where failed_attempts > 10
| sort -failed_attempts
| 检测哈希传递(Logon Type 9 - NewCredentials)
index=windows sourcetype="WinEventLog:Security" EventCode=4624
Logon_Type=9
| table _time, host, TargetUserName, src_ip, LogonProcessName
| 通过 RDP 检测横向移动
index=windows sourcetype="WinEventLog:Security" EventCode=4624
Logon_Type=10
| stats count, values(host) as targets by TargetUserName, src_ip
| where count > 3
| sort -count
使用 Sysmon 日志重建进程执行链:
| 带父进程链的进程创建(Sysmon Event ID 1)
index=sysmon EventCode=1 host="WKSTN-042"
earliest="2025-11-15T14:00:00" latest="2025-11-15T15:00:00"
| table _time, ParentImage, ParentCommandLine, Image, CommandLine, User, Hashes
| sort _time
| 检测可疑 PowerShell 执行
index=sysmon EventCode=1 Image="*\\powershell.exe"
(CommandLine="*-enc*" OR CommandLine="*-encodedcommand*"
OR CommandLine="*downloadstring*" OR CommandLine="*iex*")
| table _time, host, User, ParentImage, CommandLine
| sort _time
| 检测 LSASS 凭据转储
index=sysmon EventCode=10 TargetImage="*\\lsass.exe"
GrantedAccess=0x1010
| table _time, host, SourceImage, SourceUser, GrantedAccess
将网络日志与端点事件进行关联:
| 检测 C2 信标模式
index=proxy OR index=firewall dest_ip="185.220.101.42"
| timechart span=1m count by src_ip
| where count > 0
| 检测 DNS 隧道(向单一域名发送大量查询)
index=dns
| rex field=query "(?<subdomain>[^\.]+)\.(?<domain>[^\.]+\.[^\.]+)$"
| stats count, avg(len(query)) as avg_query_len by domain, src_ip
| where count > 500 AND avg_query_len > 40
| sort -count
| 检测大量数据传输(潜在外泄)
index=proxy action=allowed
| stats sum(bytes_out) as total_bytes by src_ip, dest_ip, dest_host
| eval total_MB=round(total_bytes/1024/1024,2)
| where total_MB > 100
| sort -total_MB
跨所有日志源重建统一时间线:
| 统一事件时间线
index=windows OR index=sysmon OR index=proxy OR index=firewall
(host="WKSTN-042" OR src_ip="10.1.5.42" OR user="jsmith")
earliest="2025-11-15T14:00:00" latest="2025-11-15T16:00:00"
| eval event_summary=case(
sourcetype=="WinEventLog:Security" AND EventCode==4624, "登录: ".TargetUserName." 来自 ".src_ip,
sourcetype=="WinEventLog:Security" AND EventCode==4625, "登录失败: ".TargetUserName,
sourcetype=="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" AND EventCode==1,
"进程: ".Image." 由 ".User." 执行",
sourcetype=="proxy", "Web: ".http_method." ".url,
1==1, sourcetype.": ".EventCode)
| table _time, sourcetype, host, event_summary
| sort _time
将调查发现转化为持续性 Splunk 关联搜索:
| 关联搜索:Office 应用程序生成的 PowerShell
index=sysmon EventCode=1
Image="*\\powershell.exe"
(ParentImage="*\\winword.exe" OR ParentImage="*\\excel.exe"
OR ParentImage="*\\outlook.exe")
| eval severity="high"
| eval mitre_technique="T1059.001"
| collect index=notable_events
| 术语 | 定义 | |------|------| | SPL(搜索处理语言) | Splunk 的查询语言,用于搜索、过滤、转换和可视化机器数据 | | CIM(通用信息模型) | Splunk 的字段规范化标准,将厂商特定字段名映射为通用名称,以支持跨源查询 | | Notable Event(显著事件) | Splunk Enterprise Security 中基于关联搜索匹配而标记供分析师审查的事件 | | Data Model(数据模型) | Splunk 中索引数据的结构化表示,支持加速搜索和基于透视的分析 | | Sourcetype(数据源类型) | Splunk 中定义特定日志类型格式和解析规则的分类标签 | | Correlation Search(关联搜索) | 持续运行的 Splunk 计划搜索,当条件满足时生成显著事件 | | Timechart(时间图表) | SPL 命令,创建时序可视化图表以识别模式、异常和趋势 |
场景背景:安全运营收到告警:同一账户在 30 分钟内从地理位置分散的 IP 地址多次成功登录。
方法:
常见陷阱:
SPLUNK 调查报告
============================
事件编号: INC-2025-1547
分析人员: [姓名]
调查时段: 2025-11-14 00:00 UTC - 2025-11-16 00:00 UTC
搜索范围
索引: windows, sysmon, proxy, firewall, dns
主机: WKSTN-042, SRV-FILE01
用户: jsmith, svc-backup
源 IP: 10.1.5.42, 10.1.10.15
关键发现
1. [时间戳] - 通过钓鱼邮件初始入侵(Sysmon Event 1)
2. [时间戳] - C2 已建立(代理日志,检测到信标模式)
3. [时间戳] - 凭据窃取(Sysmon Event 10,LSASS 访问)
4. [时间戳] - 横向移动至 SRV-FILE01(Event 4624 Type 3)
5. [时间戳] - 数据暂存和外泄(代理 bytes_out 异常)
使用的 SPL 查询
[关键查询的编号列表及描述]
发现的检测盲区
- SRV-FILE01 上未部署 Sysmon(存在盲区)
- 代理日志缺少对 C2 域名的 SSL 检测
- PowerShell ScriptBlock 日志记录未启用
推荐检测规则
1. Office 生成 PowerShell 的关联搜索
2. LSASS 访问模式的阈值告警
3. 信标间隔网络流量的行为规则
testing
设计并执行社会工程学渗透测试,包括钓鱼、语音钓鱼、短信钓鱼和物理借口活动,以衡量人员安全韧性并识别培训差距。
testing
主持结构化的事件后审查,以识别根本原因、记录有效和无效的措施,并提出可操作的改进建议以提升未来的事件响应能力。
testing
通过分析举报的邮件、提取指标、评估凭据受攻陷情况、在全组织范围隔离恶意邮件并修复受影响账号来响应网络钓鱼事件。涵盖邮件头分析、URL/附件沙箱检测和邮箱范围清除操作。适用于网络钓鱼响应、邮件事件、凭据钓鱼、鱼叉式网络钓鱼调查或钓鱼修复相关请求。
tools
票据传递(Pass-the-Ticket,PtT)是一种横向移动技术,使用窃取的 Kerberos 票据(TGT 或 TGS)在不知道用户密码的情况下向服务进行认证。通过从已控制的主机内存中提取 Kerberos 票据,攻击者可以将这些票据注入自己的会话以模拟票据所有者。