.htaccess
11 years ago
index.php
1 year ago
session.php
1 year ago
trace.php
2 weeks ago
wp-login.php
1 year ago
wp-settings.php
2 years ago
wp-login.php
98 lines
| 1 | <?php |
| 2 | /** |
| 3 | * GOTMLS wp-login protection |
| 4 | * @package GOTMLS |
| 5 | * @since 4.23.77 |
| 6 | */ |
| 7 | |
| 8 | require_once(dirname(__FILE__)."/trace.php"); |
| 9 | |
| 10 | if (!defined("GOTMLS_LOGIN_PROTECTION")) { |
| 11 | if (!is_file($bflp_file = dirname(dirname(dirname(__DIR__)))."/mu-plugins/gotmls_safe-load.php") || (is_array($GOTMLS_mu) && count($GOTMLS_mu) > 1 && ($bflp_contents = file_get_contents($bflp_file)) && (substr($bflp_contents, -1 * strlen($GOTMLS_mu[1])) != $GOTMLS_mu[1]))) |
| 12 | $GOTMLS_mu = GOTMLS_save_contents($bflp_file, implode("\ndefine('GOTMLS_MU_FILE', __FILE__);\n", $GOTMLS_mu)); |
| 13 | unset($GOTMLS_mu); |
| 14 | if (defined("GOTMLS_SAFELOAD_DIR") && is_file(GOTMLS_SAFELOAD_DIR."session.php")) { |
| 15 | require_once(GOTMLS_SAFELOAD_DIR."session.php"); |
| 16 | if (function_exists("GOTMLS_create_session_file")) |
| 17 | GOTMLS_create_session_file(); |
| 18 | if (defined("GOTMLS_INSTALL_TIME") && is_numeric(GOTMLS_INSTALL_TIME) && (GOTMLS_INSTALL_TIME > 0) && !defined("GOTMLS_LOGIN_PROTECTION")) |
| 19 | define("GOTMLS_LOGIN_PROTECTION", GOTMLS_session_start()); |
| 20 | } |
| 21 | } |
| 22 | if (defined("GOTMLS_LOGIN_PROTECTION")) { |
| 23 | if (!defined("GOTMLS_REQUEST_METHOD")) |
| 24 | define("GOTMLS_REQUEST_METHOD", (isset($_SERVER["REQUEST_METHOD"])?strtoupper($_SERVER["REQUEST_METHOD"]):"none")); |
| 25 | if (!(isset($GLOBALS["GOTMLS"]) && is_array($GLOBALS["GOTMLS"]))) |
| 26 | $GLOBALS["GOTMLS"] = array(); |
| 27 | if (!isset($GLOBALS["GOTMLS"]["detected_attacks"])) |
| 28 | $GLOBALS["GOTMLS"]["detected_attacks"] = ''; |
| 29 | if ((GOTMLS_REQUEST_METHOD == "POST") && (isset($_POST["log"]) && isset($_POST["pwd"])) && !(isset($GOTMLS_LOGIN_KEY) && isset($GOTMLS_logins[$GOTMLS_LOGIN_KEY]["whitelist"]))) { |
| 30 | if (!(isset($_SESSION["GOTMLS_server_time"]["time_START"]) && defined("GOTMLS_SESSION_TIME") && ($_SESSION["GOTMLS_server_time"]["time_START"] != GOTMLS_SESSION_TIME)) && !defined("SESS_FILE")) |
| 31 | GOTMLS_define("SESS_FILE", $GOTMLS_LOGIN_KEY = GOTMLS_session_file()); |
| 32 | if (!(isset($_SESSION["GOTMLS_server_time"]["time_START"]) && defined("GOTMLS_SESSION_TIME") && ($_SESSION["GOTMLS_server_time"]["time_START"] != GOTMLS_SESSION_TIME))) |
| 33 | $GLOBALS["GOTMLS"]["detected_attacks"] = '&attack[]=NO_SESSION'; |
| 34 | elseif (isset($_POST["GOTMLS_sess_id"]) && preg_match('/^[\da-f]{32}_\d++$/', $_POST["GOTMLS_sess_id"])) { |
| 35 | $GOT_sess = $_POST["GOTMLS_sess_id"]; |
| 36 | if (isset($_POST["GOTMLS_sess_$GOT_sess"]) && is_numeric($_POST["GOTMLS_sess_$GOT_sess"]) && isset($_SESSION["GOTMLS_server_time"]["sess_$GOT_sess"]["JS_time"])) { |
| 37 | if ($_SESSION["GOTMLS_server_time"]["sess_$GOT_sess"]["JS_time"] != $_POST["GOTMLS_sess_$GOT_sess"]) |
| 38 | $GLOBALS["GOTMLS"]["detected_attacks"] = '&attack[]=WRONG_JS'; |
| 39 | } else |
| 40 | $GLOBALS["GOTMLS"]["detected_attacks"] = '&attack[]=NO_JS'; |
| 41 | } else |
| 42 | $GLOBALS["GOTMLS"]["detected_attacks"] = '&attack[]=NO_SESSION_ID'; |
| 43 | if (!isset($_SERVER["REMOTE_ADDR"])) |
| 44 | $GLOBALS["GOTMLS"]["detected_attacks"] .= '&attack[]=NO_REMOTE_ADDR'; |
| 45 | if (!isset($_SERVER["HTTP_USER_AGENT"])) |
| 46 | $GLOBALS["GOTMLS"]["detected_attacks"] .= '&attack[]=NO_HTTP_USER_AGENT'; |
| 47 | if (!isset($_SERVER["HTTP_REFERER"]) && !(isset($_SERVER["HTTP_USER_AGENT"]) && substr($_SERVER["HTTP_USER_AGENT"], 0, 18) == "Mozilla/5.0 (iPad;")) |
| 48 | $GLOBALS["GOTMLS"]["detected_attacks"] .= '&attack[]=NO_HTTP_REFERER'; |
| 49 | if (!(isset($GLOBALS["GOTMLS"]["detected_attacks"]) && $GLOBALS["GOTMLS"]["detected_attacks"])) { |
| 50 | if (isset($_SESSION["GOTMLS_server_time"]["login_attempts"]) && is_numeric($_SESSION["GOTMLS_server_time"]["login_attempts"]) && strlen($_SESSION["GOTMLS_server_time"]["login_attempts"]."") > 0) |
| 51 | $_SESSION["GOTMLS_server_time"]["login_attempts"]++; |
| 52 | else { |
| 53 | if ($GOTMLS_LOGIN_KEY = GOTMLS_session_file()) { |
| 54 | if (!(isset($GLOBALS["GOTMLS"]["logins"][$GOTMLS_LOGIN_KEY]["POST"]) && is_array($GLOBALS["GOTMLS"]["logins"][$GOTMLS_LOGIN_KEY]["POST"]))) |
| 55 | $GLOBALS["GOTMLS"]["detected_attacks"] .= '&attack[]=NO_LOGIN_ATTEMPTS'; |
| 56 | elseif (!isset($GLOBALS["GOTMLS"]["logins"][$GOTMLS_LOGIN_KEY]["GET"])) |
| 57 | $GLOBALS["GOTMLS"]["detected_attacks"] .= '&attack[]=NO_LOGIN_GETS'; |
| 58 | else { |
| 59 | $_SESSION["GOTMLS_server_time"]["login_attempts"] = 0; |
| 60 | foreach ($GLOBALS["GOTMLS"]["logins"][$GOTMLS_LOGIN_KEY]["POST"] as $LOGIN_TIME=>$LOGIN_ARRAY) { |
| 61 | if ($LOGIN_TIME > $GLOBALS["GOTMLS"]["logins"][$GOTMLS_LOGIN_KEY]["GET"]) |
| 62 | $_SESSION["GOTMLS_server_time"]["login_attempts"]++; |
| 63 | else |
| 64 | unset($GLOBALS["GOTMLS"]["logins"][$GOTMLS_LOGIN_KEY]["POST"][$LOGIN_TIME]); |
| 65 | } |
| 66 | } |
| 67 | } else |
| 68 | $GLOBALS["GOTMLS"]["detected_attacks"] .= '&attack[]=NO_SESSION_FILE'; |
| 69 | } |
| 70 | if (!(isset($_SESSION["GOTMLS_server_time"]["login_attempts"]) && is_numeric($_SESSION["GOTMLS_server_time"]["login_attempts"]) && ($_SESSION["GOTMLS_server_time"]["login_attempts"] < 6) && $_SESSION["GOTMLS_server_time"]["login_attempts"])) |
| 71 | $GLOBALS["GOTMLS"]["detected_attacks"] .= '&attack[]=TOO_MANY_login_attempts'; |
| 72 | } |
| 73 | if (isset($GLOBALS["GOTMLS"]["detected_attacks"]) && $GLOBALS["GOTMLS"]["detected_attacks"]) |
| 74 | require(dirname(__FILE__)."/index.php"); |
| 75 | } else { |
| 76 | if (isset($_GET["GOTMLS_sess"]) && strlen($_GET["GOTMLS_sess"]) == 32 && isset($_GET["GOTMLS_time"]) && is_numeric($_GET["GOTMLS_time"]) && isset($_GET["GOTMLS_form_id"]) && is_numeric($_GET["GOTMLS_form_id"])) { |
| 77 | define("GOTMLS_FORMID", $_GET["GOTMLS_form_id"]); |
| 78 | define("GOTMLS_SESS", preg_replace('/[^\da-f]++/i', "", $_GET["GOTMLS_sess"])."_".GOTMLS_FORMID); |
| 79 | define("GOTMLS_TIME", preg_replace('/[^\d]/', "", $_GET["GOTMLS_time"])); |
| 80 | if (!(isset($_SESSION["GOTMLS_server_time"]["time_START"]) && is_numeric($_SESSION["GOTMLS_server_time"]["time_START"])) && !defined("SESS_FILE")) |
| 81 | GOTMLS_define("SESS_FILE", $GOTMLS_LOGIN_KEY = GOTMLS_session_file()); |
| 82 | if (!(isset($_SESSION["GOTMLS_server_time"]["time_START"]) && is_numeric($_SESSION["GOTMLS_server_time"]["time_START"]))) |
| 83 | define("GOTMLS_SESS_ERROR", "Login Session Lost! "); |
| 84 | else { |
| 85 | if (floor($_SESSION["GOTMLS_server_time"]["time_START"]) <= GOTMLS_SESSION_TIME) { |
| 86 | $_SESSION["GOTMLS_server_time"]["sess_".GOTMLS_SESS]["JS_time"] = GOTMLS_TIME; |
| 87 | $_SESSION["GOTMLS_server_time"]["sess_".GOTMLS_SESS]["PHP_time"] = GOTMLS_SESSION_TIME; |
| 88 | define("GOTMLS_logintime_JS", "if (GOTMLS_field = document.getElementById('GOTMLS_sess_id_".GOTMLS_FORMID."')) {\n\tGOTMLS_field.value = '".GOTMLS_SESS."';\n\tGOTMLS_field.name = 'GOTMLS_sess_id';\n}\nif (GOTMLS_field = document.getElementById('GOTMLS_offset_id_".GOTMLS_FORMID."')) {\n\tGOTMLS_field.name = 'GOTMLS_sess_".GOTMLS_SESS."';\n\tGOTMLS_field.value = '".GOTMLS_TIME."';\n}\nif (GOTMLS_loading_gif = document.getElementById('loading_BRUTEFORCE_".GOTMLS_FORMID."'))\n\tGOTMLS_loading_gif.style.display = 'none';"); |
| 89 | } else |
| 90 | define("GOTMLS_SESS_ERROR", "Login Session Not Found! "); |
| 91 | } |
| 92 | } |
| 93 | GOTMLS_session_init(); |
| 94 | $_SESSION["GOTMLS_server_time"]["login_attempts"] = 0; |
| 95 | } |
| 96 | GOTMLS_session_close(); |
| 97 | } |
| 98 |