detecting-fileless-attacks-on-endpoints

检测完全在内存(RAM)中执行、不向磁盘写入持久文件的无文件恶意软件和内存攻击, 规避传统杀毒软件。适用于为 PowerShell 攻击、反射式 DLL 注入、WMI 持久化和注册表驻留恶意软件 构建检测规则的场景。

9 stars

Best use case

detecting-fileless-attacks-on-endpoints is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

检测完全在内存(RAM)中执行、不向磁盘写入持久文件的无文件恶意软件和内存攻击, 规避传统杀毒软件。适用于为 PowerShell 攻击、反射式 DLL 注入、WMI 持久化和注册表驻留恶意软件 构建检测规则的场景。

Teams using detecting-fileless-attacks-on-endpoints should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/detecting-fileless-attacks-on-endpoints/SKILL.md --create-dirs "https://raw.githubusercontent.com/killvxk/cybersecurity-skills-zh/main/skills/detecting-fileless-attacks-on-endpoints/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/detecting-fileless-attacks-on-endpoints/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How detecting-fileless-attacks-on-endpoints Compares

Feature / Agentdetecting-fileless-attacks-on-endpointsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

检测完全在内存(RAM)中执行、不向磁盘写入持久文件的无文件恶意软件和内存攻击, 规避传统杀毒软件。适用于为 PowerShell 攻击、反射式 DLL 注入、WMI 持久化和注册表驻留恶意软件 构建检测规则的场景。

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 检测端点上的无文件攻击

## 使用场景

在以下情况下使用本技能:
- 为完全在内存中运行的无文件恶意软件构建检测规则
- 狩猎基于 PowerShell 的攻击、反射式 DLL 注入和 WMI 滥用
- 配置端点遥测(Sysmon、AMSI、PowerShell 日志记录)以捕获无文件攻击指标
- 调查传统 AV 未发现恶意文件的事件

**不适用于**检测基于文件的恶意软件或进行恶意软件逆向工程。

## 前置条件

- 已启用进程创建和 WMI 事件日志记录的 Sysmon
- 已启用 PowerShell 脚本块日志记录和模块日志记录
- 已启用 AMSI(反恶意软件扫描接口)用于脚本内容检查
- 具有行为检测能力的 EDR(MDE、CrowdStrike、SentinelOne)

## 操作流程

### 步骤 1:启用所需遥测

```powershell
# 启用 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 事件
```

### 步骤 2:检测基于 PowerShell 的攻击

```
# 恶意 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
```

### 步骤 3:检测进程注入技术

```
# 反射式 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
```

### 步骤 4:检测基于 WMI 的持久化

```
# 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
```

### 步骤 5:检测基于注册表的执行

