smtp-penetration-testing

Conduct comprehensive security assessments of SMTP (Simple Mail Transfer Protocol) servers to identify vulnerabilities including open relays, user enumeration, weak authentication, and misconfiguration. This skill covers banner grabbing, user enumeration techniques, relay testing, brute force attacks, and security hardening recommendations.

davila7/claude-code-templatesUpdated Apr 8, 2026

Works with

Claude CodeCursorClineWindsurfCodexGooseGitHub CopilotZed

0

total installs

0

this week

24.2K

GitHub stars

0

upvotes

Install Skill

Run in your terminal

$npx skills add https://github.com/davila7/claude-code-templates --skill smtp-penetration-testing

0

installs

0

this week

24.2K

stars

Installation Guide

How to use smtp-penetration-testing on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your machine
  • Node.js 16+ with npm — verify with node --version
  • Active project directory where you want to add smtp-penetration-testing
2

Run the install command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/davila7/claude-code-templates --skill smtp-penetration-testing

Fetches smtp-penetration-testing from davila7/claude-code-templates and configures it for Cursor.

3

Select Cursor when prompted

The CLI shows a list of agents. Use arrow keys and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ────────────────
│ · Cline · Codex · Goose · Windsurf
│ ●Cursor(selected)
│ · Cursor · Aider · Continue
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/smtp-penetration-testing

Restart Cursor to activate smtp-penetration-testing. Access via /smtp-penetration-testing in your agent's command palette.

Security Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.

Documentation

SMTP Penetration Testing

Purpose

Conduct comprehensive security assessments of SMTP (Simple Mail Transfer Protocol) servers to identify vulnerabilities including open relays, user enumeration, weak authentication, and misconfiguration. This skill covers banner grabbing, user enumeration techniques, relay testing, brute force attacks, and security hardening recommendations.

Prerequisites

Required Tools

# Nmap with SMTP scripts
sudo apt-get install nmap

# Netcat
sudo apt-get install netcat

# Hydra for brute force
sudo apt-get install hydra

# SMTP user enumeration tool
sudo apt-get install smtp-user-enum

# Metasploit Framework
msfconsole

Required Knowledge

  • SMTP protocol fundamentals
  • Email architecture (MTA, MDA, MUA)
  • DNS and MX records
  • Network protocols

Required Access

  • Target SMTP server IP/hostname
  • Written authorization for testing
  • Wordlists for enumeration and brute force

Outputs and Deliverables

  1. SMTP Security Assessment Report - Comprehensive vulnerability findings
  2. User Enumeration Results - Valid email addresses discovered
  3. Relay Test Results - Open relay status and exploitation potential
  4. Remediation Recommendations - Security hardening guidance

Core Workflow

Phase 1: SMTP Architecture Understanding

Components: MTA (transfer) → MDA (delivery) → MUA (client)

Ports: 25 (SMTP), 465 (SMTPS), 587 (submission), 2525 (alternative)

Workflow: Sender MUA → Sender MTA → DNS/MX → Recipient MTA → MDA → Recipient MUA

Phase 2: SMTP Service Discovery

Identify SMTP servers and versions:

# Discover SMTP ports
nmap -p 25,465,587,2525 -sV TARGET_IP

# Aggressive service detection
nmap -sV -sC -p 25 TARGET_IP

# SMTP-specific scripts
nmap --script=smtp-* -p 25 TARGET_IP

# Discover MX records for domain
dig MX target.com
nslookup -type=mx target.com
host -t mx target.com

Phase 3: Banner Grabbing

Retrieve SMTP server information:

# Using Telnet
telnet TARGET_IP 25
# Response: 220 mail.target.com ESMTP Postfix

# Using Netcat
nc TARGET_IP 25
# Response: 220 mail.target.com ESMTP

# Using Nmap
nmap -sV -p 25 TARGET_IP
# Version detection extracts banner info

# Manual SMTP commands
EHLO test
# Response reveals supported extensions

Parse banner information:

Banner reveals:
- Server software (Postfix, Sendmail, Exchange)
- Version information
- Hostname
- Supported SMTP extensions (STARTTLS, AUTH, etc.)

Phase 4: SMTP Command Enumeration

Test available SMTP commands:

# Connect and test commands
nc TARGET_IP 25

# Initial greeting
EHLO attacker.com

# Response shows capabilities:
250-mail.target.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-8BITMIME
250 DSN

Key commands to test:

