CVE-2023-1269 (published 2023-03-08T11:15Z)

Use of Hard-coded Credentials in GitHub repository alextselegidis/easyappointments prior to 1.5.0.

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

Weakness information:
cwe_id: CWE-798
cwe_name: Use of Hard-coded Credentials
description: The product contains hard-coded credentials, such as a password or cryptographic key.
extended_description: 
		   There are two main variations:
		   
			 Inbound: the product contains an authentication mechanism that checks the input credentials against a hard-coded set of credentials. In this variant, a default administration account is created, and a simple password is hard-coded into the product and associated with that account. This hard-coded password is the same for each installation of the product, and it usually cannot be changed or disabled by system administrators without manually modifying the program, or otherwise patching the product. It can also be difficult for the administrator to detect.
			 Outbound: the product connects to another system or component, and it contains hard-coded credentials for connecting to that component. This variant applies to front-end systems that authenticate with a back-end service. The back-end service may require a fixed password that can be easily discovered. The programmer may simply hard-code those back-end credentials into the front-end product.
		   
         
         

Fix information:
repo_url: https://github.com/alextselegidis/easyappointments
commit_details: repo_url: https://github.com/alextselegidis/easyappointments
author: Alex Tselegidis
author_date: 2023-03-01 09:00:24+01:00
msg: Update the seeders so that they set dynamic passwords by default
repository: repo_url: https://github.com/alextselegidis/easyappointments
repo_name: alextselegidis/easyappointments
description: :date: Easy!Appointments - Self Hosted Appointment Scheduler
repo_language: PHP
owner: alextselegidis
file_changes: filename: Console.php
change_type: ModificationType.MODIFY
diff: @@ -55,9 +55,9 @@ class Console extends EA_Controller {
     {
         $this->instance->migrate('fresh');
 
-        $this->instance->seed();
+        $password = $this->instance->seed();
 
-        response(PHP_EOL . '⇾ Installation completed, login with "administrator" / "administrator".' . PHP_EOL . PHP_EOL);
+        response(PHP_EOL . '⇾ Installation completed, login with "administrator" / "' . $password . '".' . PHP_EOL . PHP_EOL);
     }
 
     /**

programming_language: PHP
filename: Installation.php
change_type: ModificationType.MODIFY
diff: @@ -113,7 +113,7 @@ class Installation extends EA_Controller {
                 ],
                 'settings' => [
                     'username' => 'janedoe',
-                    'password' => 'janedoe',
+                    'password' => random_string(),
                     'working_plan' => setting('company_working_plan'),
                     'notifications' => TRUE,
                     'google_sync' => FALSE,

programming_language: PHP
filename: Instance.php
change_type: ModificationType.MODIFY
diff: @@ -84,17 +84,23 @@ class Instance {
 
     /**
      * Seed the database with test data.
+     *
+     * @return string Return's the administrator user password.
      */
-    public function seed()
+    public function seed(): string
     {
         // Settings
+        
         setting([
             'company_name' => 'Company Name',
             'company_email' => 'info@example.org',
             'company_link' => 'https://example.org',
         ]);
 
+        $password = random_string();
+
         // Admin
+
         $this->CI->admins_model->save([
             'first_name' => 'John',
             'last_name' => 'Doe',
@@ -102,13 +108,14 @@ class Instance {
             'phone_number' => '+10000000000',
             'settings' => [
                 'username' => 'administrator',
-                'password' => 'administrator',
+                'password' => $password,
                 'notifications' => TRUE,
                 'calendar_view' => CALENDAR_VIEW_DEFAULT
             ],
         ]);
 
         // Service
+
         $service_id = $this->CI->services_model->save([
             'name' => 'Service',
             'duration' => '30',
@@ -119,6 +126,7 @@ class Instance {
         ]);
 
         // Provider
+
         $this->CI->providers_model->save([
             'first_name' => 'Jane',
             'last_name' => 'Doe',
@@ -129,7 +137,7 @@ class Instance {
             ],
             'settings' => [
                 'username' => 'janedoe',
-                'password' => 'janedoe',
+                'password' => random_string(),
                 'working_plan' => setting('company_working_plan'),
                 'notifications' => TRUE,
                 'google_sync' => FALSE,
@@ -140,12 +148,15 @@ class Instance {
         ]);
 
         // Customer
+
         $this->CI->customers_model->save([
             'first_name' => 'James',
             'last_name' => 'Doe',
             'email' => 'james@example.org',
             'phone_number' => '+10000000000',
         ]);
+
+        return $password;
     }
 
     /**

programming_language: PHP