What Is Malware and How to Remove It from a Site

What is malware
Malware (short for "malicious software") is any software designed to damage, disrupt, or gain unauthorized access to a computer system. In the context of websites, malware is malicious code that hackers inject into your site's files or database with the goal of stealing data, redirecting visitors, sending spam, or using your server for further attacks.
Statistics show around 30,000 websites get hacked every day. WordPress sites are an especially common target because they account for about 43% of all sites on the internet, which makes them attractive for mass attacks. But no site is immune - any site can be a victim without adequate protection.
Types of malware on websites
Backdoor
A backdoor is a hidden access mechanism that lets a hacker get into your site even after you change passwords. Backdoor files are often disguised as legitimate system files with innocent names like "wp-config-backup.php" or "class-user.php". They allow the hacker to retake control of the site at any time.
Phishing pages
Hackers can place fake login pages on your site that impersonate banks, email services, or social networks. The goal is to trick visitors into entering their credentials. This is especially dangerous because your site can end up on blacklists and Google may show a "Deceptive site ahead" warning.
SEO spam (Pharma hack)
One of the most common attacks where hackers inject hidden links and content into your pages. Usually these are links to pharmaceutical sites, gambling sites, or pirated software. You may not see the spam because it is often shown only to Googlebot, not to regular visitors.
Redirect malware
This type of malware redirects your site visitors to malicious sites. The redirect can be conditional - for example, only mobile users are redirected, or only visitors coming from Google search. This makes detection harder because you as the owner may never see the redirect.
Cryptominer
Hackers inject JavaScript code that uses your visitors' computers to mine cryptocurrency. This slows down visitors' computers, drains their power and battery, while the profits go to the hacker. Browsers and antivirus programs today actively block this type of malware.
How to recognize an infected site
- Google warning: The browser shows "This site may harm your computer" or "Deceptive site ahead".
- Ranking drop: A sudden drop in Google search without an obvious reason.
- Unknown files: New files on the server you did not create.
- Slow site: The site is significantly slower than before without traffic changes.
- Spam comments: An explosion of spam comments or user accounts.
- Hosting notification: The hosting provider notifies you about suspicious activity.
- Blacklisting: Your site or IP is on blacklists.
Steps to remove malware
Step 1: Make a backup
Before any intervention, make a complete copy of the site (files + database). Even if the site is infected, the backup lets you return to the current state if something goes wrong during cleanup.
Step 2: Identify the infection
Use scanning tools: Sucuri SiteCheck (free online scanner), Wordfence (WordPress plugin), or VirusTotal to check individual files. In cPanel, use Imunify or ClamAV scanner if available. Also check Google Search Console for security issues.
Step 3: Remove the malware
Reinstall WordPress core files (wp-admin and wp-includes directories) with fresh copies. Check wp-content/uploads for PHP files (there should be none - images only). Review wp-config.php and .htaccess for suspicious code. Remove all themes and plugins you do not use. Update all remaining themes and plugins to the latest versions.
Step 4: Clean the database
Check the database for injected scripts - especially the wp_posts and wp_options tables. Look for suspicious JavaScript, iframe tags, and base64-encoded strings. Use phpMyAdmin to search and clean.
Step 5: Change all passwords
Change passwords for: the WordPress admin account, FTP/SFTP, cPanel, the database, and email accounts. Use strong, unique passwords for each account. Regenerate WordPress security keys in wp-config.php using the WordPress salt generator.
Prevention - how to prevent infection
- Regular updates: Update WordPress, themes, and plugins as soon as new versions are available.
- Strong passwords: Use password managers and two-factor authentication.
- Security plugin: Install Wordfence or Sucuri for active protection.
- Regular backups: Automatic daily backups to an external location.
- SSL certificate: Use HTTPS for encrypted communication.
- Limit login attempts: Block IP addresses after multiple failed login attempts.
Conclusion
Malware on your site is a serious problem that can damage your reputation, Google rankings, and user trust. Prevention is always better than cure - keep the site updated, use strong passwords and security plugins. If an infection does occur, react quickly, clean the site systematically, and take all steps to prevent reinfection. At BeoHosting, our servers use Imunify360 for automatic malware detection and blocking, providing an additional protection layer for your site.
BeoHosting Team
10+ years of experience — Web hosting and infrastructure specialists
- Web Hosting
- WordPress Hosting
- VPS
- Dedicated Serveri
- Domeni
- SSL
- cPanel
- LiteSpeed
- Linux administracija
- DNS
Last updated: