Apart from Official WordPress repository there are hundreds and thousands of websites which provides free WordPress themes and Plugins but the problem is you can not trust them always.
Yes, Most of them add a malicious code to themes and plugins which is not too easy for you to find out.
Before learning about the cure lets discuss about the cause.
Here is why they add their custom codes
Not only free themes and plugins also the premium nulled plugins and themes that you have download from Envato Market and torrents may also infected by these malicious codes.
Did you wonder what triggered me write this article ?
Yes, I too fell prey to these free plugins.Few days back, I was desperate to download a very famous nulled plugin from Envato Market and after installing it in my blog I got to know that the plugin was infected and it redirects my blog to a spam blog.
I immediately disabled the plugin and checked for the code that caused the redirection in plugin files. After an hour I found the code and immediately removed it [ I don’t use that plugin now ]
This incident taught me very important thing.
Never trust nulled WordPress plugins and themes
However many of you might want to use those nulled or free plugins and themes for God’s Sake, If you are one of them then read the remaining article
After downloading the plugin or theme,The first thing you should do is to check for virus,trojans and other worms that you may not like it.
Go to VirusTotal.com and upload the zip file to check for virus.
If your file is infected you will get a red signal and if not then you can move on to next step.
Now lets check for unwanted codes in plugins using another WordPress plugin called Exploit Scanner,which can be securely downloaded from WordPress website.
After installing it go to Dashboard >> Tools >> Exploit Scanner and run the scan.It will take some time to complete the scan and the time depends on number of plugins you have installed.
After the scan you can see a list of codes that are suspected.You can use the browser search function to find the plugins that you installed from outside WordPress repository.
Note : This plugin will also scan themes but you might to be interested to try the tip that I am about to give next.
Adding a backlink in a free theme is very common technique but you can easily find those exploited themes by the plugin called Theme Authenticity Checker (TAC).
Install the plugin and go to Dashboard >> Appearance >> TAC
You can see the list of themes installed with their authenticity result.It will give a warning if any encrypted links are found in a theme.
Its very rare to get hacked unless,We make mistake. So, security is in your hand : Either Act wisely or get fooled easily.