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
#To get backlink from your blog unknowingly
#To get access to your blog
#To redirect your blog to spam links
#To add their advertisements and banners.
# to simply get your website down
Not only free themes and plugins also the premium nulled plugins and themes that you have download from DOWNLOAD and torrents may also infected by these malicious codes.
Yes, I too fell prey to these free plugins.Few days back, I was desperate to download a very famous nulled plugin from DOWNLOAD 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 all we all in blackhat forum here...
Detecting Malicious codes
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.
Check for Virus and Trojans
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.
Check for unwanted codes in Plugins
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.
Check for Theme authenticity
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.
How WordPress blogs are hacked ?
WordPress blogs are hacked because of these four reasons
1.WebHost and your infected computer
Note: If you interest, you can also read this pdf: