Clisec
ProductsAnti-spamPrecise filtering of spam and bulk campaigns, without penalizing legitimate mail.Anti-phishing & BECStops impersonation, malicious links, and email fraud before the inbox.cPanel® pluginOne agent protects the whole server; each user manages from their cPanel.Explore
PricingGuidesContactAbout us
Guide · cPanel server

Brute force and password spraying against email: how to stop them on cPanel

How to spot brute force and password spraying against mail accounts in Dovecot and Exim logs, and stop them with cPHulk, TLS and strong passwords.

Updated on 8 min readClisec team

In short

Every mail server exposed to the internet sees password-guessing attempts daily. Brute force tries many passwords against one account; password spraying tries a few common passwords against many accounts, slowly, to avoid lockouts. You spot them by counting authentication failures in /var/log/maillog and /var/log/exim_mainlog, and you stop them with cPHulk, encrypted-only connections and mandatory strong passwords.

Three ways to guess a password

AttackHow it worksWhat it looks like in the logs
Brute forceHundreds of passwords against a single accountMany failures in a row for the same user from a few IPs
Password sprayingA few common passwords ("Summer2026", "Company123") against many accountsOne or two failures per user, across many users, from rotating IPs
Credential stuffingUsername/password pairs leaked from other sitesFew attempts, sometimes succeeding on the first try

Password spraying is the most dangerous one for a hosting provider: each account gets so few attempts that per-account lockouts never trigger, and a single user with a common password is all the attacker needs.

How to spot them in the logs

Dovecot (IMAP and POP3) logs failures to /var/log/maillog with lines like imap-login: Disconnected (auth failed, 1 attempts in 2 secs): user=<sales@domain.com>, method=PLAIN, rip=203.0.113.25. Exim logs SMTP authentication failures to /var/log/exim_mainlog as dovecot_login authenticator failed.

# IPs with the most failed IMAP/POP3 logins
grep "auth failed" /var/log/maillog | grep -o "rip=[0-9a-f.:]*" | sort | uniq -c | sort -rn | head

# Users with the most failures (an even spread across many users = spraying)
grep "auth failed" /var/log/maillog | grep -o "user=<[^>]*>" | sort | uniq -c | sort -rn | head -30

# SMTP authentication failures
grep "authenticator failed" /var/log/exim_mainlog | grep -o "set_id=[^)]*" | sort | uniq -c | sort -rn | head

Look for two patterns: one IP with hundreds of failures (brute force, easy to block), and dozens of different users with one or two failures each in the same time window (spraying, harder). If a successful login from a foreign IP follows a wave of failures, treat that account as compromised.

Configure cPHulk

cPHulk is the brute-force protection built into cPanel. It covers cPanel, WHM, webmail, IMAP, POP3 and SMTP. Configure it in WHM › Security Center › cPHulk Brute Force Protection:

  1. Add your own and your office IPs to the allow list first, so you don't lock yourself out.
  2. Enable both username-based and IP-based protection. The first protects targeted accounts; the second blocks attacking IPs.
  3. Use moderate thresholds: for example, 5 failures per IP within 15 minutes, and a block of several hours after repeated failures.
  4. If your customers are in only a few countries, consider blocking countries they should never log in from (Countries Management).

cPHulk counts attempts per IP and per username. Against distributed spraying, with many IPs and few attempts per account, it helps little. That's why the measures in the next section matter just as much.

If you run ConfigServer Security & Firewall (CSF), its LF_POP3D, LF_IMAPD and LF_SMTPAUTH settings block IPs with too many failures at the firewall, and LF_DISTATTACK detects distributed attacks against a single account.

Close the doors they rely on

  • Disable plaintext authentication: in WHM › Service Configuration › Mailserver Configuration, set "Allow Plaintext Authentication" to No, so no password ever travels unencrypted.
  • Mandatory strong passwords in WHM › Security Center › Password Strength Configuration. Spraying relies precisely on weak, common passwords.
  • Unique passwords. A password reused and leaked elsewhere works on the first try.
  • Review unused accounts. Mailboxes of former staff or test accounts with old passwords are a favorite target.
PortUseRecommendation
25Server-to-server deliveryOpen, with no user authentication
465Client submission with implicit TLSRecommended
587Client submission with STARTTLSRecommended
110Unencrypted POP3Close it or require STARTTLS
995POP3 over TLSRecommended if users need POP3
143Unencrypted IMAPClose it or require STARTTLS
993IMAP over TLSRecommended

If an attack succeeded

Change the password, check the mailbox's forwarders and filters, and see whether the account started sending spam. The full procedure is in compromised email account. Keep in mind that, besides brute force, the other big way passwords get stolen is credential phishing, which no failed-login lockout can stop.

Frequently asked questions

What is password spraying?

An attack that tries a few very common passwords against many accounts, slowly and from different IPs, so failed-login lockouts never trigger.

Can cPHulk lock out my own users?

Yes, if someone misconfigures their mail client and keeps retrying an old password. That's why it's worth allow-listing office IPs and checking the blocks in WHM before blaming the user.

Should I close ports 110 and 143?

Ideally, clients use 995 and 993 with TLS. If you can't close them, at least disable plaintext authentication so no password travels unencrypted.

Does cPanel two-factor authentication protect email?

It protects access to cPanel and WHM, but not IMAP, POP3 or SMTP. For email, what counts is strong unique passwords, cPHulk and encrypted connections.

Protect inbound email on your whole server

Besides brute force, passwords get stolen through phishing. Clisec blocks those emails across your cPanel server before they reach the inbox.

Request a demoSee the cPanel plugin

Keep reading

Guide · cPanel serverCompromised email account on cPanel: how to find it and stop the spamFind the account or script sending spam, cut it off, clean the queue and close the way in.ReadComplete guide · cPanel servercPanel email security: the complete guide for server administratorsThe five layers that protect email on a cPanel server, with a 15-minute checklist.ReadGuide · Credential theftCredential phishing: fake login pages"Your mailbox is full" alerts and fake webmail pages: how to recognize them and what to do if someone fell for it.Read