If your website has been infected with malware, it is important to clean it properly to prevent reinfection and avoid being blocked by search engines like Google. Malware can damage your site’s reputation, slow performance, and compromise user data.
This step-by-step guide explains how to remove malware from a cPanel-hosted website safely and effectively.
Before making any changes, always create a complete backup of your hosting account.
Log in to cPanel
Create a Full Account Backup
Download the backup and store it securely
This ensures you can restore your website if anything goes wrong during the cleanup process.
Use your malware scan results (such as from cpGuard) to locate infected files.
Review the scan report carefully
Note down the exact file paths
Common locations where malware is found:
/public_html/
/wp-content/plugins/
/wp-content/themes/
Delete files that are clearly infected or unfamiliar
Replace core CMS files with fresh copies from official sources
Reinstall plugins and themes from trusted providers only
⚠ Important: Never use nulled or pirated plugins or themes, as they are a major source of malware infections.
Malware can also hide inside the database.
Open phpMyAdmin from cPanel
Inspect database tables such as:
wp_options
wp_posts
Look for suspicious scripts, spam links, or unknown code
Remove malicious entries carefully
Always take a database backup before making changes.
Once malware is removed, update all access credentials immediately:
cPanel password
FTP accounts
Database user passwords
WordPress admin passwords
Email account passwords
Use strong, unique passwords for every account.
Keeping your software updated is critical for security.
Update your CMS (WordPress, Joomla, etc.)
Update all plugins and themes
Remove unused or inactive plugins and themes
Outdated software is one of the most common causes of website infections.
Use secure permission settings:
Folders: 755
Files: 644
Avoid using 777 permissions, as they allow anyone to modify files and increase security risks.
Strengthen your website’s defenses:
Enable ModSecurity in cPanel
Install a reputable security plugin (for WordPress users)
Activate firewall and malware protection tools
Disable unused services and access points
After cleanup is complete:
Run another malware scan using cpGuard
Confirm that no infected files remain
Ensure your website is fully clean
Once your site is secure:
Request a Google review if your site was blacklisted
Monitor your website regularly for suspicious activity
Schedule automatic backups
Perform routine malware scans
Cleaning malware properly not only restores your website but also helps protect your visitors and maintain search engine trust. Regular updates, backups, and security scans are the best defense against future infections.