### Approach
1. 배너 그래빙 및 서비스 확인
- `nc -nv $IP 25`
- `telnet $IP 25`
- 서버가 `Postfix`, `Sendmail`, `Microsoft Exchange` 등 무엇인지 확인하고, 해당 버전의 취약점이 있는지 검색한다.
2. User Enumeration
- `VRFY`: 특정 사용자가 있는지 확인 (e.g., `VRFY root`)
- 서버 응답이 `250`이면 존재, `550`이면 없음.
- `EXPN (Expand)`: 메일 리스트(그룹)의 실제 구성원을 확인
- `RCPT TO`: 메일 수신이 가능한지 확인하여 계정 존재 여부 유추
- 자동화 도구 활용
- `smtp-user-enum -M VRFY -U /usr/share/wordlists/metasploit/unix_users.txt -t $IP`
- `smtp-user-enum -M VRFY -U footprinting-wordlist.txt -t $IP -w 5 -v` verbose 태그를 넣어서 `<no result>`가 output 에 안보여야 함.
- `-w`태그 value를 조절
3. 메일 릴레이 취약점 점검 (Open Relay)
- 인증 없이 외부에서 내부로, 혹은 외부에서 또 다른 외부로 메일을 보낼 수 있는지 확인.
- 위험성: 스팸 메일 발송 서버로 악용되거나, 공격자가 내부 직원인 척 사칭 메일을 보낼 수 있음.
- `nmap --script smtp-open-relay $IP -v`
4. 피싱 및 악성 코드 배포
### Commands
| **Command** | **Description** |
| ------------ | ------------------------------------------------------------------------------------------------ |
| `AUTH PLAIN` | AUTH is a service extension used to authenticate the client. |
| `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. |
### HELO/EHLO
```bash
telnet <IP> 25
HELO mail1.inlanefreight.htb
VRFY root
MAIL FROM: <email address>
RCPT TO: <email address>
```
### Nmap
```bash
smtp-commands # default Nmap scripts
smtp-open-relay
```
###
Enumerate users in SMTP server
```bash
sudo apt install smtp-user-enum
smtp-user-enum -M VRFY -U userlist.txt -t <target_ip> -p 25
smtp-user-enum -M VRFY -U ../footprinting-wordlist.txt -t 10.129.144.53 -p 25 -v -w 10
```
- `-M`: Method (`VRFY`, `EXPN`, or `RCPT`).
- `-U`: Path to user list.
- `-t`: Target IP address.
- `-p`: SMTP port.
- `-w`: wait a maximum of n seconds for reply