Saturday, December 20, 2014

Awesome WordPress Security Tips

1. Disable your HTTP Trace Method: 
It is prevented when your site attract Cross Site Tracing(XST) . Now you edit .htaccess from your server Apache configuration.

> RewriteEngine On
> RewriteCond %{REQUEST_METHOD} ^TRACE
> RewriteRule .* – [F]

2.Removing holder output form WordPress installation. 
Concerns:  It can prevented your wordpress functionality .Such as if you will use RSS feed ,then you comment this line.

You below's code paste your function.php file.

remove_action(‘wp_head’, ‘index_rel_link’);
remove_action(‘wp_head’, ‘feed_links’, 2);
remove_action(‘wp_head’, ‘feed_links_extra’, 3);
remove_action(‘wp_head’, ‘rsd_link’);
remove_action(‘wp_head’, ‘wlwmanifest_link’);
remove_action(‘wp_head’, ‘parent_post_rel_link’, 10, 0);
remove_action(‘wp_head’, ‘start_post_rel_link’, 10, 0);
remove_action(‘wp_head’, ‘adjacent_posts_rel_link_wp_head’, 10, 0);
remove_action(‘wp_head’, ‘wp_generator’);
remove_action(‘wp_head’, ‘wp_shortlink_wp_head’, 10, 0);
remove_action(‘wp_head’, ‘noindex’, 1);

3. Stop comment posting form proxy server.
You add below code in your .htaccess file.for this spam will be reduced 


RewriteCond %{REQUEST_METHOD} =POST
RewriteCond %{HTTP:VIA}%{HTTP:FORWARDED}%{HTTP:USERAGENT_VIA}%{HTTP:X_FORWARDED_FOR}%{HTTP:PROXY_CONNECTION} !^$ [OR]
RewriteCond %{HTTP:XPROXY_CONNECTION}%{HTTP:HTTP_PC_REMOTE_ADDR}%{HTTP:HTTP_CLIENT_IP} !^$
RewriteCond %{REQUEST_URI} !^/(wp-login.php|wp-admin/|wp-content/plugins/|wp-includes/).* [NC]
RewriteRule .* – [F,NS,L]

4.Change your WordPress default Database prefix
You may be know,WordPress default database prefix is “wp_”. So when you install WordPress for your purpose you change your prefix.Such as "rootitech_" .

5. Deny your danger string query
You add blew code in your .htacces file to prevent your XSS attract.
Inform: Some plugin and theme will not working if you will not deny string.

 <IfModule mod_rewrite.c>
RewriteCond %{QUERY_STRING} ../   [NC,OR]
RewriteCond %{QUERY_STRING} boot.ini [NC,OR]
RewriteCond %{QUERY_STRING} tag= [NC,OR]
RewriteCond %{QUERY_STRING} ftp: [NC,OR]
RewriteCond %{QUERY_STRING} http: [NC,OR]
RewriteCond %{QUERY_STRING} https:   [NC,OR]
RewriteCond %{QUERY_STRING} mosConfig [NC,OR]
RewriteCond %{QUERY_STRING} ^.*([|]|(|)|<|>|’|”|;|?|*).* [NC,OR]
RewriteCond %{QUERY_STRING} ^.*(%22|%27|%3C|%3E|%5C|%7B|%7C).* [NC,OR]
RewriteCond %{QUERY_STRING} ^.*(%0|%A|%B|%C|%D|%E|%F|127.0).* [NC,OR]
RewriteCond %{QUERY_STRING} ^.*(globals|encode|config|localhost|loopback).* [NC,OR]
RewriteCond %{QUERY_STRING} ^.*(request|select|insert|union|declare|drop).* [NC]
RewriteRule ^(.*)$ – [F,L]
</IfModule>

6. You add PHP Hardening in your System
You install Suhosin PHP Hardening in server system and enable it.For this your system security will be increased.


No comments:

Post a Comment