Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Fix for 'Privilege Escalation via 'role_id' Injection, vulnerability reported by @0xHamy Hamed Kohi of Delta Obscura

givanz0eca14af50f0
diff --git a/admin/controller/user/user.php b/admin/controller/user/user.php
index 9299576..9ec4638 100755
--- a/admin/controller/user/user.php
+++ b/admin/controller/user/user.php
@@ -150,12 +150,24 @@ class User extends Base {
return;
}
}
- }
+ $admin = Admin::current();
+
+ if (isset($user['role_id'])) {
+ //don't allow role change for non admin roles
+ if (! in_array($admin['role'], ['super_admin', 'admin'])) {
+ unset($user['role_id']);
+ } else {
+ //admin role can not set himself super admin, make sure role id is lower than super_admin
+ if ($admin['role'] == 'admin') {
+ $user['role_id'] = max($user['role_id'], 2);
+ }
+ }
+ }
+ }
if (($errors = $validator->validate($user)) === true) {
$users = model($this->type);
- $user = $this->request->post[$this->type] ?? [];
//if no password provided don't change
if (empty($user['password'])) {