SMTP uses STARTTLS extension to upgrade SMTP to SMTP Secure (STMPS). According the the RFC, the client and server starts TLS as follows:
S: <waits for connection on TCP port 25> C: <opens connection> S: 220 mail.imc.org SMTP service ready C: EHLO mail.example.com S: 250-mail.imc.org offers a warm hug of welcome S: 250-8BITMIME S: 250-STARTTLS S: 250 DSN C: STARTTLS S: 220 Go ahead C: <starts TLS negotiation> C & S: <negotiate a TLS session> C & S: <check result of negotiation> C: EHLO mail.example.com S: 250-mail.imc.org touches your hand gently for a moment S: 250-8BITMIME S: 250 DSN
In the same document, the specs mention the possibility of MITM:
A man-in-the-middle attack can be launched by deleting the "250 STARTTLS" response from the server.
What I do not get it from the specs is: What delete exactly means? is it deleting the content of the message but sending it empty? (i.e. corrupting it) or dropping it so the client does not receive it?
If it means dropping the message so the client does not receive it, will the server send
250 DSN ? it is not clear to me if 250-STARTTLS dropped what is the next message going to be? how the client gets to know that it must send
EHLO mail.example.com and that there is not