Detects fileless malware and in-memory attacks on endpoints evading traditional AV. Builds detection rules for PowerShell attacks, reflective DLL injection, WMI persistence, and registry-resident malware.
npx claudepluginhub killvxk/cybersecurity-skills-zhThis skill uses the workspace's default tool permissions.
在以下情况下使用本技能:
Detects fileless malware and in-memory attacks on endpoints using PowerShell logging, Sysmon telemetry, and AMSI. Builds detections for PowerShell exploits, reflective DLL injection, WMI persistence.
Detects fileless malware and in-memory attacks on endpoints using Sysmon, PowerShell logging, and AMSI telemetry. Builds rules for PowerShell exploits, DLL injection, and WMI abuse.
Detects and analyzes in-memory fileless malware using PowerShell, WMI, .NET reflection, registry payloads, and LOLBins like mshta, regsvr32. For threat detection, memory forensics, and persistence checks.
Share bugs, ideas, or general feedback.
在以下情况下使用本技能:
不适用于检测基于文件的恶意软件或进行恶意软件逆向工程。
# 启用 PowerShell 脚本块日志记录(GPO 或注册表)
New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" `
-Name EnableScriptBlockLogging -Value 1 -PropertyType DWORD -Force
# 启用 PowerShell 模块日志记录
New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ModuleLogging" `
-Name EnableModuleLogging -Value 1 -PropertyType DWORD -Force
# 启用 PowerShell 转录
New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\Transcription" `
-Name EnableTranscripting -Value 1 -PropertyType DWORD -Force
# 用于无文件检测的 Sysmon 配置(关键事件):
# 事件 ID 1:进程创建(捕获 CommandLine)
# 事件 ID 7:镜像加载(DLL 加载)
# 事件 ID 8:CreateRemoteThread(注入)
# 事件 ID 10:进程访问(LSASS 访问)
# 事件 ID 19/20/21:WMI 事件
# 恶意 PowerShell 的指标:
# 编码命令执行
EventID: 1
CommandLine 包含:"powershell" 且 ("-enc" 或 "-e " 或 "-encodedcommand" 或 "FromBase64String")
# 下载摇篮(Download Cradle)模式
CommandLine 包含:"IEX" 且 ("Net.WebClient" 或 "DownloadString" 或 "Invoke-WebRequest")
CommandLine 包含:"Invoke-Expression" 且 "New-Object"
# AMSI 绕过尝试(事件 ID 4104 - 脚本块)
ScriptBlock 包含:"AmsiUtils" 或 "amsiInitFailed" 或 "SetValue.*amsi"
# 可疑 PowerShell 的 Splunk 查询:
index=windows source="WinEventLog:Microsoft-Windows-PowerShell/Operational" EventCode=4104
| where match(ScriptBlockText, "(?i)(iex|invoke-expression|downloadstring|net\.webclient|frombase64|bypass|amsiutils)")
| table _time host ScriptBlockText
# 反射式 DLL 注入 - 从内存加载 DLL 而不接触磁盘
# 检测:Sysmon 事件 7(ImageLoaded)其中镜像路径异常
EventID: 7
ImageLoaded 不以 "C:\Windows\" 开头 且不以 "C:\Program Files" 开头
# 进程空洞 - 创建挂起状态的进程,替换内存
# 检测:进程创建后紧接着内存写入
EventID: 1 + 10 关联
# 进程被创建然后以 PROCESS_VM_WRITE 访问
# APC 注入 - 将代码排队到线程的异步过程调用队列
# 检测:来自非系统进程的 Sysmon CreateRemoteThread
EventID: 8
SourceImage 不在 (已知合法来源) 中
# MDE KQL:
DeviceEvents
| where ActionType in ("CreateRemoteThreadApiCall", "NtAllocateVirtualMemoryApiCall")
| where InitiatingProcessFileName !in ("MsMpEng.exe", "svchost.exe")
| project Timestamp, DeviceName, ActionType, InitiatingProcessFileName,
InitiatingProcessCommandLine, FileName
# WMI 事件的 Sysmon 事件 ID 19/20/21
EventID: 19 # 检测到 WmiEventFilter 活动
EventID: 20 # 检测到 WmiEventConsumer 活动
EventID: 21 # 检测到 WmiEventConsumerToFilter 活动
# 除非预期,否则任何 WMI 事件订阅创建都是可疑的
# 常见恶意 WMI 持久化:
Consumer 包含:"CommandLineEventConsumer" 或 "ActiveScriptEventConsumer"
# 通过 osquery 或 PowerShell 查询 WMI 订阅:
Get-WMIObject -Namespace root\Subscription -Class __EventFilter
Get-WMIObject -Namespace root\Subscription -Class __EventConsumer
Get-WMIObject -Namespace root\Subscription -Class __FilterToConsumerBinding
# 存储在注册表值中并通过 PowerShell 执行的恶意软件
# Sysmon 事件 13 - 设置了含编码内容的注册表值
EventID: 13
TargetObject 包含:"CurrentVersion\Run"
Details:异常长的值或 Base64 编码内容
# 检测查询:
index=sysmon EventCode=13
| where match(Details, "[A-Za-z0-9+/=]{100,}")
| table _time host TargetObject Details Image
| 术语 | 定义 |
|---|---|
| 无文件恶意软件 | 完全在内存中运行、不向磁盘写入可执行文件的恶意软件 |
| AMSI | 反恶意软件扫描接口(Antimalware Scan Interface),允许安全产品在执行前检查脚本内容的 Windows API |
| 反射式 DLL 注入 | 从内存而非磁盘加载 DLL,避免基于文件的检测 |
| 进程空洞(Process Hollowing) | 创建合法进程的挂起状态,并用恶意代码替换其内存 |
| 脚本块日志记录 | 捕获反混淆脚本内容的 PowerShell 日志功能(事件 ID 4104) |