# VRFY - Verify user exists
VRFY admin
250 2.1.5 [email protected]

# EXPN - Expand mailing list
EXPN staff
250 2.1.5 [email protected]
250 2.1.5 [email protected]

# RCPT TO - Recipient verification
MAIL FROM:<[email protected]>
RCPT TO:<[email protected]>
# 250 OK = user exists
# 550 = user doesn't exist

Phase 5: User Enumeration

Enumerate valid email addresses:

# Using smtp-user-enum with VRFY
smtp-user-enum -M VRFY -U /usr/share/wordlists/users.txt -t TARGET_IP

# Using EXPN method
smtp-user-enum -M EXPN -U /usr/share/wordlists/users.txt -t TARGET_IP

# Using RCPT method
smtp-user-enum -M RCPT -U /usr/share/wordlists/users.txt -t TARGET_IP

# Specify port and domain
smtp-user-enum -M VRFY -U users.txt -t TARGET_IP -p 25 -d target.com

Using Metasploit:

use auxiliary/scanner/smtp/smtp_enum
set RHOSTS TARGET_IP
set USER_FILE /usr/share/wordlists/metasploit/unix_users.txt
set UNIXONLY true
run

Using Nmap:

# SMTP user enumeration script
nmap --script smtp-enum-users -p 25 TARGET_IP

# With custom user list
nmap --script smtp-enum-users --script-args smtp-enum-users.methods={VRFY,EXPN,RCPT} -p 25 TARGET_IP

Phase 6: Open Relay Testing

Test for unauthorized email relay:

# Using Nmap
nmap -p 25 --script smtp-open-relay TARGET_IP

# Manual testing via Telnet
telnet TARGET_IP 25
HELO attacker.com
MAIL FROM:<[email protected]>
RCPT TO:<[email protected]>
DATA
Subject: Relay Test
This is a test.
.
QUIT

# If accepted (250 OK), server is open relay

Using Metasploit:

use auxiliary/scanner/smtp/smtp_relay
set RHOSTS TARGET_IP
run

Test variations:

# Test different sender/recipient combinations
MAIL FROM:<>
MAIL FROM:<test@[attacker_IP]>
MAIL FROM:<[email protected]>

RCPT TO:<[email protected]>
RCPT TO:<"[email protected]">
RCPT TO:<test%[email protected]>

Phase 7: Brute Force Authentication

Test for weak SMTP credentials:

# Using Hydra
hydra -l admin -P /usr/share/wordlists/rockyou.txt smtp://TARGET_IP

# With specific port and SSL
hydra -l admin -P passwords.txt -s 465 -S TARGET_IP smtp

# Multiple users
hydra -L users.txt -P passwords.txt TARGET_IP smtp

# Verbose output
hydra -l admin -P passwords.txt smtp://TARGET_IP -V

Using Medusa:

medusa -h TARGET_IP -u admin -P /path/to/passwords.txt -M smtp

Using Metasploit:

use auxiliary/scanner/smtp/smtp_login
set RHOSTS TARGET_IP
set USER_FILE /path/to/users.txt
set PASS_FILE /path/to/passwords.txt
set VERBOSE true
run

Phase 8: SMTP Command Injection

Test for command injection vulnerabilities:

# Header injection test
MAIL FROM:<[email protected]>
RCPT TO:<[email protected]>
DATA
Subject: Test
Bcc: [email protected]
X-Injected: malicious-header

Injected content
.

Email spoofing test:

# Spoofed sender (tests SPF/DKIM protection)
MAIL FROM:<[email protected]>
RCPT TO:<[email protected]>
DATA
From: CEO <[email protected]>
Subject: Urgent Request
Please process this request immediately.
.

Phase 9: TLS/SSL Security Testing

Test encryption configuration:

# STARTTLS support check
openssl s_client -connect TARGET_IP:25 -starttls smtp

# Direct SSL (port 465)
openssl s_client -connect TARGET_IP:465

# Cipher enumeration
nmap --script ssl-enum-ciphers -p 25 TARGET_IP

Phase 10: SPF, DKIM, DMARC Analysis

Check email authentication records:

# SPF/DKIM/DMARC record lookups
dig TXT target.com | grep spf            # SPF
dig TXT selector._domainkey.target.com    # DKIM
dig TXT _dmarc.target.com                 # DMARC

# SPF policy: -all = strict fail, ~all = soft fail, ?all = neutral

Quick Reference

Essential SMTP Commands

