A big problem when you want to install an unknown plugin in your WordPress Blog is always if the plugin would be vulnerable to SQL injection attacks that could lead to a very high risk for you website.
A simple method to prevent SQL injection attacks and remote file inclusion (RFI) in most plugins, is to block the direct load of the plugin script files (.php) by adding this code at the begin of every .php file that contains code used to include files or to manage data in the database:
if ('filename.php' == basename($_SERVER['SCRIPT_FILENAME'])) die ('Access not allowed!');
Using this method it is not allowed to load directly from the browser the script and if an attacker will try to inject malicious code, it will fail since we use the function die() to terminate the script:
If we analyze public exploit codes that are used to exploit vulnerabilities of public WordPress Plugins, we can see that all attackers need to load the script directly to inject the evil code and with this method its injected code will never be executed:
[»]SQL : http://server/[Plugins]/?event_id=[inj3ct C0dE]