L’interface est localisée ; les présentations et documents des Skills sont traduits automatiquement par IA dans votre langue. Le code, les commandes, chemins et termes techniques restent en version originale, et le document de l’auteur fait foi.
Explorer les Skills
Productivité · SKILL.md

detecting-evasion-techniques-in-endpoint-logs

detecting-evasion-techniques-in-endpoint-logs

检测端点日志中对手使用的防御规避技术,包括日志篡改、时间戳伪造、进程注入和安全工具禁用。 适用于调查可疑端点行为、为规避战术构建检测规则,或针对隐蔽对手活动进行威胁狩猎的场景。

Independent GitHub snapshot · Automated classification · Original documentation governs

Documentation de la Skill

GitHub

name: detecting-evasion-techniques-in-endpoint-logs description: > 检测端点日志中对手使用的防御规避技术,包括日志篡改、时间戳伪造、进程注入和安全工具禁用。 适用于调查可疑端点行为、为规避战术构建检测规则,或针对隐蔽对手活动进行威胁狩猎的场景。 domain: cybersecurity subdomain: endpoint-security tags: [endpoint, edr, threat-hunting, defense-evasion, MITRE-ATT&CK, detection-engineering] version: 1.0.0 author: mahipal license: Apache-2.0

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

使用场景

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

  • 在端点遥测数据中狩猎对手的防御规避技术(MITRE ATT&CK TA0005)
  • 为常见规避方法(进程注入、时间戳伪造、日志清除)构建检测规则
  • 调查对手禁用或绕过安全工具的事件
  • 分析端点日志中滥用离地攻击二进制文件(LOLBin)的指标

不适用于网络层面的规避(使用网络流量分析)或恶意软件逆向工程。

前置条件

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

操作流程

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

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

# 针对 wevtutil 的 Sysmon 事件 ID 1(进程创建)
EventID: 1
CommandLine 包含:"wevtutil cl" 或 "wevtutil clear-log"

# 安全事件 ID 1102 - 审计日志已清除
EventID: 1102
来源:Microsoft-Windows-Eventlog

# 系统事件 ID 104 - 事件日志已清除
EventID: 104

# PowerShell 日志清除
EventID: 1 (Sysmon)
CommandLine 包含:"Clear-EventLog" 或 "Remove-EventLog"

# Splunk 查询:
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 事件 ID 2 - 文件创建时间已修改
EventID: 2
# 查找最近写入的文件但创建时间设置为很久以前
# 与事件 ID 11(FileCreate)关联 - 如果 FileCreate 时间是近期,
# 但事件 ID 2 中的创建时间是旧的,则很可能发生了时间戳伪造

# MDE 高级搜寻(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 事件 ID 8 - CreateRemoteThread
EventID: 8
# 当源进程异常时发出告警(非系统进程)
# 过滤已知合法来源:杀毒软件、调试工具
SourceImage 不在 ("C:\Windows\System32\csrss.exe",
                     "C:\Windows\System32\lsass.exe")

# Sysmon 事件 ID 10 - 带可疑访问掩码的 ProcessAccess
EventID: 10
GrantedAccess 包含:"0x1F0FFF" 或 "0x1FFFFF" 或 "0x001F0FFF"
# PROCESS_ALL_ACCESS = 0x1F0FFF(注入中常见)
# 过滤合法来源:访问所有进程的 AV

# Sysmon 事件 ID 25 - Process Tampering
EventID: 25
Type: "Image is replaced"  # 进程空洞(Process Hollowing)指示器

# Splunk 检测:
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)

# 安全服务的服务停止事件
EventID: 7045(新服务)或 7036(服务状态变更)
ServiceName 在 ("WinDefend", "Sense", "CrowdStrike Falcon Sensor",
                 "SentinelAgent", "csagent", "MBAMService")

# Sysmon 事件 ID 1 - 禁用 Defender 的进程
CommandLine 包含:"Set-MpPreference -DisableRealtimeMonitoring"
  或 "sc stop WinDefend"
  或 "sc config WinDefend start= disabled"
  或 "net stop" 且 ("windefend" 或 "sense" 或 "csagent")

