My website has been hacked!
The safest fix is to restore your whole account from before the attack, then change every password and key. Cleaning files one by one can't prove the attacker has gone.
Do this now
- Change your passwords: your cPanel password (guide) and your website admin passwords.
- Take the site offline if it's harming visitors (how to turn your website off).
- Note the details first. Write down each suspicious file's full path. With SSH, also save the "Change" time from
stat <file>, which shows when the file really appeared (the modified date in File Manager can be faked). Then delete it or set its permissions to 000. Either wipes that time, so record it first. Without SSH, send us the paths before removing anything and we'll record it. - Open a support ticket. We'll confirm the compromise, help find how the attacker got in, and advise next steps.
What to include
- Your cPanel username or the affected domain
- What you noticed and when, with the time zone
- Paths of any files you think were uploaded or changed, with their stat output if you have it, for example
public_html/wp-admin/example.php - Anything Imunify360 has flagged (cPanel > Security > Imunify360 > Malicious Scan History)
- Anything you've already changed or deleted
Please write it in your own words and tell us your goal. AI-drafted tickets tend to drift into questions that don't change the fix.
Why a full restore
Once an attacker can run code in your account, usually through a hijacked admin login or a vulnerable plugin, they can change any file, database, email setting or scheduled task in it. Backdoors hide in ordinary-looking files with faked dates, and malware scanners only catch what they recognise. Automated attacks do all this within minutes, so there's rarely just one file to clean. A full restore is the only way back to a known-good state.
Restoring your account
- Keep a copy if you need evidence. Download a full cPanel backup first. It includes your access logs, which the restore replaces. Never restore from it or copy files back from it.
- Pick a restore point from before the earliest sign of the attack. If you're unsure, go further back or ask us. Restore points cover 30 days (details).
- Restore the full account: cPanel > JetBackup 5 > Full Backups (guide). This overwrites your files, databases and mailboxes. If you get stuck, we'll run it for you.
- Change every password and key straight away (below).
- Close the way in. Update your software, plugins and themes, and remove what you don't use. We can help find what let the attacker in.
- Re-add recent changes, such as posts or orders, as content, not files or code.
If other sites share the same passwords or management tools, treat them as exposed too.
If you can't restore
If every restore point is after the attack (for example, it started more than 30 days ago), or a restore would lose data you can't replace, such as recent orders, you'll need to clean the site in place. Follow Steps to cleaning malware, and still change every password and key below. Contact us first so we can help find when and how the attacker got in.
Change every password and key
Do this straight after the restore, which brings back the old passwords and keys. Don't reuse any of them, and change them anywhere else they're used too.
What | Where |
|---|---|
cPanel password and 2FA | Client Area > Services > View Details > Change Password (guide), then cPanel > Security > Two-Factor Authentication |
Email passwords | cPanel > Email Accounts: every mailbox |
FTP and Web Disk | cPanel > FTP Accounts and Web Disk. Delete what you don't need. |
SSH keys | cPanel > SSH Access. Remove any you don't recognise. |
API tokens | cPanel > Security > Manage API Tokens. Revoke them all. |
Database passwords | cPanel > MySQL Databases, then update your site's config (for WordPress, |
Website admins | Reset every admin password; remove unknown users and application passwords |
WordPress secret keys | Replace the keys and salts in |
Third-party keys in your site | Payment, email and API keys: regenerate them with each provider |
Management tools and developer access | Reconnect with new credentials, and review who has access |
Stop it happening again
Most hacks start with a stolen admin password or out-of-date software.
- Update WordPress, plugins and themes on a regular schedule, and remove anything you don't use.
- Use unique passwords, turn on 2FA for admins, and limit failed login attempts.
- Restrict
wp-adminto your own IP addresses in.htaccessif you can. - Set file permissions to 644 for files, 755 for folders, and 440 or 400 for
wp-config.php. - Use a security plugin or web application firewall, such as Wordfence or Sucuri.
- Set up uptime or change monitoring, so you notice problems early.
- Keep unrelated sites on separate cPanel accounts, and keep your own off-site backups.
There's more in Security on Krystal Shared Hosting.