افزایش امنیت وردپرس با استفاده از BBQ
افزایش امنیت وردپرس با استفاده از BBQ
یعضی از هکر ها برای یافتن نقاط ضعف سایت شما از روش Malicious URL Requests ( درخواست آدرس های مخرب ) استفاده می کنند . با وجود این که وردپرس به صورت پیشفرض از این روش پیشگیری کرده اما در این مطلب به شما می آموزیم که چگونه با استفاده از BBQ ( Block Bad Queries ) امنیت وب سایت خود را دوچندان کنید . روش کار اینگونه است که این اسکریپت از هر درخواست مخرب و ناشناخته مانند درخواست های eval و base64_ جلوگیری کرده و آنها را بلاک می کند . BBQ به صورت پلاگین وردپرس و یک اسکریپت جهت استفاده سایر وب سایت ها موجود و قابل دانلود است .
اگر از وردپرس استفاده می کنید افزونه زیر را دانلود و نصب کنید ،
ولی اگر سایتتون روی وردپرس نیست ، کد زیر را داخل یک فایل جداگانه از سیستم یا اسکریپت خود قرار دهید .
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
<?php /* Plugin Name: Block Bad Queries (BBQ) Plugin URI: https://perishablepress.com/block-bad-queries/ Description: Automatically protects WordPress against malicious URL requests. Author: Jeff Starr Author URI: http://monzilla.biz/ Version: (standalone) License: GPL v2 Usage: No configuration necessary. Upload, activate and done. BBQ blocks bad queries automically to protect your site against malicious URL requests. Tags: security, protect, firewall, php, eval, malicious, url, request, blacklist */ $request_uri = $_SERVER['REQUEST_URI']; $query_string = $_SERVER['QUERY_STRING']; $user_agent = $_SERVER['HTTP_USER_AGENT']; // request uri if ( //strlen($request_uri) > 255 || stripos($request_uri, 'eval(') || stripos($request_uri, 'CONCAT') || stripos($request_uri, 'UNION+SELECT') || stripos($request_uri, '(null)') || stripos($request_uri, 'base64_') || stripos($request_uri, '/localhost') || stripos($request_uri, '/pingserver') || stripos($request_uri, '/config.') || stripos($request_uri, '/wwwroot') || stripos($request_uri, '/makefile') || stripos($request_uri, 'crossdomain.') || stripos($request_uri, 'proc/self/environ') || stripos($request_uri, 'etc/passwd') || stripos($request_uri, '/https/') || stripos($request_uri, '/http/') || stripos($request_uri, '/ftp/') || stripos($request_uri, '/cgi/') || stripos($request_uri, '.cgi') || stripos($request_uri, '.exe') || stripos($request_uri, '.sql') || stripos($request_uri, '.ini') || stripos($request_uri, '.dll') || stripos($request_uri, '.asp') || stripos($request_uri, '.jsp') || stripos($request_uri, '/.bash') || stripos($request_uri, '/.git') || stripos($request_uri, '/.svn') || stripos($request_uri, '/.tar') || stripos($request_uri, ' ') || stripos($request_uri, '<') || stripos($request_uri, '>') || stripos($request_uri, '/=') || stripos($request_uri, '...') || stripos($request_uri, '+++') || stripos($request_uri, '://') || stripos($request_uri, '/&&') || // query strings stripos($query_string, '?') || stripos($query_string, ':') || stripos($query_string, '[') || stripos($query_string, ']') || stripos($query_string, '../') || stripos($query_string, '127.0.0.1') || stripos($query_string, 'loopback') || stripos($query_string, '%0A') || stripos($query_string, '%0D') || stripos($query_string, '%22') || stripos($query_string, '%27') || stripos($query_string, '%3C') || stripos($query_string, '%3E') || stripos($query_string, '%00') || stripos($query_string, '%2e%2e') || stripos($query_string, 'union') || stripos($query_string, 'input_file') || stripos($query_string, 'execute') || stripos($query_string, 'mosconfig') || stripos($query_string, 'environ') || //stripos($query_string, 'scanner') || stripos($query_string, 'path=.') || stripos($query_string, 'mod=.') || // user agents stripos($user_agent, 'binlar') || stripos($user_agent, 'casper') || stripos($user_agent, 'cmswor') || stripos($user_agent, 'diavol') || stripos($user_agent, 'dotbot') || stripos($user_agent, 'finder') || stripos($user_agent, 'flicky') || stripos($user_agent, 'libwww') || stripos($user_agent, 'nutch') || stripos($user_agent, 'planet') || stripos($user_agent, 'purebot') || stripos($user_agent, 'pycurl') || stripos($user_agent, 'skygrid') || stripos($user_agent, 'sucker') || stripos($user_agent, 'turnit') || stripos($user_agent, 'vikspi') || stripos($user_agent, 'zmeu') ) { @header('HTTP/1.1 403 Forbidden'); @header('Status: 403 Forbidden'); @header('Connection: Close'); @exit; } ?> |
دیدگاهتان را بنویسید