mirror of
https://github.com/Mibew/mibew.git
synced 2025-02-07 00:14:40 +03:00
Fix multiple privilege escalation vulnerabilities (thanks to X Chen for advice)
This commit is contained in:
parent
f9fd80423f
commit
01dba643ba
@ -24,8 +24,6 @@ $can_modifyprofile = 3;
|
||||
$can_count = 4;
|
||||
$can_viewnotifications = 5;
|
||||
|
||||
|
||||
|
||||
$permission_ids = array(
|
||||
$can_administrate => "admin",
|
||||
$can_takeover => "takeover",
|
||||
@ -239,6 +237,21 @@ function check_login($redirect = true)
|
||||
return $_SESSION["${mysqlprefix}operator"];
|
||||
}
|
||||
|
||||
function check_permissions()
|
||||
{
|
||||
$check = false;
|
||||
if (func_num_args() > 1) {
|
||||
$args = func_get_args();
|
||||
$operator = array_shift($args);
|
||||
foreach ($args as $permission) {
|
||||
$check = $check || is_capable($permission, $operator);
|
||||
}
|
||||
}
|
||||
if (!$check) {
|
||||
die("Permission denied.");
|
||||
}
|
||||
}
|
||||
|
||||
function get_logged_in()
|
||||
{
|
||||
global $mysqlprefix;
|
||||
|
@ -26,6 +26,10 @@ $opId = verifyparam("op", "/^\d{1,10}$/");
|
||||
$page = array('opid' => $opId, 'avatar' => '');
|
||||
$errors = array();
|
||||
|
||||
if ($opId && ($opId != $operator['operatorid'])) {
|
||||
check_permissions($operator, $can_administrate);
|
||||
}
|
||||
|
||||
$canmodify = ($opId == $operator['operatorid'] && is_capable($can_modifyprofile, $operator))
|
||||
|| is_capable($can_administrate, $operator);
|
||||
|
||||
|
@ -21,6 +21,7 @@ require_once('../libs/settings.php');
|
||||
|
||||
$operator = check_login();
|
||||
csrfchecktoken();
|
||||
check_permissions($operator, $can_administrate);
|
||||
|
||||
$page = array('agentId' => '');
|
||||
$errors = array();
|
||||
|
@ -21,6 +21,7 @@ require_once('../libs/groups.php');
|
||||
require_once('../libs/getcode.php');
|
||||
|
||||
$operator = check_login();
|
||||
check_permissions($operator, $can_administrate);
|
||||
loadsettings();
|
||||
|
||||
$imageLocales = get_image_locales_map("../locales");
|
||||
|
@ -21,6 +21,7 @@ require_once('../libs/groups.php');
|
||||
require_once('../libs/getcode.php');
|
||||
|
||||
$operator = check_login();
|
||||
check_permissions($operator, $can_administrate);
|
||||
loadsettings();
|
||||
|
||||
$stylelist = get_style_list("../styles");
|
||||
|
@ -21,6 +21,7 @@ require_once('../libs/groups.php');
|
||||
|
||||
$operator = check_login();
|
||||
csrfchecktoken();
|
||||
check_permissions($operator, $can_administrate);
|
||||
|
||||
$page = array('grid' => '');
|
||||
$errors = array();
|
||||
|
@ -21,6 +21,7 @@ require_once('../libs/groups.php');
|
||||
|
||||
$operator = check_login();
|
||||
csrfchecktoken();
|
||||
check_permissions($operator, $can_administrate);
|
||||
|
||||
function get_group_members($groupid)
|
||||
{
|
||||
|
@ -20,6 +20,7 @@ require_once('../libs/operator.php');
|
||||
|
||||
$operator = check_login();
|
||||
csrfchecktoken();
|
||||
check_permissions($operator, $can_administrate);
|
||||
|
||||
if (isset($_GET['act']) && $_GET['act'] == 'del') {
|
||||
|
||||
|
@ -20,6 +20,7 @@ require_once('../libs/operator.php');
|
||||
require_once('../libs/chat.php');
|
||||
|
||||
$operator = check_login();
|
||||
check_permissions($operator, $can_administrate, $can_viewnotifications);
|
||||
|
||||
$page = array();
|
||||
|
||||
|
@ -21,14 +21,11 @@ require_once('../libs/operator.php');
|
||||
require_once('../libs/pagination.php');
|
||||
|
||||
$operator = check_login();
|
||||
check_permissions($operator, $can_administrate, $can_viewnotifications);
|
||||
|
||||
$page = array();
|
||||
$errors = array();
|
||||
|
||||
if (!is_capable($can_administrate, $operator) && !is_capable($can_viewnotifications, $operator)) {
|
||||
die("Permission denied.");
|
||||
}
|
||||
|
||||
setlocale(LC_TIME, getstring("time.locale"));
|
||||
|
||||
# locales
|
||||
|
@ -131,6 +131,9 @@ if (isset($_POST['login']) && isset($_POST['password'])) {
|
||||
if (!$opId && !is_capable($can_administrate, $operator)) {
|
||||
$errors[] = "You are not allowed to create operators";
|
||||
}
|
||||
elseif ($opId && ($opId != $operator['operatorid'])) {
|
||||
check_permissions($operator, $can_administrate);
|
||||
}
|
||||
|
||||
$canmodify = ($opId == $operator['operatorid'] && is_capable($can_modifyprofile, $operator))
|
||||
|| is_capable($can_administrate, $operator);
|
||||
|
@ -20,6 +20,7 @@ require_once('../libs/operator.php');
|
||||
|
||||
$operator = check_login();
|
||||
csrfchecktoken();
|
||||
check_permissions($operator, $can_administrate);
|
||||
|
||||
if (isset($_GET['act']) && $_GET['act'] == 'del') {
|
||||
$operatorid = isset($_GET['id']) ? $_GET['id'] : "";
|
||||
|
@ -41,6 +41,10 @@ $page['groups'] = get_all_groups($link);
|
||||
mysql_close($link);
|
||||
$errors = array();
|
||||
|
||||
if ($opId && ($opId != $operator['operatorid'])) {
|
||||
check_permissions($operator, $can_administrate);
|
||||
}
|
||||
|
||||
$canmodify = ($opId == $operator['operatorid'] && is_capable($can_modifyprofile, $operator))
|
||||
|| is_capable($can_administrate, $operator);
|
||||
|
||||
|
@ -21,6 +21,7 @@ require_once('../libs/settings.php');
|
||||
|
||||
$operator = check_login();
|
||||
csrfchecktoken();
|
||||
check_permissions($operator, $can_administrate);
|
||||
|
||||
$page = array('agentId' => '');
|
||||
$errors = array();
|
||||
|
@ -35,6 +35,10 @@ $opId = verifyparam("op", "/^\d{1,10}$/");
|
||||
$page = array('opid' => $opId, 'canmodify' => is_capable($can_administrate, $operator) ? "1" : "");
|
||||
$errors = array();
|
||||
|
||||
if ($opId && ($opId != $operator['operatorid'])) {
|
||||
check_permissions($operator, $can_administrate);
|
||||
}
|
||||
|
||||
$op = operator_by_id($opId);
|
||||
|
||||
if (!$op) {
|
||||
|
@ -21,6 +21,7 @@ require_once('../libs/settings.php');
|
||||
|
||||
$operator = check_login();
|
||||
csrfchecktoken();
|
||||
check_permissions($operator, $can_administrate);
|
||||
|
||||
$page = array('agentId' => '');
|
||||
$errors = array();
|
||||
|
@ -24,6 +24,7 @@ require_once('../libs/expand.php');
|
||||
require_once('../libs/settings.php');
|
||||
|
||||
$operator = check_login();
|
||||
check_permissions($operator, $can_administrate);
|
||||
|
||||
$stylelist = array();
|
||||
$stylesfolder = "../styles";
|
||||
|
@ -119,6 +119,7 @@ function get_auxiliary($s)
|
||||
|
||||
$operator = check_login();
|
||||
csrfchecktoken();
|
||||
check_permissions($operator, $can_administrate);
|
||||
|
||||
$source = verifyparam("source", "/^[\w-]{2,5}$/", $default_locale);
|
||||
$target = verifyparam("target", "/^[\w-]{2,5}$/", $current_locale);
|
||||
|
@ -20,6 +20,7 @@ require_once('../libs/operator.php');
|
||||
require_once('../libs/settings.php');
|
||||
|
||||
$operator = check_login();
|
||||
check_permissions($operator, $can_administrate);
|
||||
|
||||
$default_extensions = array('mysql', 'gd', 'iconv');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user