New guide: how to warm up a dedicated IP without hurting your reputation. Read now →
Log in
MigoSMTP
SecurityUpdated 26 Oct 2026

SMTP VRFY and EXPN Commands: Why They Are Usually Disabled and How to Check Your Server

What VRFY and EXPN do, why they leak user data, how attackers use them for harvesting, how to disable them in Postfix, Exim and Sendmail, alternatives for address checking and how to test your own server.

MO
Written by Mateus Oliveira
Senior SMTP and MTA Engineer
Reviewed by Omar Haddad
  • Published2 Feb 2025
  • Read time6 min
  • Length1,279 words
Share this guide

SMTP has two old commands that were helpful in the friendly early internet and are mostly a liability today. VRFY asks the server whether a given user or address exists, and EXPN asks the server to expand a mailing list into its member addresses. Both were meant to help administrators debug delivery. In the modern internet they give attackers a free, fast way to learn which accounts exist, which names are valid on your domain and who belongs to internal lists, information that feeds spam, phishing and password attacks. Nearly every hardening guide says to disable them. This guide explains what the commands do, what they reveal, how to turn them off on common servers, what to use instead for legitimate checks and how to confirm the result. It pairs with tarpitting and rate shaping, brute-force defence and reading an SMTP transcript.

VRFYAsks whether an address or user is valid; may return the full mailbox name
EXPNExpands a list or alias to its members
RiskUser enumeration, list disclosure and a head start for targeted attacks
FixDisable both or answer with a neutral reply; limit address probing through RCPT TO too

What the commands do

C: VRFY alice
S: 252 2.0.0 Alice Example <[email protected]>

C: VRFY nobody
S: 550 5.1.1 <nobody>: Recipient address rejected: User unknown

C: EXPN staff
S: 250-2.1.5 Bob Smith <[email protected]>
S: 250-2.1.5 Carol Jones <[email protected]>
S: 250 2.1.5 Dave Brown <[email protected]>

RFC 5321 describes both commands and explicitly allows servers to refuse them, replying with 252 (cannot verify, but will accept the message), 502 (command not implemented) or 550 (access denied). It also notes that VRFY and EXPN can be disabled for security reasons. In practice almost every public server answers 252 or 502 for both commands.

Why they matter

ExposureWhat an attacker gains
Valid account namesA list of real usernames to try in password guessing or credential stuffing
Full names behind addressesMaterial for convincing phishing and social engineering
Distribution list membersA map of who works where and who receives which mail
Naming conventionConfirms patterns such as first.last, so more addresses can be guessed
Internal alias structureReveals shared mailboxes and system accounts that should stay private
Low costNo authentication is needed and responses arrive in milliseconds

Address probing through RCPT TO

Disabling VRFY does not remove all enumeration, because a normal delivery attempt also reveals validity: the server accepts or rejects RCPT TO for each recipient. Public servers must reject unknown recipients at SMTP time (to avoid backscatter; see the null sender), so a patient attacker can still test addresses one by one. You cannot hide this entirely, but you can raise the cost: rate-limit recipients per connection and per client, delay or disconnect after repeated unknown-user errors, alert on high rates of 550 replies and consider an anti-harvesting policy on edge gateways. Some environments with high sensitivity accept all recipients at the edge and bounce later; that approach causes backscatter and is generally not recommended.

Disabling the commands

ServerSettingNotes
Postfixdisable_vrfy_command = yes in main.cf, then postfix reloadPostfix then answers VRFY with 502
EximEnsure the ACL acl_smtp_vrfy is not permissive; the default denies VRFY from non-trusted hostsCheck the ACL and the host list allowed to verify
SendmailAdd noexpn and novrfy (or goaway) to PrivacyOptions in sendmail.mc and rebuild the configurationThe goaway option sets several privacy flags at once
Microsoft ExchangeVRFY and EXPN are not supported on default receive connectorsReview connector settings and anonymous permissions
Courier, Haraka, othersConsult the documentation; many do not implement the commandsTest the behaviour instead of assuming
Gateways and cloud filtersOften answer 252 or 502 by designVerify with a test
# Postfix
postconf -e 'disable_vrfy_command = yes'
postfix reload

# Quick test (replace host and user)
printf 'EHLO test.example\r\nVRFY postmaster\r\nEXPN staff\r\nQUIT\r\n' | nc mail.example.com 25

