Plugin Directory

Changeset 1424990


Ignore:
Timestamp:
05/26/2016 10:02:07 PM (10 years ago)
Author:
hqpeak
Message:

IDS start

Location:
pike-firewall/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pike-firewall/trunk/pikefirewall.php

    r1419379 r1424990  
    33     * Plugin Name: Pike Firewall
    44     * Plugin URI: http://pike.hqpeak.com
    5      * Description: Block Tor, Proxy, Cloud/Hosting/VPN, Country originating traffic e.g. anonymous/fraudelent traffic
    6      * Version: 1.0.0
     5     * Description: Block Tor, Proxy, Cloud/Hosting/VPN, Country originating traffic e.g. anonymous/fraudelent traffic plus IDS for wordpress
     6     * Version: 1.1.0
    77     * Author: HQPeak
    88     * Author URI: http://hqpeak.com
     
    4444    $cron_check = isset($pike_firewall_options['cron_check']) ? $pike_firewall_options['cron_check'] : array("cron_check"=>array());
    4545    $msg = isset($pike_firewall_options['custom_msg']) ? $pike_firewall_options['custom_msg'] : array("custom_msg"=>array("text"=>""));
     46    $intrusion_options = isset($pike_firewall_options['intrusion']) ? $pike_firewall_options['intrusion'] : array();
    4647   
    4748   
     
    5657        }
    5758    }
    58    
     59
    5960   
    6061    // Update plugin
    6162    add_action('plugins_loaded', 'update_plugin_check');
    62    
    6363    function update_plugin_check() {
    64            
    65         global $pike_firewall_options;
    66        
    67 //      if ( PIKEFIREWALL_VERSION >= $pike_firewall_options['version'] ) {
    68 //          pike_firewall_plugin_deactivate();
    69 //          pikefirewall_plugin_activate();
    70 //      }
     64        if (!function_exists('get_plugins')) {
     65            require_once(ABSPATH.'wp-admin/includes/plugin.php' );
     66        }
     67       
     68        global $pike_firewall_options;
     69       
     70        if ( !isset($pike_firewall_options['version']) || PIKEFIREWALL_VERSION != $pike_firewall_options['version'] ) {
     71            $pike_firewall_options['version'] = PIKEFIREWALL_VERSION;
     72            update_option('pikefirewallsettings', $pike_firewall_options);
     73        }
    7174    }   
    7275   
     
    9497        }
    9598   
    96         global $wpdb, $pike_firewall_options, $cron_check, $captcha_check, $checkbox_options, $msg, $stealth_mode;
     99        global $wpdb, $pike_firewall_options, $cron_check, $captcha_check, $checkbox_options, $msg, $stealth_mode, $intrusion_options;
    97100       
    98101        $active_tab = 'main';
     
    161164                        <label><small>(Anonymous users can send POST requests)</small></label><br />
    162165                        <input type="hidden" name="pikefirewallsettings[services_update_time]" value=<?php echo $pike_firewall_options['services_update_time']; ?> />
     166                    </p><br />
     167                    <p>
     168                        <label><big><strong>Intrusion Detection:</strong></big></label><br />
     169                        <input type="checkbox" name="pikefirewallsettings[intrusion][]" value="foreign_origin" <?php echo (in_array('foreign_origin', $intrusion_options) ? 'checked' : ''); ?>>POST requests with foreign origin&nbsp;&nbsp;<br />
     170                        <input type="checkbox" name="pikefirewallsettings[intrusion][]" value="blank_useragent" <?php echo (in_array('blank_useragent', $intrusion_options) ? 'checked' : ''); ?>>POST requests with blank User Agent&nbsp;&nbsp;<br />
     171                        <input type="checkbox" name="pikefirewallsettings[intrusion][]" value="user_enumeration" <?php echo (in_array('user_enumeration', $intrusion_options) ? 'checked' : ''); ?>>Wordpress user enumeration&nbsp;&nbsp;<br />
     172                        <!--  <input type="checkbox" name="pikefirewallsettings[intrusion][]" value="invisible_chars" <?php echo (in_array('invisible_chars', $intrusion_options) ? 'checked' : ''); ?>>Detect invisible characters on input&nbsp;&nbsp;<br /> -->
     173                        <input type="checkbox" name="pikefirewallsettings[intrusion][]" value="proxy_headers" <?php echo (in_array('proxy_headers', $intrusion_options) ? 'checked' : ''); ?>>Detect Proxy Headers&nbsp;&nbsp;<br />
    163174                    </p><br />
    164175                    <p>
     
    346357</html>";
    347358           
    348             $defaults = array("default_tor"=>"http://pike.hqpeak.com/api/tor", "deny"=>"", "check"=>array("visit"), "services_update_time"=>time(), "custom_msg" => array("enabled"=>"enable", "text"=>"$msg_html"), "stealth_mode" => array("Off"), "captcha_check" => array("Off"), "cron_check" => array("Off"), "default_proxy"=>"http://pike.hqpeak.com/api/proxy", "version"=>"1.0.0");
     359            $defaults = array("default_tor"=>"http://pike.hqpeak.com/api/tor", "deny"=>"", "check"=>array("visit"), "services_update_time"=>time(), "custom_msg" => array("enabled"=>"enable", "text"=>"$msg_html"), "stealth_mode" => array("Off"), "captcha_check" => array("Off"), "cron_check" => array("Off"), "default_proxy"=>"http://pike.hqpeak.com/api/proxy", "intrusion"=>array());
    349360            $settings = wp_parse_args(get_option('pikefirewallsettings', $defaults), $defaults);
    350361            update_option('pikefirewallsettings', $settings);
     
    614625        $table_name_log = $wpdb->prefix."pike_firewall_log";
    615626       
    616         if (    $wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name &&
    617                 $wpdb->get_var("SHOW TABLES LIKE '$table_name_iprange'") != $table_name_iprange &&
    618                 $wpdb->get_var("SHOW TABLES LIKE '$table_name_log'") != $table_name_log ) {
     627        if (    $wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name &&
     628                $wpdb->get_var("SHOW TABLES LIKE '$table_name_iprange'") == $table_name_iprange &&
     629                $wpdb->get_var("SHOW TABLES LIKE '$table_name_log'") == $table_name_log ) {
    619630
    620631            if ( ($default_tor == 'http://pike.hqpeak.com/api/tor' && $diff >= 1800) ||
     
    645656                    pike_firewall_fill_table($ip_long_tor);
    646657                    $check = true;
    647                 } elseif (is_array($ip_arr_proxy) && sizeof($ip_arr_proxy)) {
     658                } elseif (is_array($ip_long_proxy) && sizeof($ip_long_proxy)>0) {
    648659                    $sql = "DELETE FROM $table_name";
    649660                    $wpdb->query($sql);
     
    837848        $stealth_mode = isset($pike_firewall_options['stealth_mode'])?$pike_firewall_options['stealth_mode']:array("stealth_mode"=>array());
    838849   
    839         if (($long_ip = match_address()) && !in_array('visit', $checkbox_options) && !is_admin()) {
     850        if ( !in_array('visit', $checkbox_options) && !is_admin() && ($long_ip = match_address()) ) {
    840851            if ( $stealth_mode[0] != "on" ) {
    841852                savelog($long_ip);
     
    863874        $stealth_mode = isset($pike_firewall_options['stealth_mode'])?$pike_firewall_options['stealth_mode']:array("stealth_mode"=>array());
    864875           
    865         if (($long_ip = match_address()) && !in_array('comment', $checkbox_options) && !empty($_POST['comment'])) {
     876        if ( !in_array('comment', $checkbox_options) && !empty($_POST['comment']) && ($long_ip = match_address()) ) {
    866877            if ( $stealth_mode[0] != "on" ) {
    867878                savelog($long_ip);
     
    889900        $stealth_mode = isset($pike_firewall_options['stealth_mode'])?$pike_firewall_options['stealth_mode']:array("stealth_mode"=>array());
    890901           
    891         if (($long_ip = match_address()) && !in_array('register', $checkbox_options)) {
     902        if ( !in_array('register', $checkbox_options) && ($long_ip = match_address()) ) {
    892903            if ( $stealth_mode[0] != "on" ) {
    893904                savelog($long_ip);
     
    917928        $url_parts = explode('/', $_SERVER['REQUEST_URI']);
    918929           
    919         if (($long_ip = match_address()) && !in_array('subscription', $checkbox_options) && (in_array('feed', array_keys($_REQUEST)) || in_array('feed', $url_parts))) {
     930        if ( !in_array('subscription', $checkbox_options) && (in_array('feed', array_keys($_REQUEST)) || in_array('feed', $url_parts)) && ($long_ip = match_address()) ) {
    920931            if ( $stealth_mode[0] != "on" ) {
    921932                savelog($long_ip);
     
    943954        $stealth_mode = isset($pike_firewall_options['stealth_mode'])?$pike_firewall_options['stealth_mode']:array("stealth_mode"=>array());
    944955       
    945         if (($long_ip = match_address()) && !in_array('administration', $checkbox_options)) {
     956        if ( !in_array('administration', $checkbox_options) && ($long_ip = match_address()) ) {
    946957            if ( $stealth_mode[0] != "on" ) {
    947958                savelog($long_ip);
     
    969980        $stealth_mode = isset($pike_firewall_options['stealth_mode'])?$pike_firewall_options['stealth_mode']:array("stealth_mode"=>array());
    970981
    971         if (($long_ip = match_address()) && !in_array('request', $checkbox_options) && $_SERVER['REQUEST_METHOD'] == 'POST') {
     982        if ( !in_array('request', $checkbox_options) && $_SERVER['REQUEST_METHOD'] == 'POST' && ($long_ip = match_address())) {
    972983            if ( $stealth_mode[0] != "on" ) {
    973984                savelog($long_ip);
     
    10001011        // changed
    10011012        foreach ($all_requests as $request){
    1002             if (($long_ip = match_address()) && (in_array(trim($request), array_keys($_POST)) || in_array(trim($request), array_keys($_GET)))){
     1013            if ( (in_array(trim($request), array_keys($_POST)) || in_array(trim($request), array_keys($_GET))) && ($long_ip = match_address()) ){
    10031014                if ( $stealth_mode[0] != "on" ) {
    10041015                    savelog($long_ip);
     
    10891100        // Update ip table
    10901101        $pike_firewall_options = get_option('pikefirewallsettings');
    1091         $default_tor = isset($pike_firewall_options['default_tor']) ? : "";
     1102        $default_tor = isset($pike_firewall_options['default_tor']) ? $pike_firewall_options['default_tor'] : "";
    10921103        $default_proxy = isset($pike_firewall_options['default_proxy']) ? $pike_firewall_options['default_proxy'] : "";
    10931104       
     
    10991110        $table_name_iprange = $wpdb->prefix."pike_firewall_ip_range";
    11001111        $table_name_log = $wpdb->prefix."pike_firewall_log";
    1101        
    1102         if (    $wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name &&
    1103                 $wpdb->get_var("SHOW TABLES LIKE '$table_name_iprange'") != $table_name_iprange &&
    1104                 $wpdb->get_var("SHOW TABLES LIKE '$table_name_log'") != $table_name_log ) {
    1105        
     1112               
     1113        if (    $wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name &&
     1114                $wpdb->get_var("SHOW TABLES LIKE '$table_name_iprange'") == $table_name_iprange &&
     1115                $wpdb->get_var("SHOW TABLES LIKE '$table_name_log'") == $table_name_log ) {
    11061116       
    11071117            if ( $default_tor == 'http://pike.hqpeak.com/api/tor' ||
     
    11321142                    pike_firewall_fill_table($ip_long_tor);
    11331143                    $check = true;
    1134                 } elseif (is_array($ip_arr_proxy) && sizeof($ip_arr_proxy)) {
     1144                } elseif (is_array($ip_long_proxy) && sizeof($ip_long_proxy)>0) {
    11351145                    $sql = "DELETE FROM $table_name";
    11361146                    $wpdb->query($sql);
     
    11411151           
    11421152            if ( $check ) {
     1153                $pike_firewall_options['services_update_time'] = time() ;
    11431154                update_option("pikefirewallsettings", $pike_firewall_options);
    11441155            }
    11451156        }
    11461157    }
     1158
    11471159   
    11481160    // Update maxmind and plugin database
     
    11501162        update_database_cron();
    11511163    }
    1152    
     1164       
    11531165    add_action('hourly_update_event', 'cron_job_action');
    11541166   
     
    11731185   
    11741186    function pike_firewall_error_notice($msg="", $class="notice-success", $dismissable="is-dismissible") {
    1175     ?>
     1187    ?>     
    11761188        <div class="<?php echo 'notice '.$class.' '.$dismissable; ?> pike-firewall-notice">
    11771189            <p><?php echo __($msg); ?></p>
     
    12121224        }
    12131225    }
     1226   
     1227   
     1228    // POST requests with foreign origin check
     1229    add_action('init', 'pike_firewall_foreign_request_check', 15);
     1230    function pike_firewall_foreign_request_check() {
     1231        $pike_firewall_options = get_option('pikefirewallsettings');
     1232        $intrusion_options = isset($pike_firewall_options['intrusion'])? $pike_firewall_options['intrusion']:array("intrusion"=>array());
     1233        $msg = isset($pike_firewall_options['custom_msg'])?$pike_firewall_options['custom_msg']:array("custom_msg"=>array("text"=>""));
     1234        $stealth_mode = isset($pike_firewall_options['stealth_mode'])?$pike_firewall_options['stealth_mode']:array("stealth_mode"=>array());
     1235       
     1236        $wphost = parse_url(site_url(), PHP_URL_HOST);
     1237        $long_ip = array('address' => '', 'type' => 'Foreign Origin');
     1238       
     1239        if ( isset( $_SERVER['REMOTE_ADDR'] ) ){
     1240            $user_address = $_SERVER['REMOTE_ADDR'];
     1241            $long_ip['address'] = ip2long($user_address);
     1242        }
     1243       
     1244        if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ){
     1245            $user_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
     1246            $long_ip['address'] = ip2long($user_address);
     1247        }
     1248
     1249        if ( in_array('foreign_origin', $intrusion_options) && !pike_l_check_post_refferer($wphost) ) {
     1250            savelog($long_ip);
     1251            if ( $msg['enabled'] === "enable" ) {
     1252                $custom_msg = tags_replace($msg['text'], $long_ip['address']);
     1253                require_once(WP_PLUGIN_DIR.'/pike-firewall/pike-firewall-logo-view.php');
     1254                die();
     1255            } else {
     1256                wp_die( __('You have sent request with foreign origin.') );
     1257            }
     1258        }
     1259    }
     1260   
     1261   
     1262    // POST requests with strange User Agent check
     1263    add_action('init', 'pike_firewall_user_agent_check', 15);
     1264    function pike_firewall_user_agent_check() {
     1265        $pike_firewall_options = get_option('pikefirewallsettings');
     1266        $intrusion_options = isset($pike_firewall_options['intrusion'])? $pike_firewall_options['intrusion']:array("intrusion"=>array());
     1267        $msg = isset($pike_firewall_options['custom_msg'])?$pike_firewall_options['custom_msg']:array("custom_msg"=>array("text"=>""));
     1268        $stealth_mode = isset($pike_firewall_options['stealth_mode'])?$pike_firewall_options['stealth_mode']:array("stealth_mode"=>array());
     1269       
     1270        $long_ip = array('address' => '', 'type' => 'Blank User Agent');
     1271
     1272        if ( isset( $_SERVER['REMOTE_ADDR'] ) ){
     1273            $user_address = $_SERVER['REMOTE_ADDR'];
     1274            $long_ip['address'] = ip2long($user_address);
     1275        }
     1276       
     1277        if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ){
     1278            $user_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
     1279            $long_ip['address'] = ip2long($user_address);
     1280        }
     1281       
     1282        if ( in_array('blank_useragent', $intrusion_options) && !pike_l_check_post_UA() ) {
     1283            savelog($long_ip);
     1284            if ( $msg['enabled'] === "enable" ) {
     1285                $custom_msg = tags_replace($msg['text'], $long_ip['address']);
     1286                require_once(WP_PLUGIN_DIR.'/pike-firewall/pike-firewall-logo-view.php');
     1287                die();
     1288            } else {
     1289                wp_die( __('You have sent request with blank User Agent.') );
     1290            }
     1291        }
     1292    }
     1293   
     1294   
     1295    // WP User Enumeratin check
     1296    add_action('init', 'pike_firewall_user_enumeration', 15);   
     1297    function pike_firewall_user_enumeration() {
     1298        $pike_firewall_options = get_option('pikefirewallsettings');
     1299        $intrusion_options = isset($pike_firewall_options['intrusion'])? $pike_firewall_options['intrusion']:array("intrusion"=>array());
     1300        $msg = isset($pike_firewall_options['custom_msg'])?$pike_firewall_options['custom_msg']:array("custom_msg"=>array("text"=>""));
     1301        $stealth_mode = isset($pike_firewall_options['stealth_mode'])?$pike_firewall_options['stealth_mode']:array("stealth_mode"=>array());
     1302       
     1303        $long_ip = array('address' => '', 'type' => 'User Enumeration');
     1304       
     1305        if ( isset( $_SERVER['REMOTE_ADDR'] ) ){
     1306            $user_address = $_SERVER['REMOTE_ADDR'];
     1307            $long_ip['address'] = ip2long($user_address);
     1308        }
     1309       
     1310        if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ){
     1311            $user_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
     1312            $long_ip['address'] = ip2long($user_address);
     1313        }
     1314       
     1315        if ( in_array('user_enumeration', $intrusion_options) && !pike_l_check_user_enum() ) {
     1316            savelog($long_ip);
     1317            if ( $msg['enabled'] === "enable" ) {
     1318                $custom_msg = tags_replace($msg['text'], $long_ip['address']);
     1319                require_once(WP_PLUGIN_DIR.'/pike-firewall/pike-firewall-logo-view.php');
     1320                die();
     1321            } else {
     1322                wp_die( __('Wordpress User Enumeration detected.') );
     1323            }
     1324        }
     1325    }
     1326   
     1327   
     1328    // Invisible characters check
     1329//  add_action('init', 'pike_firewall_invisible_chars_check', 15);
     1330    function pike_firewall_invisible_chars_check() {
     1331        $pike_firewall_options = get_option('pikefirewallsettings');
     1332        $intrusion_options = isset($pike_firewall_options['intrusion'])? $pike_firewall_options['intrusion']:array("intrusion"=>array());
     1333        $msg = isset($pike_firewall_options['custom_msg'])?$pike_firewall_options['custom_msg']:array("custom_msg"=>array("text"=>""));
     1334        $stealth_mode = isset($pike_firewall_options['stealth_mode'])?$pike_firewall_options['stealth_mode']:array("stealth_mode"=>array());
     1335       
     1336        $long_ip = array('address' => ip2long("127.0.0.1"), 'type' => 'Invisible Character');
     1337        //if ( in_array('invisible_chars', $intrusion_options) && !test() ) {
     1338        if ( in_array('invisible_chars', $intrusion_options) ) {
     1339            savelog($long_ip);
     1340            if ( $msg['enabled'] === "enable" ) {
     1341                $custom_msg = tags_replace($msg['text'], $long_ip['address']);
     1342                require_once(WP_PLUGIN_DIR.'/pike-firewall/pike-firewall-logo-view.php');
     1343                die();
     1344            } else {
     1345                wp_die( __('Invisible Characters detected in input.') );
     1346            }
     1347        }
     1348    }
     1349   
     1350   
     1351    // Proxy Headers check
     1352    add_action('init', 'pike_firewall_proxy_headers_check', 15);
     1353    function pike_firewall_proxy_headers_check() {
     1354        $pike_firewall_options = get_option('pikefirewallsettings');
     1355        $intrusion_options = isset($pike_firewall_options['intrusion'])? $pike_firewall_options['intrusion']:array("intrusion"=>array());
     1356        $msg = isset($pike_firewall_options['custom_msg'])?$pike_firewall_options['custom_msg']:array("custom_msg"=>array("text"=>""));
     1357        $stealth_mode = isset($pike_firewall_options['stealth_mode'])?$pike_firewall_options['stealth_mode']:array("stealth_mode"=>array());
     1358
     1359        $long_ip = array('address' => '', 'type' => 'Proxy Headers');
     1360       
     1361        if ( isset( $_SERVER['REMOTE_ADDR'] ) ){
     1362            $user_address = $_SERVER['REMOTE_ADDR'];
     1363            $long_ip['address'] = ip2long($user_address);
     1364        }
     1365       
     1366        if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ){
     1367            $user_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
     1368            $long_ip['address'] = ip2long($user_address);
     1369        }
     1370       
     1371        if ( in_array('proxy_headers', $intrusion_options) && !pike_l_check_proxy_by_headers() ) {
     1372            savelog($long_ip);
     1373            if ( $msg['enabled'] === "enable" ) {
     1374                $custom_msg = tags_replace($msg['text'], $long_ip['address']);
     1375                require_once(WP_PLUGIN_DIR.'/pike-firewall/pike-firewall-logo-view.php');
     1376                die();
     1377            } else {
     1378                wp_die( __('Proxy Headers detected.') );
     1379            }
     1380        }
     1381    }
     1382   
     1383   
     1384    function pike_l_check_post_refferer($host="localhost"){
     1385        if ( isset( $_POST ) && sizeof($_POST) > 0){
     1386            if ( isset( $_SERVER["HTTP_REFERER"] ) && trim($_SERVER["HTTP_REFERER"])!="" ){
     1387                $r = parse_url($_SERVER["HTTP_REFERER"], PHP_URL_HOST);
     1388                $host = str_replace("www.", "", strtolower($host));
     1389                $r = str_replace("www.", "", strtolower($r));   
     1390               
     1391                if ($r == $host){
     1392                    return TRUE;
     1393                }else{
     1394                    return FALSE;
     1395                }
     1396            }else{
     1397                return FALSE;
     1398            }   
     1399        }else{
     1400            return TRUE;
     1401        }
     1402    }
     1403   
     1404   
     1405    function pike_l_check_post_UA(){
     1406        if ( isset( $_POST ) && sizeof($_POST) > 0){
     1407            if ( isset( $_SERVER["HTTP_REFERER"] ) && trim($_SERVER["HTTP_REFERER"])!="" ){
     1408                return TRUE;
     1409            }else{
     1410                return FALSE;
     1411            }
     1412        }else{
     1413            return TRUE;
     1414        }
     1415    }
     1416   
     1417   
     1418    function pike_l_check_user_enum(){
     1419        if ( !is_admin() ){
     1420            if ( isset( $_SERVER["REQUEST_URI"] ) && trim($_SERVER["REQUEST_URI"])!="" ){
     1421                if (strpos(strtolower($_SERVER["REQUEST_URI"]), "wp-comments-post") !== FALSE){
     1422                    if ( is_array($_REQUEST) && sizeof($_REQUEST) >0 ){
     1423                        foreach ( $_REQUEST as $key=>$val ){
     1424                            if ( strtolower($key) == "author" ) return FALSE;
     1425                        }
     1426                    }else{
     1427                        if ( is_array($_GET) && sizeof($_GET) > 0 ){
     1428                            foreach ( $_GET as $key=>$val ){
     1429                                if ( strtolower($key) == "author" ) return FALSE;
     1430                            }
     1431                        }
     1432                        if ( is_array($_POST) && sizeof($_POST)>0 ){
     1433                            foreach ( $_POST as $key=>$val ){
     1434                                if ( strtolower($key) == "author" ) return FALSE;
     1435                            }
     1436                        }
     1437                    }
     1438                }
     1439            }
     1440        }
     1441        if ( isset( $_SERVER["QUERY_STRING"] ) && trim($_SERVER["QUERY_STRING"])!="" && strpos($_SERVER["QUERY_STRING"], "author")!== FALSE ){
     1442            if ( is_array($_GET) && sizeof($_GET)>0 ){
     1443                foreach($_GET as $key=>$val){
     1444                    if ( strtolower($key) == "author" ){
     1445                        if (is_numeric($_GET[$key])) return FALSE;
     1446                    }
     1447                }
     1448            }
     1449        }
     1450        if ( isset($_SERVER["REQUEST_URI"]) && trim($_SERVER["REQUEST_URI"])!="" ){
     1451            $t = explode("/", $_SERVER["REQUEST_URI"]);
     1452            if ( is_array($t) && sizeof($t) > 1 ){
     1453                $f = false;
     1454                foreach( $t as $item ){
     1455                    if ( strtolower($item) == "author"  ) $f = true;
     1456                    if ( $f && is_numeric($item) ) return FALSE;
     1457                }
     1458            }
     1459        }
     1460        return TRUE;
     1461    }
     1462   
     1463   
     1464    function pike_l_check_proxy_by_headers(){
     1465
     1466        $p_headers = array(
     1467            "CLIENT_IP",
     1468            "FORWARDED",
     1469            "FORWARDED_FOR",
     1470            "FORWARDED_FOR_IP",
     1471            "HTTP_CLIENT_IP",
     1472            "HTTP_FORWARDED",
     1473            "HTTP_FORWARDED_FOR",
     1474            "HTTP_FORWARDED_FOR_IP",
     1475            "HTTP_PC_REMOTE_ADDR",
     1476            "HTTP_PROXY_CONNECTION",
     1477            "HTTP_VIA",
     1478            "HTTP_X_FORWARDED",
     1479            "HTTP_X_FORWARDED_FOR",
     1480            "HTTP_X_FORWARDED_FOR_IP",
     1481            "HTTP_X_IMFORWARDS",
     1482            "HTTP_XROXY_CONNECTION",
     1483            "VIA",
     1484            "X_FORWARDED",
     1485            "X_FORWARDED_FOR"
     1486        );
     1487       
     1488        foreach( $p_headers as $ph ){
     1489            if ( isset( $_SERVER[$ph] ) ) return FALSE;
     1490        }
     1491        return TRUE;
     1492    }
    12141493?>
  • pike-firewall/trunk/readme.txt

    r1419382 r1424990  
    55Requires at least: 3.8.1
    66Tested up to: 4.5.2
    7 Stable tag: 1.0.0
     7Stable tag: 1.1.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 Pike FIrewall stands for limiting actions to the users that came from anonymous traffic sources.
     11Pike FIrewall stands for limiting actions to the users that came from anonymous traffic sources and IDS for wordpress.
    1212 
    1313== Description ==
     
    3131- GeoIP country blocking
    3232
     33Intrusion Detection
    3334
     35We introduce our IDS for wordpress with this release. You can do the following:
     36
     37- Block POST requests without set up User Agent
     38- Block POST requests originating from another domain (CSRF)
     39- Stop user enumeration
     40- Identify proxy traffic via HTTP headers
     41
     42 
    3443== Installation ==
    3544
     
    7483= 1.0 =
    7584This is the initial released version.
     85= 1.1 =
     86Announced Intrusion Detection for WP with its first features
    7687
    7788== Upgrade Notice ==
     
    7990= 1.0 =
    8091Just released in public.
     92= 1.1 =
     93No database or permissions changes will be required
     94
Note: See TracChangeset for help on using the changeset viewer.