Malware protection and detection

Editor: Dmytro Sokol 1001 4 min Audio

If you would like to check, if your website is hacked, please check this article. Also, we have an article regarding website security, you can check it here. This article is dedicated to virus detection, curing and removal.

My website was hacked. What do I need to do?

1. Change passwords

Change all possible passwords. First of all, change the hosting and/or domain control panel password, hosting account password, FTP and email password, MySQL and MySQL user’s passwords.

2. Locate the vulnerability

Log-files can help you to locate the vulnerability used to hack your website. If you are not sure how to use the log-files, we recommend to ask an experienced webmaster to check them or just skip to the next point. Alternatively, you can check which files were edited recently via FTP-client. Most likely, the virus is located in those files.

3. Detect virus location

In most cases, the hackers goal is to access your website but not to infect your PC. That’s why hackers tend to insert malicious code into one of the website’s files instead of uploading a new .exe file (executable file; the virus itself can be an executable file of "hide" inside an executable file).

You can try to download your website files and scan them with your PC antivirus, however, your antivirus will not be able to detect website viruses as they differ from PC viruses.

Hosting companies usually provide an antivirus that is already installed in your control panel. Try scanning your website with it. Also, there are lots of various online virus scanners that you can use to detect viruses. Just be careful while choosing an online scanner because it can be a phishing website that looks completely legitimate. You can find the list of trusted antiviruses below.

  1. ClamAV - one of the best free antiviruses. It’s virus database is updated every 4 hours. It can be installed on your PC or your control panel. It’s main advantage is its versatility - it’s available for any OS: Linux, BSD or Windows.
  2. Comodo Web Inspector - an online antivirus and malware scanner. You can check the symptoms of malware "infection" and, if any of them is applicable for your site, fix it for free. Full protection is paid, at $10/mo, but it’s worth it because the protection includes lots of useful features such as blacklist repair and removal, fully managed web application firewall, secure content delivery network (CDN), protection from DDoS-attacks, SQL injections and XSS (cross-site scripting) etc.
  3. Sucuri - a quite popular, accurate and free online virus and malware scanner. It is also possible to purchase full protection at an additional cost. Similar to the previous one, full protection has lots of features that include 24/7 monitoring and a firewall.
  4. CXS (ConfigServer eXploit Scanner) - a very nice solution for Linux OS distributives, especially if it is used together with ClamAV. It scans scripts and files, particularly the ones that were edited recently, proactively monitors the system and removes or fixes infected files. You can check the whole feature list on the official website (the link is located above). The price of the tool is at $60, though, it is a lifetime license (you pay only once and use it as long as you wish).

4. Remove/delete viruses

You need to delete all of the "infected" files. The easiest and safest way is to replace them with files from your backup. In case you do not have a backup, you can either remove those files or try using a tool (antivirus, scanner etc) that fixes and cures "infected" files.

What kind of files do I need to remove?

In case your antivirus is merely a scanner (it does not fix or cure files), you can remove the "infected" files. Another option is to compare the "infected" file with the file from backup. Alternatively, you can lurk through your files and locate the following:

  • Words such as "exploit", "shell", "javascript", "iframe", "unescape", "eval", "String.fromCharCode" and "document.write";
  • "Behavior" attribute in CSS files;
  • Infected pictures. It is quite card to cure them, so you need to either delete them or replace them;
  • "Iframe" in databases should be deleted (You need to save the database to your PC and open it with a text editor, such as NotePad++);
  • Files such as wzxp.php that have unlikely for CMS file names should be removed;
  • Malicious code or redirects to an unknown site in .htaccess files;
  • Base64 code such as
"TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0
aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhb"
  • Eval () or preg_replace() functions.

Viruses detected and removed. What next?

If you used an antivirus (scanner) installed in your control panel to scan your website and fix all of the issues, then all you need to do is test it to check if everything works correctly.

In case you did download your website files and scanned them with a PC antivirus (which we don’t recommend to do), you need to delete all files from the website and upload the already scanned ones. Then you need to check if everything works correctly on your website. If not, you will need to reinstall the CMS and upload files from a backup, for instance. Most likely, the virus either removed important code from your files or the antivirus removed parts of code that it considered to be malicious (and they weren’t). That’s why we recommend to use trustworthy antiviruses or online scanners (you can find them above) rather than using a PC antivirus.

