> ## Documentation Index
> Fetch the complete documentation index at: https://www.0101isnothacking.nl/llms.txt
> Use this file to discover all available pages before exploring further.

# SMTP enumeration

> Active enumeration commands, dangerous settings, and command reference for the Simple Mail Transfer Protocol.

SMTP (Simple Mail Transfer Protocol) typically runs on ports 25, 587, and 465.

## Check open ports

```bash theme={null}
nmap -p25,587,465 ip
```

## Banner grabbing

```bash theme={null}
nc -nv ip 25
telnet ip 25
```

```text theme={null}
msf auxiliary/scanner/smtp/smtp_version
```

## SMTP verb testing

```text theme={null}
VRFY admin@example.com        # Directly asks if the user exists
EXPN staff-list               # Expands mailing lists (if enabled)
RCPT TO: test@example.com     # Checks if recipient is accepted

250 2.1.5 User exists → Valid user
550 5.1.1 User unknown → Invalid user
```

## Nmap scripts

```bash theme={null}
sudo nmap -p25,587,465 -sVC -A ip -o nmap_all.txt
sudo nmap -p25,587,465 -sVC --script smtp-open-relay
```

> [!NOTE]
>
> The `smtp-open-relay` script checks whether everyone is allowed to send an email.

## Check commands

1. Log in to SMTP and check if the `VRFY` command is allowed.
2. Perform enumeration on the SMTP service.

## Enumerate users

```bash theme={null}
smtp-user-enum -M VRFY -U users.txt -t ip -w 20
```

Change `-w` if the server verification is slow.

```text theme={null}
msf auxiliary/scanner/smtp/smtp_enum
```

## Steps

![SMTP enumeration steps](https://mintcdn.com/non-9fcb5a21/P-t86H21MW2fT7Il/images/16d0fbb25172.png?fit=max\&auto=format\&n=P-t86H21MW2fT7Il\&q=85\&s=ca0599ec2e9958ec16818642cd526010)

## Dangerous settings

```text theme={null}
mynetworks = 0.0.0.0/24
```

This means everyone from other networks is allowed to send an email without firewall verification.

## Login to SMTP

```bash theme={null}
telnet ip port
```

```text theme={null}
ehlo domain
vrfy username
```

## Commands

| Command | Description |
| - | - |
| `HELO` | The client logs in with its computer name and thus starts the session. |
| `MAIL FROM` | The client names the email sender. |
| `RCPT TO` | The client names the email recipient. |
| `DATA` | The client initiates the transmission of the email. |
| `RSET` | The client aborts the initiated transmission but keeps the connection between client and server. |
| `VRFY` | The client checks if a mailbox is available for message transfer. |
| `EXPN` | The client also checks if a mailbox is available for messaging with this command. |
| `NOOP` | The client requests a response from the server to prevent disconnection due to time-out. |
| `QUIT` | The client terminates the session. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.