Command Purpose Example
HELO Identify client HELO client.com
EHLO Extended HELO EHLO client.com
MAIL FROM Set sender MAIL FROM:<[email protected]>
RCPT TO Set recipient RCPT TO:<[email protected]>
DATA Start message body DATA
VRFY Verify user VRFY admin
EXPN Expand alias EXPN staff
QUIT End session QUIT

SMTP Response Codes

Code Meaning
220 Service ready
221 Closing connection
250 OK / Requested action completed
354 Start mail input
421 Service not available
450 Mailbox unavailable
550 User unknown / Mailbox not found
553 Mailbox name not allowed

Enumeration Tool Commands

Tool Command
smtp-user-enum smtp-user-enum -M VRFY -U users.txt -t IP
Nmap nmap --script smtp-enum-users -p 25 IP
Metasploit use auxiliary/scanner/smtp/smtp_enum
Netcat nc IP 25 then manual commands

Common Vulnerabilities

Vulnerability Risk Test Method
Open Relay High Relay test with external recipient
User Enumeration Medium VRFY/EXPN/RCPT commands
Banner

List & Monetize Your Skill

Submit your Claude Code skill and start earning

Get started →

Use Cases

Task Automation & Efficiency

Automate repetitive workflows and reduce manual effort

Example

Generate reports, summarize documents, draft communications

Save 3-5 hours per week on routine tasks

Knowledge Enhancement

Learn new skills, understand complex topics, get expert guidance

Example

Explain concepts, provide examples, suggest learning resources

Accelerate learning and skill development by 2x

Quality Improvement

Enhance output quality through reviews, suggestions, and refinements

Example

Review drafts, suggest improvements, catch errors

Improve work quality by 30-40% with less effort

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client with skill support
  • Clear understanding of task or problem to solve
  • Willingness to iterate and refine outputs

Time Estimate

15-45 minutes depending on use case complexity

Steps

  1. 1Install skill using provided installation command
  2. 2Test with simple use case relevant to your work
  3. 3Evaluate output quality and relevance
  4. 4Iterate on prompts to improve results
  5. 5Integrate into regular workflow if valuable

Common Pitfalls

  • Expecting perfect results without iteration
  • Not providing enough context in prompts
  • Using skill for tasks outside its intended scope
  • Accepting outputs without review and validation

Best Practices

✓ Do

  • +Start with clear, specific prompts
  • +Provide relevant context and constraints
  • +Review and refine all outputs before using
  • +Iterate to improve output quality
  • +Document successful prompt patterns

✗ Don't

  • Don't use without understanding skill limitations
  • Don't skip validation of outputs
  • Don't share sensitive information in prompts
  • Don't expect skill to replace human judgment

💡 Pro Tips

  • Be specific about desired format and style
  • Ask for multiple options to choose from
  • Request explanations to understand reasoning
  • Combine AI efficiency with human expertise

When to Use This

✓ Use when

Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.

✗ Avoid when

Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.

Learning Path

  1. 1Familiarize yourself with skill capabilities and limitations
  2. 2Start with low-risk, non-critical tasks
  3. 3Progress to more complex and valuable use cases
  4. 4Build expertise through regular use and experimentation

Related Skills

Reviews

4.573 reviews
  • M
    Min ReddyDec 20, 2024

    I recommend smtp-penetration-testing for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • G
    Ganesh MohaneDec 16, 2024

    I recommend smtp-penetration-testing for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • K
    Kabir KhanDec 16, 2024

    smtp-penetration-testing reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • N
    Noah AbebeDec 16, 2024

    Keeps context tight: smtp-penetration-testing is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • K
    Kiara ShahDec 16, 2024

    Solid pick for teams standardizing on skills: smtp-penetration-testing is focused, and the summary matches what you get after install.

  • M
    Min ThomasDec 16, 2024

    smtp-penetration-testing fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • S
    Sophia SinghNov 19, 2024

    Useful defaults in smtp-penetration-testing — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Y
    Yash ThakkerNov 15, 2024

    Useful defaults in smtp-penetration-testing — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • O
    Omar BansalNov 11, 2024

    Registry listing for smtp-penetration-testing matched our evaluation — installs cleanly and behaves as described in the markdown.

  • K
    Kofi MartinezNov 11, 2024

    Solid pick for teams standardizing on skills: smtp-penetration-testing is focused, and the summary matches what you get after install.

showing 1-10 of 73

1 / 8

Discussion

Comments — not star reviews
  • No comments yet — start the thread.