Once more

We recommend to scan your website one more time and change all of the passwords (hosting and/or domain control panel password, hosting account password, FTP and email password, MySQL and MySQL user’s passwords) once again.

Enhance website security

If you merely remove viruses, it’s very likely that your website will be "infected" with them quite soon. To prevent this from happening, we recommend to enhance your website security following this guide.

Sometimes the issue can be with the hosting provider. For instance, hackers found a vulnerability in the software that was installed on the server to access your server "neighbour" website. In this case your site can get infected as well. You need to inform the support team about this issue or just find a more reliable hosting provider.

Please note that if your site is "infected", you need to fix it as soon as possible because search engines may unlist your site ( as it can contain malicious content that can potentially harm visitors) and it will be quite hard to return your ranking positions afterwards.

My website was not hacked. Do I need to do something to prevent such situations?

1. Website and database backup

Lots of companies offer free daily backups. Still, we recommend to do them on your own. Firstly, even the most reliable hosting providers may have temporary issues with their servers. This is absolutely normal, however, your backups can be erased or not saved. Secondly, only files that were changed recently will be backed up by the hosting provider. They do not make full database and website backup every day. That’s why we recommend to save backups on your own on a remote server (more secure that your PC).

2. PC virus scan

Scan your PC every day. Use a reliable antivirus that updates its virus database at least every 24 hours (each 6 hours would be even better). You can also schedule an automatic virus scan, however, please make sure that you don’t give the antivirus permissions to automatically remove suspicious files.

3. Website scan

We recommend to scan your website at least three times a week. Also, it’s very important to scan the site before and after your installed a new plugin/theme/module even if the were downloaded from the official website.

If you would like to share your experience regarding various methods that help to detect or remove malicious software, feel free to leave your thoughts in the comments section. We will gladly add them to our article. If you have any questions, you are welcome to leave a comment as well and our experts will answer them as soon as possible.

Dmytro Sokol
Did not find an answer to your question?
Ask the experts! Answers are quick and go directly to your email.

Adding confirmation "I'm not a robot" you also agree to receive messages from hostings.info and accept its Privacy Policy, allowing hostings.info to store and process your personal information indicated above to provide requested content.

Ratings of hosting providers by site tasks
Hosting price

We highly recommend not to purchase the cheapest hosting package. Usually, they come with a row of issues: the server is often down, the hardware is outdated, lousy and slow support, registration and payment errors, etc.

For your convenience, we have created a tool that can help you to choose the right hosting package for you just by answering a few simple questions.

CMS

CMS is a content management system. A lot of hosting providers offer so-called CMS optimized packages. However, this is a marketing trick because most CMSs do not have special software or hosting requirements.

Free trial

Trial period is a period of time, usually from 7 to 30 days, during which you can use the hosting services for free to test them.

Moneyback policy allows the customer to receive a refund for his order within a certain period after the purchase.

OS

OS means the operating system is installed on the server. We recommend to choose Linux hosting unless your website requires another OS.

Other

Bulletproof hosting - it’s a type of service that allows to host almost any type of content, even the restricted one (adult content, warez, spam etc). Bulletproof hosting providers do not remove your content in case someone reports an abuse.

Unlimited hosting - refers to companies that provide packages with unlimited disk space, bandwidth, number of domains, databases or email accounts, etc. This is usually a marketing trick but sometimes you can find something worth a try.

Secure hosting - it’s a type of service when the hosting provider is mostly responsible for the security of the user’s account: updates the software installed on their servers, provides an antivirus and malware scanner, firewalls and basic anti-DDoS protection, etc.

DDoS-protected hosting - companies that provide packages that include anti-DDoS protection. These packages are considerably more expensive than regular ones. Nevertheless, they’re totally worth their price because the company will ensure that your website is secured from cyber attacks.

Technologies

Most websites require MySQL and PHP installed on the server to work correctly. Almost all hosting providers support these technologies.

ASP.NET is a Microsoft web application development platform.

Control panel

The more comfortable the control panel is, the easier will it be for you to change the website and hosting account settings.

Most hosting providers that are in TOP20 in our rating offer user-friendly control panels, such as cPanel, Plesk or DirectAdmin. That’s why we recommend to pay attention to other, more important parameters, while choosing a hosting provider.

Disk type