This guide provides a procedure for a server administrator to investigate and identify the scope of a security breach on a cPanel account. This process helps determine if unauthorized access occurred, which files were modified, and if any malicious processes are currently active.
Before you begin
You will need:
Root or WHM administrative access
The specific cPanel username or account name
A list of recent login IP addresses (if available from logs)
Access to the server's command line (SSH)
Investigate account access and login activity
In WHM, navigate to Account Information > User Management (or search for the specific account in the List Accounts tool).
Locate the compromised account and select the Show Users or User Information option to view the specific cPanel user.
Access the cPanel & WHM section and select Report Suspicious Activity or Account Activity (depending on your specific version) to view recent login attempts.
Review the IP addresses and timestamps of recent logins.
Identify any IP addresses that do not belong to the account owner or known locations.
Check for active malicious processes
Log into the server via SSH as root.
Run the command
toporhtopto view active processes.Look for processes with high CPU or memory usage that are not associated with standard web services (e.g.,
apache,mysql,php-fpm).Identify processes running from unusual directories, such as
/tmpor/dev/shm.If a suspicious process is identified, note the Process ID (PID) and the command path.
Audit file system changes
In the server terminal, navigate to the home directory of the affected account.
Use the
findcommand to identify files modified within the last 24–48 hours:find /home/username/public_html -mtime -2
Check for the presence of common malicious files, such as
.phpfiles with randomized names (e.g.,x73j.php) or hidden files (e.g.,.hidden.php).Check the
.htaccessfile for unauthorized redirects or rules that bypass security.
Review mailer and outgoing traffic
In WHM, navigate to Email > Mail Delivery Reports or Mail Queue Manager.
Search for the compromised account's email addresses.
Check for a high volume of outgoing mail or "bounced" messages, which may indicate the account is being used to send spam.
Review the Exim Mail Queue to see if any messages are currently pending for delivery from the compromised account.
Check for unauthorized scripts or shells
Search the account's web directory for common "web shell" signatures.
Use the
grepcommand to look for common functions used in shells, such aseval(),passthru(), orsystem(), in files modified recently.Check for any newly created
.phpfiles in thewp-contentorincludesdirectories if the site uses a CMS like WordPress.
Confirm the result
The investigation is complete when you have:
Identified the source IP addresses of unauthorized logins.
Identified any malicious processes currently running on the server.
Identified specific files or directories that were modified or added by an intruder.
Determined if the account is currently being used to send unauthorized mail.
If the account is confirmed compromised
If you confirm that an account has been compromised, follow these steps:
Suspend the account immediately in WHM to stop active scripts and mail delivery.
Change the cPanel password for the affected user.
Remove any malicious files identified during the investigation.
Update the .htaccess file to its original state.
Notify the customer of the breach and provide them with the list of identified issues.
Limitations
This procedure identifies the scope of a breach but does not perform a full security audit or "clean" the site of all potential vulnerabilities.
If a site is heavily infected, the number of malicious files may be too large to identify manually; in these cases, a specialized security scan is recommended.
This process does not provide a guarantee that the account is "clean" after the investigation; it only identifies the current state of the account.