An acceptable test result is a reply such as 502 (not implemented), 252 without disclosing details, or 550/554 that is the same for every name. A reply that returns a mailbox name for one input and an error for another still allows enumeration.

Legitimate needs and alternatives

  • Debugging delivery. Use RCPT TO in a controlled test from a trusted host, the server log and the queue. See reading mail logs.
  • Checking whether an address exists before sending. Use a verification service that combines syntax, DNS and risk checks, or simply send and process bounces. Direct mailbox probing is unreliable (catch-all servers) and may be treated as abuse. See the email validator.
  • Listing members of a list. Use the list management tool with proper authentication rather than a public SMTP command.
  • Internal tools. If an internal application needs address lookup, give it an authenticated directory query (LDAP or an API) instead of SMTP.
  1. Disable or restrict other legacy features you do not use: ETRN, TURN, DEBUG and WIZ in very old software.
  2. Hide detailed software versions in the banner where the policy allows. This is minor, but avoids needless disclosure.
  3. Require TLS and authentication on submission ports and keep port 25 for server-to-server mail. See ports.
  4. Ensure the server is not an open relay. See open relay checks.
  5. Rate-limit connections, recipients and unknown-user errors. See tarpitting.
  6. Use consistent replies for unknown users and disabled accounts so responses do not reveal which is which.
  7. Monitor for scans: many short connections from one IP issuing VRFY, EXPN or sequences of RCPT TO with sequential names.

Responses that avoid leaking

If you cannot disable the commands outright, for example on a gateway that you do not control, aim for uniform behaviour. A server should answer VRFY for existing and non-existing names in the same way, ideally with 252, which tells the client it cannot verify the user but will attempt delivery, or 502. It should not return different text, different timing or a full name for valid users. Timing is easy to overlook: a lookup that takes 5 milliseconds for unknown names and 50 for valid ones is itself an oracle. The same goes for RCPT TO: if an unknown mailbox is rejected instantly but a disabled mailbox causes a slow database lookup, attackers can measure the difference. Aim for consistent replies, consistent timing and a hard limit on how many failures one client may collect.

Also consider the information in your bounce messages and auto-replies. An out-of-office reply from a real mailbox confirms that it exists, and a bounce that includes detailed directory data can reveal internal structure. For public addresses these trade-offs are acceptable, but for sensitive internal accounts consider routing external mail through a gateway that answers uniformly. Whatever your policy, write it down so administrators and auditors know which behaviour is intended.

How to test your server

  1. Connect from outside your network with a tool such as Swaks, netcat or openssl s_client -starttls smtp.
  2. Send EHLO, then VRFY with a name you know exists and one you know does not, and compare replies.
  3. Send EXPN with the name of a list or alias.
  4. Try RCPT TO for existing and non-existing recipients and count how many unknown-user errors the server tolerates before slowing or disconnecting.
  5. Repeat after each configuration change or upgrade, and add the test to your regular security checks.
  6. Record results and share them with the owner of the gateway if the answer comes from a front-end appliance.

VRFY and EXPN belong to a gentler era. Turning them off costs nothing, removes an easy source of leaked information and sets the right tone: your server answers what it must for delivery and nothing more. Pair it with rate limits on recipient probing and you have closed the cheapest enumeration routes.

Check how your server looks from outside Test your sending IP for listings and exposure.

Open the blocklist check

References and further reading

Frequently asked questions

What does the SMTP VRFY command do?

It asks the server whether a user or address is valid and may return the full mailbox name.

Why should VRFY and EXPN be disabled?

They let anyone enumerate accounts and list members without authentication, which helps spam, phishing and password attacks.

How do I disable VRFY in Postfix?

Set disable_vrfy_command = yes in main.cf and reload Postfix.

Does disabling VRFY stop address harvesting?

No. RCPT TO responses still reveal valid addresses, so add rate limits and alerts for repeated unknown-user errors.

How can I test whether my server answers VRFY?

Connect with netcat or Swaks, send EHLO then VRFY for a known and unknown name and compare the replies.

Topics#vrfy#expn#enumeration#hardening#smtp
Was this guide helpful?Your answer helps us improve our documentation.

Start sending in minutes.

Create an account, add your domain and send your first email.

Get started Talk to sales