Skip to content

Identifying the compromised account behind an Exim queue spike

A diagnostic sequence on a cPanel server that traces an Exim queue spike back to the specific cPanel user, script path, and authentication event responsible.

The first signal of an outbound abuse incident is rarely “we got compromised.” It’s usually a monitoring alert that the Exim queue jumped from 200 to 35,000 in fifteen minutes. The on-call needs to know within minutes which cPanel user is responsible, whether the abuse is through authenticated SMTP or a webform-to-mail script, and whether to suspend the user or kill a specific process. The data is in the logs; the trick is reading them in the right order.

What’s happening

Outbound abuse on cPanel takes two shapes. The first is authenticated SMTP from a compromised mailbox — the attacker logs in as a real user and sends through Exim’s submission port. The second is unauthenticated, server-local injection from a vulnerable PHP script, contact form, or compromised CMS. Both flow through the same Exim instance but leave very different log signatures.

How to verify

Start with the queue itself and ask who’s sending:

exim -bpc
exim -bp | awk '{print $4}' | grep -v "^$" | sort | uniq -c | sort -rn | head -20

Then cross-check authentication events:

grep "A=dovecot_login:" /var/log/exim_mainlog | awk '{print $NF}' | sort | uniq -c | sort -rn | head

For unauthenticated local injection, the source is a PHP process. Use exim_mainlog with U= (user the message ran as) to identify the cPanel account:

grep "U=user_cpanel" /var/log/exim_mainlog | head

When cwd= is present, you have the script’s working directory — often enough to spot the compromise.

The fix

  1. Suspend the suspected cPanel account immediately. WHM > List Accounts > Suspend, or whmapi1 suspendacct user=<user>. Do this before tracing further — the queue keeps growing while you read logs.
  2. Distinguish authenticated vs script-based abuse. If the top sender in the queue maps to a real authenticated mailbox, change that mailbox’s password and kill all sessions. If it maps to a cwd= in /home/<user>/public_html, find the script.
  3. Find the script. find /home/<user>/public_html -type f -mmin -60 lists recently modified files. Compromised WordPress sites often have an injected file in wp-content/uploads or a renamed wp-config.php backup.
  4. Pull the credentials that authenticated. Search /usr/local/cpanel/logs/access_log and Dovecot logs for recent successful logins from unusual IPs. Block those IPs at the firewall.
  5. Document the incident before resuming service. When the account is restored, the user needs to know what happened and what they need to fix on their side (rotate keys, update plugins, audit users).

For environments where compromise detection has to be measured in minutes and not hours, Stack Harbor wires the queue-spike alerting and triage scripts into cPanel server administration.