Protect Your Site from Malicious Requests

////Protect Your Site from Malicious Requests

Protect Your Site from Malicious Requests

Another method (similar to previous) is to make your own Plugin, its very simple we have the code for you here.

Simply open a new PHP file using a simple note or text editor and paste the following code inside:

<?php /* Plugin Name: Block Bad Queries Description: Protect WordPress Against Malicious URL Requests */ global $user_ID; if($user_ID) { if(!current_user_can('level_10')) { if (strlen($_SERVER['REQUEST_URI']) > 255 ||
strpos($_SERVER['REQUEST_URI'], "eval(") ||
strpos($_SERVER['REQUEST_URI'], "CONCAT") ||
strpos($_SERVER['REQUEST_URI'], "base64")) {
@header("HTTP/1.1 414 Request-URI Too Long");
@header("Status: 414 Request-URI Too Long");
@header("Connection: Close");
} ?>

Save this file as miltonmarketingprotect.php and upload it in your plugin directory /wp-content/plugins/ and your done.

This script will check for long strings as well as base64 code which was in the last attack and the eval ( code which could be a threat in the future.) 🙂

Once activated, this plugin will silently and effectively close any connections for these sorts of injection-type attacks.

Related Posts:

Disable Search in WordPress

Create a PayPal Donation Shortcode – WordPress

Show Post Thumbnails in RSS Feed – WordPress

Disable the Admin Bar in WordPress

Formatting Text in WordPress Posts (Tiny MCE Advanced for WordPress)

Should I Choose a Hosted or Non-hosted Blogging Platform?

How do I start a WordPress blog? (hosting wordpress)

The background-color CSS property

How do I install plugins in WordPress?

Paginate Your WordPress Site Without Plugins

FAQ Hacked WordPress Website

WordPress Posts vs Pages

Redirect New Registered Users to a Specific Page – WordPress

How do I create money online using WordPress?

What is a robot.txt file?

Automatically Link to Twitter Usernames in Content

Using the Current Year in Your Posts – WordPress

By |2019-02-08T19:25:48-05:00March 19th, 2018|Categories: CMS, WordPress|Tags: , , , , , , |

About the Author:

I am a loving father, & husband. I am a computer enthusiast. I have used and enjoyed computers since I was young and I enjoy teaching young minds how to code, because it teaches them how to think. Today with YouTube, and social media garbage our youth are losing the ability to think on their own and solve problems. I believe this is a serious epidemic as kids today dont understand that technology is a tool. This tool is being abused, and its underlying effects are taking its toll on kids behaviour, and learning.