CVE-2023-4650 (published 2023-08-31T01:15Z)

Improper Access Control in GitHub repository instantsoft/icms2 prior to 2.16.1-git.

CVSS v3 base score: 4.7, MEDIUM (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:L/A:L)

Weakness information:
cwe_id: CWE-284
cwe_name: Improper Access Control
description: The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.
extended_description: 
            Access control involves the use of several protection mechanisms such as:
            
               Authentication (proving the identity of an actor)
               Authorization (ensuring that a given actor can access a resource), and
               Accountability (tracking of activities that were performed)
            
            When any mechanism is not applied or otherwise fails, attackers can compromise the security of the product by gaining privileges, reading sensitive information, executing commands, evading detection, etc.
            There are two distinct behaviors that can introduce access control weaknesses:
               
                  Specification: incorrect privileges, permissions, ownership, etc. are explicitly specified for either the user or the resource (for example, setting a password file to be world-writable, or giving administrator capabilities to a guest user). This action could be performed by the program or the administrator.
                  Enforcement: the mechanism contains errors that prevent it from properly enforcing the specified access control requirements (e.g., allowing the user to specify their own privileges, or allowing a syntactically-incorrect ACL to produce insecure settings). This problem occurs within the program itself, in that it does not actually enforce the intended security policy that the administrator specifies.
               
         
		 

Fix information:
repo_url: https://github.com/instantsoft/icms2
commit_details: repo_url: https://github.com/instantsoft/icms2
author: fuzegit
author_date: 2023-08-14 14:31:14+03:00
msg: Administrators cannot change other administrators' passwords
& #1472
repository: repo_url: https://github.com/instantsoft/icms2
repo_name: instantsoft/icms2
description: Self-hosted Site Management System
repo_language: PHP
owner: instantsoft
file_changes: filename: step_php.php
change_type: ModificationType.MODIFY
diff: @@ -1,6 +1,6 @@
 <h1><?php echo LANG_STEP_PHP_CHECK; ?></h1>
 
-<h2><?php echo LANG_PHP_VERSION; ?></h1>
+<h2><?php echo LANG_PHP_VERSION; ?></h2>
 <p><?php echo LANG_PHP_VERSION_REQ ?></p>
 <table class="grid">
     <tr>

programming_language: PHP
filename: profile_edit_password.php
change_type: ModificationType.MODIFY
diff: @@ -8,9 +8,14 @@ class actionUsersProfileEditPassword extends cmsAction {
 
     public function run($profile) {
 
-        // проверяем наличие доступа
+        // Владельцы и админы могут редактировать
         if (!$this->is_own_profile && !$this->cms_user->is_admin) {
-            cmsCore::error404();
+            return cmsCore::error404();
+        }
+
+        // Администраторы тут могут редактировать только свои профили
+        if ($this->cms_user->is_admin && !$this->is_own_profile && $profile['is_admin']) {
+            return cmsCore::error404();
         }
 
         $form = $this->getForm('password', [$profile]);
@@ -153,7 +158,7 @@ class actionUsersProfileEditPassword extends cmsAction {
                     $result = $this->model->updateUser($profile['id'], $profile);
 
                     if ($result['success']) {
-                        
+
                         list($profile, $data, $form) = cmsEventsManager::hook('users_after_edit_password', [$profile, $data, $form]);
 
                         if (!empty($data['password1'])) {

programming_language: PHP
filename: profile_edit_sessions.php
change_type: ModificationType.MODIFY
diff: @@ -11,6 +11,10 @@ class actionUsersProfileEditSessions extends cmsAction {
             return cmsCore::error404();
         }
 
+        if ($this->cms_user->is_admin && !$this->is_own_profile && $profile['is_admin']) {
+            return cmsCore::error404();
+        }
+
         return $this->cms_template->render('profile_edit_sessions', [
             'id'       => $profile['id'],
             'profile'  => $profile,

programming_language: PHP
filename: frontend.php
change_type: ModificationType.MODIFY
diff: @@ -235,15 +235,18 @@ class users extends cmsFrontend {
             ];
         }
 
-        $menu[] = [
-            'title' => LANG_SECURITY,
-            'url'   => href_to_profile($profile, ['edit', 'password'])
-        ];
+        if ($this->is_own_profile || (!$profile['is_admin'] && $this->cms_user->is_admin)) {
 
-        $menu[] = [
-            'title' => LANG_USERS_SESSIONS,
-            'url'   => href_to_profile($profile, ['edit', 'sessions'])
-        ];
+            $menu[] = [
+                'title' => LANG_SECURITY,
+                'url'   => href_to_profile($profile, ['edit', 'password'])
+            ];
+
+            $menu[] = [
+                'title' => LANG_USERS_SESSIONS,
+                'url'   => href_to_profile($profile, ['edit', 'sessions'])
+            ];
+        }
 
         list($menu, $profile) = cmsEventsManager::hook('profile_edit_menu', [$menu, $profile]);
 

programming_language: PHP