mcpField
D
detecting-evasion-techniques-in-endpoint-logs

detecting-evasion-techniques-in-endpoint-logs

github.com/mukul975安全35.2k52 次安装8 周前更新
代码仓库

关于 detecting-evasion-techniques-in-endpoint-logs

面向安全分析人员的端点日志分析技能,用于狩猎 Windows 环境中的防御规避行为。它涵盖日志篡改、进程注入、安全工具停用、伪装和 LOLBin 滥用,并强调关联多个信号。

主要功能

  1. 01检测日志清除与时间戳篡改
  2. 02分析可疑进程注入
  3. 03识别安全工具停用行为
  4. 04发现进程伪装与 LOLBin 滥用
  5. 05关联多种事件提升检测置信度

适用场景

  1. 01在端点遥测中狩猎防御规避技术
  2. 02调查安全工具被停用或绕过的事件
  3. 03编写并关联端点检测规则

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill detecting-evasion-techniques-in-endpoint-logs

安装后在 Claude Code 中输入/detecting-evasion-techniques-in-endpoint-logs确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

LICENSE
assets/
template.md
references/
api-reference.md
standards.md
workflows.md
scripts/
agent.py
process.py

详细介绍

检测终端日志中的规避技术

何时使用

在以下情况下使用本技能:

  • 在终端遥测数据中搜寻攻击者的防御规避技术(MITRE ATT&CK TA0005)
  • 为常见规避方法(进程注入、时间戳篡改、日志清除)构建检测规则
  • 调查攻击者禁用或绕过安全工具的 incident
  • 分析终端日志,寻找离地攻击二进制(LOLBin)滥用的指标

不要使用本技能来处理网络层规避(请使用网络流量分析)或恶意软件逆向工程。

前置条件

  • 已安装并配置 Sysmon,且具备全面的日志记录规则(SwiftOnSecurity 或 Olaf Hartong 配置)
  • 已启用高级审核策略的 Windows 安全事件日志
  • EDR 遥测(CrowdStrike、SentinelOne、Microsoft Defender for Endpoint)
  • 用于日志关联的 SIEM 平台(Splunk、Elastic、Sentinel)
  • 用于技术参考的 MITRE ATT&CK Enterprise 矩阵

工作流

第 1 步:检测日志篡改(T1070)

Windows 事件日志清除(T1070.001):

# Sysmon Event ID 1 (Process Create) for wevtutil
EventID: 1
CommandLine contains: "wevtutil cl" OR "wevtutil clear-log"

# Security Event ID 1102 - Audit log was cleared
EventID: 1102
Source: Microsoft-Windows-Eventlog

# System Event ID 104 - Event log was cleared
EventID: 104

# PowerShell log clearing
EventID: 1 (Sysmon)
CommandLine contains: "Clear-EventLog" OR "Remove-EventLog"

# Splunk query:
index=windows (EventCode=1102 OR EventCode=104)
  OR (EventCode=1 CommandLine="*wevtutil*cl*")
  OR (EventCode=1 CommandLine="*Clear-EventLog*")
| table _time host user CommandLine EventCode

时间戳篡改(T1070.006):

# Sysmon Event ID 2 - File creation time changed
EventID: 2
# Look for creation times set far in the past on recently-written files
# Correlate with Event ID 11 (FileCreate) - if FileCreate is recent but
# creation time in Event ID 2 is old, timestomping is likely

# MDE Advanced Hunting (KQL):
DeviceFileEvents
| where ActionType == "FileTimestampModified"
| where Timestamp > ago(7d)
| extend TimeDiff = datetime_diff('day', Timestamp, ReportedFileCreationTime)
| where TimeDiff > 30
| project Timestamp, DeviceName, FileName, FolderPath,
    ReportedFileCreationTime, InitiatingProcessFileName
第 2 步:检测进程注入(T1055)
# Sysmon Event ID 8 - CreateRemoteThread
EventID: 8
# Alert when source process is unusual (not system processes)
# Filter out known legitimate: antivirus, debugging tools
SourceImage NOT IN ("C:\Windows\System32\csrss.exe",
                     "C:\Windows\System32\lsass.exe")

# Sysmon Event ID 10 - ProcessAccess with suspicious access masks
EventID: 10
GrantedAccess contains: "0x1F0FFF" OR "0x1FFFFF" OR "0x001F0FFF"
# PROCESS_ALL_ACCESS = 0x1F0FFF (common in injection)
# Filter legitimate: AV accessing all processes

# Sysmon Event ID 25 - Process Tampering
EventID: 25
Type: "Image is replaced"  # Process hollowing indicator

# Splunk detection:
index=sysmon EventCode=8
| where NOT match(SourceImage, "(?i)(csrss|svchost|MsMpEng|defender)")
| stats count by SourceImage TargetImage host
| where count < 5
| sort - count
第 3 步:检测安全工具被禁用(T1562)
# Service stopped events for security services
EventID: 7045 (new service) OR 7036 (service state change)
ServiceName IN ("WinDefend", "Sense", "CrowdStrike Falcon Sensor",
                 "SentinelAgent", "csagent", "MBAMService")

# Sysmon Event ID 1 - Processes that disable Defender
CommandLine contains: "Set-MpPreference -DisableRealtimeMonitoring"
  OR "sc stop WinDefend"
  OR "sc config WinDefend start= disabled"
  OR "net stop" AND ("windefend" OR "sense" OR "csagent")

