CVE-2023-4381 (published 2023-08-16T12:15Z)

Unverified Password Change in GitHub repository instantsoft/icms2 prior to 2.16.1-git.

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

Weakness information:
cwe_id: NVD-CWE-Other
cwe_name: Other
description: NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
extended_description: Insufficient Information

Fix information:
repo_url: https://github.com/instantsoft/icms2
commit_details: repo_url: https://github.com/instantsoft/icms2
author: fuzegit
author_date: 2023-08-16 14:00:16+03:00
msg: New password cannot be the same as the old password
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: form_password.php
change_type: ModificationType.MODIFY
diff: @@ -4,55 +4,67 @@ class formUsersPassword extends cmsForm {
 
     public function init($profile) {
 
-        return array(
-
-            'basic' => array(
-                'type' => 'fieldset',
-                'title' => LANG_PASSWORD,
-                'childs' => array(
-                    new fieldString('password', array(
-                        'title' => LANG_OLD_PASS,
+        return [
+            'basic' => [
+                'type'   => 'fieldset',
+                'title'  => LANG_PASSWORD,
+                'childs' => [
+                    new fieldString('password', [
+                        'title'       => LANG_OLD_PASS,
                         'is_password' => true,
-                        'options'=>array(
-                            'min_length'=> 6,
-                            'max_length'=> 72
-                        ),
-                        'rules' => array(
-                            array('required'),
-                            array(function($controller, $data, $value)use($profile){
+                        'options'     => [
+                            'min_length' => 6,
+                            'max_length' => 72
+                        ],
+                        'rules' => [
+                            ['required'],
+                            [function ($controller, $data, $value)use ($profile) {
 
                                 $user = cmsCore::getModel('users')->getUserByAuth($profile['email'], $value);
 
-                                if (!$user){
+                                if (!$user) {
                                     return LANG_OLD_PASS_INCORRECT;
                                 }
 
                                 return true;
-
-                            })
-                        )
-                    )),
-                    new fieldString('password1', array(
-                        'title' => LANG_NEW_PASS,
-                        'is_password' => true,
-                        'options'=>array(
-                            'min_length'=> 6,
-                            'max_length'=> 72
-                        )
-                    )),
-                    new fieldString('password2', array(
-                        'title' => LANG_RETYPE_NEW_PASS,
+                            }]
+                        ]
+                    ]),
+                    new fieldString('password1', [
+                        'title'       => LANG_NEW_PASS,
                         'is_password' => true,
-                        'options'=>array(
-                            'min_length'=> 6,
-                            'max_length'=> 72
-                        )
-                    ))
-                )
-            )
+                        'options'     => [
+                            'min_length' => 6,
+                            'max_length' => 72
+                        ],
+                        'rules' => [
+                            [function ($controller, $data, $value)use ($profile) {
 
-        );
+                                if (!$value) {
+                                    return true;
+                                }
 
-    }
+                                $user = cmsCore::getModel('users')->getUserByAuth($profile['email'], $value);
 
+                                if ($user) {
+                                    return ERR_NEW_PASS_AS_OLD;
+                                }
+
+                                return true;
+                            }]
+                        ]
+                    ]),
+                    new fieldString('password2', [
+                        'title'       => LANG_RETYPE_NEW_PASS,
+                        'is_password' => true,
+                        'options'     => [
+                            'min_length' => 6,
+                            'max_length' => 72
+                        ]
+                    ])
+                ]
+            ]
+        ];
+
+    }
 }

programming_language: PHP
filename: language.php
change_type: ModificationType.MODIFY
diff: @@ -462,6 +462,7 @@
     define('ERR_NICKNAME_EXISTS', 			 'Nickname &laquo;%s&raquo; is already used');
     define('ERR_WRONG_OLD_PASS', 		 	 'Password change error: Old password is incorrect');
     define('ERR_NEW_PASS_MISMATCH', 		 'Password change error: Passwords do not match');
+    define('ERR_NEW_PASS_AS_OLD', 		     'The new password cannot be the same as the old password');
     define('ERR_NEW_PASS_REQUIRED', 		 'Enter your new password twice!');
 
     //CAPTCHA

programming_language: PHP
filename: language.php
change_type: ModificationType.MODIFY
diff: @@ -461,6 +461,7 @@
     define('ERR_NICKNAME_EXISTS', 			 'Никнейм &laquo;%s&raquo; занят');
     define('ERR_WRONG_OLD_PASS', 		 	 'Ошибка изменения пароля: Старый пароль указан неверно');
     define('ERR_NEW_PASS_MISMATCH', 		 'Ошибка изменения пароля: Пароли не совпали');
+    define('ERR_NEW_PASS_AS_OLD', 		     'Новый пароль не может быть таким же, как старый');
     define('ERR_NEW_PASS_REQUIRED', 		 'Нужно указать новый пароль дважды!');
 
     //CAPTCHA

programming_language: PHP