# 注册表修改以禁用安全功能
# Sysmon 事件 ID 13 - 注册表值设置
TargetObject 包含:"DisableAntiSpyware"
  或 "DisableRealtimeMonitoring"
  或 "DisableBehaviorMonitoring"
Details: "DWORD (0x00000001)"

# MDE KQL:
DeviceRegistryEvents
| where RegistryValueName in ("DisableAntiSpyware", "DisableRealtimeMonitoring")
| where RegistryValueData == "1"
| project Timestamp, DeviceName, RegistryKey, InitiatingProcessFileName

步骤 4:检测伪装(T1036)

# Sysmon 事件 ID 1 - 从异常路径运行的具有合法名称的进程
EventID: 1
Image 包含:"svchost.exe" 且 Image 不以 "C:\Windows\System32\" 开头
Image 包含:"csrss.exe" 且 Image 不以 "C:\Windows\System32\" 开头
Image 包含:"lsass.exe" 且 Image 不以 "C:\Windows\System32\" 开头

# 进程名称不匹配(原始文件名与当前名称)
# Sysmon 从 PE 头部获取 OriginalFileName
EventID: 1
OriginalFileName != (从 Image 路径解析出的文件名)

# 双扩展名文件
EventID: 11 (FileCreate)
TargetFilename 匹配:"*\.pdf\.exe" 或 "*\.doc\.exe" 或 "*\.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)

# 常见 LOLBin 滥用模式:

# mshta.exe 执行远程内容
EventID: 1
Image 以 "mshta.exe" 结尾
CommandLine 包含:"http" 或 "javascript:" 或 "vbscript:"

# certutil.exe 下载文件
EventID: 1
Image 以 "certutil.exe" 结尾
CommandLine 包含:"-urlcache" 或 "-decode" 或 "-encode"

# regsvr32.exe 执行脚本
EventID: 1
Image 以 "regsvr32.exe" 结尾
CommandLine 包含:"/s /n /u /i:" 或 "scrobj.dll"

# rundll32.exe 加载异常 DLL
EventID: 1
Image 以 "rundll32.exe" 结尾
CommandLine 包含:"javascript:" 或 ".js" 或 "http:"

# MSBuild 执行内联任务
EventID: 1
Image 包含:"MSBuild.exe"
CommandLine 不含 ".sln" 且不含 ".csproj"

步骤 6:构建检测规则关联

# 将多个弱信号组合成高置信度检测:

# 规则:潜在的后渗透规避链
# 同一台主机在 1 小时内观察到 3+ 种规避技术时触发

# Splunk 关联搜索:
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离地攻击二进制文件(Living Off the Land Binary),被对手重用的合法 Windows 工具
痕迹清除(T1070)清除日志、删除文件或修改产物以清除攻陷证据

工具与系统

  • Sysmon:具有内核级可见性的高级 Windows 系统监控工具
  • Microsoft Defender for Endpoint:具有高级搜寻(KQL)功能的 EDR,用于规避检测
  • CrowdStrike Falcon:基于 IOA 的行为检测,用于规避技术
  • Elastic Security:具有内置 ATT&CK 规避技术检测规则的 SIEM
  • Sigma 规则:与厂商无关的检测规则格式,具有丰富的规避规则库

常见误区

  • 进程注入规则引起的告警疲劳:许多合法工具(AV、辅助功能)执行进程注入。维护已知合法源进程的白名单。
  • 缺少 Sysmon 事件 ID 8/10:默认 Sysmon 配置可能不捕获 CreateRemoteThread 或 ProcessAccess。使用全面的 Sysmon 配置。
  • 忽略父进程上下文:来自 cmd.exe 的可疑命令行只有在 cmd.exe 的父进程异常时才值得关注(例如 Excel 生成 cmd.exe)。
  • 不跨事件类型关联:单个事件通常是良性的。将多个弱信号组合(进程创建 + 网络连接 + 文件创建)以获得高置信度检测。
Skills enregistrées