SMTP

ABOUT

Simple Mail Transfer Protocol (SMTP) is a protocol for sending emails in an IP network. It can be used between an email client and an outgoing mail server or between two SMTP servers. SMTP is often combined with the IMAP or POP3 protocols, which can fetch emails and send emails. In principle, it is a client-server-based protocol. Commonly it's using TCP/25 port for unencrypted SMTP, TCP/465 for encrypted, TCP/587 for SMTP STARTLS Encryption.

SMTP Servers

SMTP servers play a crucial role in preventing spam by supporting ESMTP with SMTP-Auth for authorized user-based email sending. The Mail User Agent (MUA) converts emails into headers and bodies, uploading them to the SMTP server. A Mail Transfer Agent (MTA) checks email size and spam, storing it after validation. Occasionally, a Mail Submission Agent (MSA) or Relay server validates email origin to prevent Open Relay Attacks. The MTA then searches DNS for the recipient mail server's IP address.

MUA(Client) -> MSA(Submission Agent) -> MTA(Open Relay) -> MDA(Mail Delivery Agent) -> POP3/IMAP(Mailbox)

SMTP Commands

Connect

Usually to connect to SMTP server you could use just telnet and specify port.

telnet 13.13.13.13 25

VRFY

VRFY command is used for checking if the username is valid by requesting SMTP Server

VRFY root
252 2.0.0 root

EXPN

EXPN command is same as VRFY, but if you send it a distribution list, it'll send back all users from it.

RCPT TO

RCPT TO command specifies the recipient. The more times you use it, the more recipients you could find.

Microsoft 365

Sure here wouldn't be whole section about 365, but that's a common thing, so let's write here some basic enum techniques.

0365spray

O365spray is a tool for username enum and password spraying attack at Microsoft 365

Validate

Username Enum

Password Spraying

Tips2Hack

  1. Nmap - Open Relay

  1. Nmap - SMTP all scripts enum

  1. DIG - Mail Server enum

  1. Host Mail Server

  1. smtp-user-enum script [LINK]

  1. Hydra - Password attacks

If you know user, as example "bob", don't use just username, use it with domain/email address, likebob@amogus.com

  1. Swaks - Send mail

Last updated