title

Protect wordpress against malicious URL requests

 

Protect wordpress against malicious URL requests

10 Mai 2013, Posted by antoine in

Fantastic snippet from Perishable Press this snippet is great for the security to protect wordpress against malicious URL requests. I have attached a zip file with a download of this snippet as a plugin. Just ftp the single php file to your plugins folder and active as normal.

global $user_ID; if($user_ID) {
        if(!current_user_can('administrator')) {
                if (strlen($_SERVER['REQUEST_URI']) > 255 ||
                        stripos($_SERVER['REQUEST_URI'], "eval(") ||
                        stripos($_SERVER['REQUEST_URI'], "CONCAT") ||
                        stripos($_SERVER['REQUEST_URI'], "UNION+SELECT") ||
                        stripos($_SERVER['REQUEST_URI'], "base64")) {
                                @header("HTTP/1.1 414 Request-URI Too Long");
                                @header("Status: 414 Request-URI Too Long");
                                @header("Connection: Close");
                                @exit;
                }
        }
}