SMTP User Enumeration
The mail server's responses to the VRFY, EXPN or RCPT TO commands reveal whether a user or mailbox exists, letting outsiders build a list of valid accounts.
| Severity | Medium |
| CVSS 3.1 | 5.3 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N Open in the calculator |
| CVSS 4.0 | 6.9 CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-204: Observable Response Discrepancy |
| MITRE ATT&CK | T1589.002 Email Addresses |
| Category | Information Disclosure |
Description
The SMTP server responds differently to valid and invalid user names, which lets anyone who can connect to it test whether accounts exist. Three commands are used: VRFY asks the server to confirm a user or mailbox, EXPN asks it to expand a mailing list into its members, and RCPT TO, which names a message's recipient, is commonly rejected straight away for unknown recipients and accepted for valid ones. The first two serve no essential purpose on a server that accepts mail from the internet. The third reflects recipient validation, which is good practice because it avoids accepting and then bouncing mail for unknown recipients, so the aim there is to slow enumeration rather than to remove the difference.
Because mailbox names usually match account names or the email addresses used to sign in elsewhere, the results are directly useful to an attacker. A list of valid user names or email addresses is the starting point for password spraying against email, VPN and other internet-facing sign-in pages, and for targeted phishing. The disclosure itself gives no access, and the attacker still needs a source of candidate names, but it removes the guesswork that would otherwise make these attacks slower and noisier. The impact is greater where the same names are used to sign in to services that lack multi-factor authentication.
The issue is confirmed by connecting to the server and comparing its responses to known valid and invalid names, manually or with tools such as smtp-user-enum or the Nmap smtp-enum-users script, which try each method in turn.
Remediation
Remove the commands that disclose users, and slow down enumeration through recipient checks:
- Disable
VRFYandEXPN. On Postfix, setdisable_vrfy_command = yes; on Sendmail, includenovrfyandnoexpn(orgoaway) inPrivacyOptions; on other servers, use the equivalent setting. - Keep rejecting unknown recipients, but limit how quickly a client can test them: on Postfix, use the error limits and delays
smtpd_soft_error_limit,smtpd_hard_error_limitandsmtpd_error_sleep_time, together with connection rate limits; on Microsoft Exchange, keep recipient filtering with tarpitting on receive connectors, which delays responses to slow down directory harvesting. - Where mail is filtered by a gateway or cloud service in front of the server, make sure the internal server cannot also be reached directly from the internet.
- Reduce the value of any names obtained by enforcing multi-factor authentication and lockout or rate limiting on the services users sign in to.
Confirm the fix by repeating the VRFY and EXPN tests, which should no longer distinguish valid users, and by checking that rapid RCPT TO guessing is slowed or the connection dropped.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.