# Registry modification to disable security features
# Sysmon Event ID 13 - Registry value set
TargetObject contains: "DisableAntiSpyware"
  OR "DisableRealtimeMonitoring"
  OR "DisableBehaviorMonitoring"
Details: "DWORD (0x00000001)"

# MDE KQL:
DeviceRegistryEvents
| where RegistryValueName in ("DisableAntiSpyware", "DisableRealtimeMonitoring")
| where RegistryValueData == "1"
| project Timestamp, DeviceName, RegistryKey, InitiatingProcessFileName
第 4 步:检测伪装(T1036)
# Sysmon Event ID 1 - Process with legitimate name from unusual path
EventID: 1
Image contains: "svchost.exe" AND Image NOT starts with: "C:\Windows\System32\"
Image contains: "csrss.exe" AND Image NOT starts with: "C:\Windows\System32\"
Image contains: "lsass.exe" AND Image NOT starts with: "C:\Windows\System32\"

# Process name mismatch (original filename vs. current name)
# Sysmon captures OriginalFileName from PE header
EventID: 1
OriginalFileName != (parsed filename from Image path)

# Double extension files
EventID: 11 (FileCreate)
TargetFilename matches: "*\.pdf\.exe" OR "*\.doc\.exe" OR "*\.jpg\.exe"

# Splunk:
index=sysmon EventCode=1
| eval process_name=mvindex(split(Image,"\\"),-1)
| where (process_name="svchost.exe" AND NOT match(Image,"(?i)C:\\\\Windows\\\\System32"))
  OR (process_name="csrss.exe" AND NOT match(Image,"(?i)C:\\\\Windows\\\\System32"))
| table _time host Image ParentImage CommandLine User
第 5 步:检测 LOLBin 滥用(T1218、T1127)
# Common LOLBin abuse patterns:

# mshta.exe executing remote content
EventID: 1
Image ends with: "mshta.exe"
CommandLine contains: "http" OR "javascript:" OR "vbscript:"

# certutil.exe downloading files
EventID: 1
Image ends with: "certutil.exe"
CommandLine contains: "-urlcache" OR "-decode" OR "-encode"

# regsvr32.exe executing scriptlets
EventID: 1
Image ends with: "regsvr32.exe"
CommandLine contains: "/s /n /u /i:" OR "scrobj.dll"

# rundll32.exe with unusual DLLs
EventID: 1
Image ends with: "rundll32.exe"
CommandLine contains: "javascript:" OR ".js" OR "http:"

# MSBuild executing inline tasks
EventID: 1
Image contains: "MSBuild.exe"
CommandLine NOT contains: ".sln" AND NOT contains: ".csproj"
第 6 步:构建检测规则关联
# Combine multiple weak signals into high-confidence detection:

# Rule: Potential post-exploitation evasion chain
# Trigger when 3+ evasion techniques observed on same host within 1 hour

# Splunk correlation search:
index=sysmon host=*
| eval technique=case(
    EventCode=2, "timestomping",
    EventCode=8 AND NOT match(SourceImage,"csrss|svchost"), "process_injection",
    EventCode=1 AND match(CommandLine,"(?i)wevtutil.*cl"), "log_clearing",
    EventCode=13 AND match(TargetObject,"DisableRealtimeMonitoring"), "security_disable",
    EventCode=1 AND match(CommandLine,"(?i)(mshta|certutil.*urlcache|regsvr32.*/s.*/n)"), "lolbin_abuse",
    true(), NULL
)
| where isnotnull(technique)
| bin _time span=1h
| stats dc(technique) as technique_count values(technique) as techniques by host _time
| where technique_count >= 3
| sort - technique_count

关键概念

术语定义
防御规避(TA0005)MITRE ATT&CK 战术,指攻击者在行动过程中试图避免被检测
进程注入(T1055)将代码注入另一个进程的内存空间,以在受信任上下文中执行的技术
时间戳篡改(T1070.006)修改文件时间戳,使恶意文件看起来较旧并与合法文件混在一起
伪装(T1036)将恶意文件或进程命名为与合法系统文件相同,以避免被检测
LOLBin离地攻击二进制;被攻击者重新利用的合法 Windows 工具
指标清除(T1070)清除日志、删除文件或修改痕迹,以移除失陷证据

工具与系统

  • Sysmon:具有内核级可见性的高级 Windows 系统监控
  • Microsoft Defender for Endpoint:具备高级搜寻(KQL)的 EDR,用于规避检测
  • CrowdStrike Falcon:基于 IOA 的行为检测,用于规避技术
  • Elastic Security:为 ATT&CK 规避技术提供预构建检测规则的 SIEM
  • Sigma Rules:厂商无关的检测规则格式,具有广泛的规避规则库

常见陷阱

  • 进程注入规则导致告警疲劳:许多合法工具(AV、辅助功能)会执行进程注入。维护一份已知良好源进程的允许列表。
  • 遗漏 Sysmon 事件 ID 8/10:默认 Sysmon 配置可能无法捕获 CreateRemoteThread 或 ProcessAccess。请使用全面的 Sysmon 配置。
  • 忽略父进程上下文:来自 cmd.exe 的可疑命令行,只有在 cmd.exe 的父进程异常时才值得关注(例如,Excel 启动 cmd.exe)。
  • 未跨事件类型进行关联:单个事件往往是良性的。将多个弱信号(进程创建 + 网络连接 + 文件创建)结合起来,以实现高置信度检测。

评论

支持 Markdown