investigating-phishing-email-incident
调查钓鱼(Phishing)邮件事件,从初始用户举报开始,经过邮件头分析、URL/附件引爆、 受影响用户识别和遏制行动,使用 Splunk、Microsoft Defender 和沙箱分析平台等 SOC 工具。 适用于收到的钓鱼邮件举报需要进行完整事件调查以确定范围和影响时。
Best use case
investigating-phishing-email-incident is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
调查钓鱼(Phishing)邮件事件,从初始用户举报开始,经过邮件头分析、URL/附件引爆、 受影响用户识别和遏制行动,使用 Splunk、Microsoft Defender 和沙箱分析平台等 SOC 工具。 适用于收到的钓鱼邮件举报需要进行完整事件调查以确定范围和影响时。
Teams using investigating-phishing-email-incident 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
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/investigating-phishing-email-incident/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How investigating-phishing-email-incident Compares
| Feature / Agent | investigating-phishing-email-incident | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
调查钓鱼(Phishing)邮件事件,从初始用户举报开始,经过邮件头分析、URL/附件引爆、 受影响用户识别和遏制行动,使用 Splunk、Microsoft Defender 和沙箱分析平台等 SOC 工具。 适用于收到的钓鱼邮件举报需要进行完整事件调查以确定范围和影响时。
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
# 调查钓鱼邮件事件
## 适用场景
以下情况使用本技能:
- 用户通过钓鱼举报按钮或服务台工单举报可疑邮件
- 邮件安全网关标记了绕过初始过滤器的邮件
- 自动检测识别出凭据收割 URL 或恶意附件
- 针对组织的钓鱼攻击活动需要进行范围评估
**不适用于**没有恶意意图的垃圾邮件或营销邮件——将这些邮件路由给邮件管理员进行过滤器调优。
## 前置条件
- 访问邮件网关日志(Proofpoint、Mimecast 或 Microsoft Defender for Office 365)
- 配置了邮件日志摄取(O365 消息跟踪、Exchange 跟踪日志)的 Splunk 或 SIEM
- 用于 URL/附件引爆的沙箱(Any.Run、Joe Sandbox 或 Hybrid Analysis)
- 用于邮件搜索和清除操作的 Microsoft Graph API 或 Exchange 管理中心
- URLScan.io 和 VirusTotal API 密钥
## 工作流程
### 步骤 1:提取并分析邮件头
从举报邮件中获取完整邮件头(`.eml` 文件):
```python
import email
from email import policy
with open("phishing_sample.eml", "rb") as f:
msg = email.message_from_binary_file(f, policy=policy.default)
# 提取关键邮件头
print(f"From: {msg['From']}")
print(f"Return-Path: {msg['Return-Path']}")
print(f"Reply-To: {msg['Reply-To']}")
print(f"Subject: {msg['Subject']}")
print(f"Message-ID: {msg['Message-ID']}")
print(f"X-Originating-IP: {msg['X-Originating-IP']}")
# 解析 Received 头(从下向上追溯真实来源)
for header in reversed(msg.get_all('Received', [])):
print(f"Received: {header[:120]}")
# 检查认证结果
print(f"Authentication-Results: {msg['Authentication-Results']}")
print(f"DKIM-Signature: {msg.get('DKIM-Signature', 'NONE')[:80]}")
```
关键检查项:
- **SPF**:`Return-Path` 域是否与发送 IP 匹配?查看 `spf=pass` 或 `spf=fail`
- **DKIM**:签名是否有效?`dkim=pass` 确认邮件在传输过程中未被修改
- **DMARC**:`From` 域是否与 SPF/DKIM 域对齐?`dmarc=fail` 表明存在欺骗
### 步骤 2:分析 URL 和附件
**URL 分析:**
```python
import requests
# 向 URLScan.io 提交 URL
url_to_scan = "https://evil-login.example.com/office365"
response = requests.post(
"https://urlscan.io/api/v1/scan/",
headers={"API-Key": "YOUR_KEY", "Content-Type": "application/json"},
json={"url": url_to_scan, "visibility": "unlisted"}
)
scan_id = response.json()["uuid"]
print(f"扫描 URL:https://urlscan.io/result/{scan_id}/")
# 在 VirusTotal 检查 URL 信誉
import vt
client = vt.Client("YOUR_VT_API_KEY")
url_id = vt.url_id(url_to_scan)
url_obj = client.get_object(f"/urls/{url_id}")
print(f"VT 得分:{url_obj.last_analysis_stats}")
client.close()
```
**附件分析:**
```python
import hashlib
# 计算文件哈希值
with open("attachment.docx", "rb") as f:
content = f.read()
md5 = hashlib.md5(content).hexdigest()
sha256 = hashlib.sha256(content).hexdigest()
print(f"MD5: {md5}")
print(f"SHA256: {sha256}")
# 向 MalwareBazaar 查询
response = requests.post(
"https://mb-api.abuse.ch/api/v1/",
data={"query": "get_info", "hash": sha256}
)
print(response.json()["query_status"])
```
将附件提交至沙箱(Any.Run 或 Joe Sandbox)进行动态分析,检查宏执行、PowerShell 运行和 C2 回调。
### 步骤 3:确定攻击活动范围
在 Splunk 中搜索同一钓鱼邮件的所有收件人:
```spl
index=email sourcetype="o365:messageTrace"
(SenderAddress="attacker@evil-domain.com" OR Subject="Urgent: Password Reset Required"
OR MessageId="<phishing-message-id@evil.com>")
earliest=-7d
| stats count by RecipientAddress, DeliveryStatus, MessageTraceId
| sort - count
```
或者使用 Microsoft Graph API:
```python
import requests
headers = {"Authorization": f"Bearer {access_token}"}
params = {
"$filter": f"subject eq 'Urgent: Password Reset Required' and "
f"receivedDateTime ge 2024-03-14T00:00:00Z",
"$select": "sender,toRecipients,subject,receivedDateTime",
"$top": 100
}
response = requests.get(
"https://graph.microsoft.com/v1.0/users/admin@company.com/messages",
headers=headers, params=params
)
messages = response.json()["value"]
print(f"找到 {len(messages)} 封匹配邮件")
```
### 步骤 4:识别受影响用户(谁点击了)
检查代理/Web 日志,查找访问了钓鱼 URL 的用户:
```spl
index=proxy dest="evil-login.example.com" earliest=-7d
| stats count, values(action) AS actions, latest(_time) AS last_access
by src_ip, user
| lookup asset_lookup_by_cidr ip AS src_ip OUTPUT owner, category
| sort - count
| table user, src_ip, owner, actions, count, last_access
```
检查是否有凭据被提交(向钓鱼域名的 POST 请求):
```spl
index=proxy dest="evil-login.example.com" http_method=POST earliest=-7d
| stats count by src_ip, user, url, status
```
### 步骤 5:遏制行动
**从所有邮箱清除邮件:**
```powershell
# Microsoft 365 合规搜索和清除
New-ComplianceSearch -Name "Phishing_Purge_2024_0315" `
-ExchangeLocation All `
-ContentMatchQuery '(From:attacker@evil-domain.com) AND (Subject:"Urgent: Password Reset Required")'
Start-ComplianceSearch -Identity "Phishing_Purge_2024_0315"
# 搜索完成后执行清除
New-ComplianceSearchAction -SearchName "Phishing_Purge_2024_0315" -Purge -PurgeType SoftDelete
```
**封锁指标:**
- 将发件人域名添加到邮件网关封锁列表
- 将钓鱼 URL 域名添加到 Web 代理封锁列表
- 将附件哈希添加到终端检测封锁列表
- 为钓鱼域名创建 DNS 黑洞条目
**重置被入侵凭据:**
```powershell
# 强制受影响用户重置密码
$impactedUsers = @("user1@company.com", "user2@company.com")
foreach ($user in $impactedUsers) {
Set-MsolUserPassword -UserPrincipalName $user -ForceChangePassword $true
Revoke-AzureADUserAllRefreshToken -ObjectId (Get-AzureADUser -ObjectId $user).ObjectId
}
```
### 步骤 6:记录并报告
创建包含完整时间线、IOC、受影响用户和已采取修复行动的事件报告。
```spl
| makeresults
| eval incident_id="PHI-2024-0315",
reported_time="2024-03-15 09:12:00",
sender="attacker@evil-domain[.]com",
subject="Urgent: Password Reset Required",
url="hxxps://evil-login[.]example[.]com/office365",
recipients_count=47,
clicked_count=5,
credentials_submitted=2,
emails_purged=47,
passwords_reset=2,
domains_blocked=1,
disposition="真阳性 - 凭据钓鱼攻击活动"
| table incident_id, reported_time, sender, subject, url, recipients_count,
clicked_count, credentials_submitted, emails_purged, passwords_reset, disposition
```
## 核心概念
| 术语 | 定义 |
|------|------|
| **SPF(发件人策略框架)** | DNS TXT 记录,指定哪些邮件服务器被授权代表某域名发送邮件 |
| **DKIM** | 域密钥识别邮件(DomainKeys Identified Mail)——证明邮件内容在传输过程中未被篡改的密码学签名 |
| **DMARC** | 基于域的邮件认证、报告和一致性(Domain-based Message Authentication, Reporting and Conformance)——结合 SPF 和 DKIM 对齐的策略 |
| **凭据收割(Credential Harvesting)** | 使用伪造登录页面捕获用户名/密码组合的钓鱼技术 |
| **商业邮件欺诈(BEC)** | 利用被入侵或伪造的高管邮件进行金融欺诈的社会工程攻击 |
| **消息跟踪(Message Trace)** | O365/Exchange 日志,显示邮件路由、投递状态和过滤操作,用于取证分析 |
## 工具与系统
- **Microsoft Defender for Office 365**:邮件安全平台,含安全链接、安全附件和威胁浏览器用于调查
- **URLScan.io**:免费 URL 分析服务,捕获屏幕截图、DOM、Cookie 和网络请求
- **Any.Run**:交互式沙箱,用于引爆恶意文件和 URL 并进行实时行为分析
- **Proofpoint TAP**:目标攻击防护仪表板,显示每个用户的点击 URL 和已投递威胁
- **PhishTool**:专用钓鱼邮件分析平台,自动化邮件头解析和 IOC 提取
## 常见场景
- **凭据钓鱼**:伪造 O365 登录页面——检查代理中的 POST 请求,对提交者强制重置密码
- **启用宏的文档**:含 VBA 宏的 Word 文档——沙箱显示 PowerShell 下载加载器,检查终端执行情况
- **二维码钓鱼(Quishing)**:邮件包含链接到凭据收割网站的二维码——解码二维码,将 URL 提交至沙箱
- **线程劫持**:攻击者利用被入侵邮箱在现有线程中回复——检查不可能的旅行路径或新收件箱规则
- **语音邮件钓鱼**:含 HTML 附件的伪造语音邮件通知——分析附件中的重定向链
## 输出格式
```
钓鱼事件报告 — PHI-2024-0315
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
举报时间: 2024-03-15 09:12 UTC,举报人 jsmith(财务部)
发件人: attacker@evil-domain[.]com(SPF:失败,DKIM:无,DMARC:失败)
主题: Urgent: Password Reset Required
载荷: 凭据收割 URL
IOC:
URL: hxxps://evil-login[.]example[.]com/office365
域名: evil-login[.]example[.]com(注册于 2024-03-14,Namecheap)
IP: 185.234.xx.xx(VT:12/90 恶意)
范围:
收件人: 财务和 HR 部门 47 名用户
点击者: 5 名用户访问了钓鱼 URL
已提交: 2 名用户输入了凭据(通过代理日志中的 POST 请求确认)
遏制措施:
[已完成] 通过合规搜索清除 47 封邮件
[已完成] 代理和 DNS 黑洞已封锁该域名
[已完成] 2 名用户密码已重置,会话已撤销
[已完成] 两个被入侵账号已强制启用 MFA
[已完成] 收件箱规则已审计——未发现转发规则
状态: 已解决——无证据表明被入侵后发生横向移动
```Related Skills
triaging-security-incident
使用 NIST SP 800-61r3 和 SANS PICERL 框架对安全事件进行初始分类,确定严重性、范围和所需响应行动。 按类型对事件分类,根据业务影响分配优先级,并路由到相应的响应团队。适用于事件分类、 安全告警分类、严重性评估、事件优先级排序或初始事件分析等请求场景。
triaging-security-incident-with-ir-playbook
使用结构化 IR Playbook 对安全事件进行分类和优先排序,确定严重性、分配响应团队并启动适当的响应程序。
testing-for-email-header-injection
测试 Web 应用程序邮件功能中的 SMTP 头部注入漏洞,这些漏洞允许攻击者注入额外的邮件头部、修改收件人,并通过联系表单实施垃圾邮件中继。
performing-red-team-phishing-with-gophish
使用 Python gophish 库自动化 GoPhish 钓鱼模拟活动。创建含追踪像素的邮件模板、 配置 SMTP 发送配置文件、从 CSV 构建目标组、发起活动,并分析结果, 包括打开率、点击率和凭据提交统计数据,用于安全意识评估。
performing-ransomware-incident-response
执行结构化的勒索软件事件响应,包括遏制、解密评估、从备份恢复以及根除勒索软件持久化机制。
performing-phishing-simulation-with-gophish
GoPhish 是一个开源钓鱼模拟框架,供安全团队开展授权的钓鱼意识培训活动,提供活动管理、邮件模板创建、着陆页克隆和综合报告功能。
performing-cloud-incident-containment-procedures
在 AWS、Azure 和 GCP 中执行云原生事件遏制,包括隔离受攻陷资源、撤销凭据、保全取证证据,以及应用安全组限制以防止横向移动。
performing-adversary-in-the-middle-phishing-detection
检测和响应中间人(AiTM)钓鱼攻击,这类攻击使用 EvilProxy、Evilginx 和 Tycoon 2FA 等反向代理工具包绕过 MFA 并窃取会话令牌。
investigating-ransomware-attack-artifacts
识别、收集和分析勒索软件攻击制品,以确定变种、初始访问向量、加密范围和恢复选项。
investigating-insider-threat-indicators
调查内部威胁(Insider Threat)指标,包括数据渗漏(Data Exfiltration)尝试、未授权访问模式、 策略违规和离职前行为,结合 SIEM 分析、DLP 告警和 HR 数据关联进行调查。 适用于 SOC 团队收到 HR 内部威胁转介、检测到员工异常数据移动, 或需要为潜在内部威胁建立调查时间线时。
implementing-ticketing-system-for-incidents
实施集成事件工单系统,将 SIEM 告警对接 ServiceNow、Jira 或 TheHive, 用于结构化事件跟踪、SLA 管理、升级工作流和合规文档记录。 适用于 SOC 团队需要通过自动化工单创建、分配路由和解决跟踪来规范事件生命周期管理时。
implementing-soar-playbook-for-phishing
使用 Splunk SOAR REST API 自动化网络钓鱼事件响应,包括创建容器、添加制品并触发剧本