```
# 存储在注册表值中并通过 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) |

## 工具与系统

- **Sysmon**:内核级进程、DLL 和 WMI 监控
- **AMSI**:Windows 脚本内容检查 API
- **PowerShell 日志记录**:脚本块、模块和转录日志记录
- **Microsoft Defender for Endpoint**:无文件技术的行为检测
- **Volatility 3**:用于事后无文件恶意软件分析的内存取证

## 常见误区

- **依赖基于文件的 AV**:扫描磁盘文件的传统 AV 完全无法检测无文件攻击。需要行为检测和 AMSI。
- **禁用了 PowerShell 日志记录**:没有脚本块日志记录,防御者将无法看到反混淆的 PowerShell 命令。
- **未检测 AMSI 绕过**:复杂攻击者在执行载荷前会绕过 AMSI。应将 AMSI 绕过尝试检测设为高优先级告警。
- **未监控 WMI 事件**:WMI 持久化是 APT 组织的常用技术。必须启用 Sysmon 事件 19-21。

Related Skills

hunting-for-ntlm-relay-attacks

9
from killvxk/cybersecurity-skills-zh

通过分析 Windows 事件 4624 中的 NTLMSSP 认证、IP 与主机名不匹配、Responder 流量签名、SMB 签名状态及跨域可疑认证模式,检测 NTLM 中继攻击。

hunting-for-dcsync-attacks

9
from killvxk/cybersecurity-skills-zh

通过分析 Windows 事件 ID 4662,检测非域控制器账户发起的未授权 DS-Replication-Get-Changes 请求,从而发现 DCSync 攻击。

hunting-credential-stuffing-attacks

9
from killvxk/cybersecurity-skills-zh

通过分析认证日志中的登录速率异常、ASN 多样性、密码喷洒(password spray)模式和失败登录的地理分布,检测凭据填充(credential stuffing)攻击。对 Splunk 或原始日志数据进行统计分析。适用于调查账户接管活动或为认证滥用构建检测规则。

detecting-wmi-persistence

9
from killvxk/cybersecurity-skills-zh

通过分析 Sysmon 事件 ID 19、20 和 21 中的恶意 EventFilter、EventConsumer 和 FilterToConsumerBinding 创建,检测 WMI 事件订阅持久化。

detecting-t1548-abuse-elevation-control-mechanism

9
from killvxk/cybersecurity-skills-zh

通过监控注册表修改、进程提升标志和异常的父子进程关系,检测提升控制机制滥用,包括 UAC 绕过、sudo 利用和 setuid/setgid 操纵。

detecting-t1055-process-injection-with-sysmon

9
from killvxk/cybersecurity-skills-zh

通过分析 Sysmon 事件中的跨进程内存操作、远程线程创建和异常 DLL 加载模式,检测进程注入技术(T1055),包括经典 DLL 注入、进程镂空和 APC 注入。

detecting-t1003-credential-dumping-with-edr

9
from killvxk/cybersecurity-skills-zh

利用 EDR 遥测数据、Sysmon 进程访问监控和 Windows 安全事件关联,检测针对 LSASS 内存、SAM 数据库、NTDS.dit 和缓存凭据的 OS 凭据转储技术。

detecting-suspicious-powershell-execution

9
from killvxk/cybersecurity-skills-zh

检测可疑的 PowerShell 执行模式,包括编码命令、下载器(download cradles)、AMSI 绕过尝试以及受限语言模式规避。

detecting-suspicious-oauth-application-consent

9
from killvxk/cybersecurity-skills-zh

使用 Microsoft Graph API、审计日志和权限分析,检测 Azure AD / Microsoft Entra ID 中的高风险 OAuth 应用授权同意,识别非法同意授权攻击。

detecting-supply-chain-attacks-in-ci-cd

9
from killvxk/cybersecurity-skills-zh

扫描 GitHub Actions 工作流和 CI/CD 流水线配置,检测供应链攻击(Supply Chain Attack)向量, 包括未固定的 Action 版本、通过表达式的脚本注入、依赖混淆(Dependency Confusion)和密钥泄露。 使用 PyGithub 和 YAML 解析进行自动化审计。适用于加固 CI/CD 流水线或调查被攻击的构建系统。

detecting-stuxnet-style-attacks

9
from killvxk/cybersecurity-skills-zh

本技能涵盖检测遵循Stuxnet攻击模式的复杂网络物理攻击——在修改PLC逻辑的同时欺骗传感器读数以向操作员隐藏操控行为。内容涉及PLC逻辑完整性监控、基于物理的过程异常检测、工程师工作站入侵指标、USB传播攻击向量,以及从IT到OT横向移动直至过程操控的多阶段攻击链检测。

detecting-sql-injection-via-waf-logs

9
from killvxk/cybersecurity-skills-zh

分析 WAF(Web 应用防火墙,ModSecurity/AWS WAF/Cloudflare)日志,检测 SQL 注入(SQL Injection)攻击活动。 解析 ModSecurity 审计日志和 JSON WAF 事件日志,识别 SQLi 模式(UNION SELECT、OR 1=1、SLEEP()、BENCHMARK()), 追踪攻击源,关联多阶段注入尝试,并生成带 OWASP 分类的事件报告。