CVE-2023-1463 (published 2023-03-17T12:15Z)

Authorization Bypass Through User-Controlled Key in GitHub repository nilsteampassnet/teampass prior to 3.0.0.23.

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

Weakness information:
cwe_id: CWE-639
cwe_name: Authorization Bypass Through User-Controlled Key
description: The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
extended_description: 
            Retrieval of a user record occurs in the system based on some key value that is under user control. The key would typically identify a user-related record stored in the system and would be used to lookup that record for presentation to the user. It is likely that an attacker would have to be an authenticated user in the system. However, the authorization process would not properly check the data access operation to ensure that the authenticated user performing the operation has sufficient entitlements to perform the requested data access, hence bypassing any other authorization checks present in the system.
            For example, attackers can look at places where user specific data is retrieved (e.g. search screens) and determine whether the key for the item being looked up is controllable externally. The key may be a hidden field in the HTML form field, might be passed as a URL parameter or as an unencrypted cookie variable, then in each of these cases it will be possible to tamper with the key value.
            One manifestation of this weakness is when a system uses sequential or otherwise easily-guessable session IDs that would allow one user to easily switch to another user's session and read/modify their data.
         
         

Fix information:
repo_url: https://github.com/nilsteampassnet/teampass
commit_details: repo_url: https://github.com/nilsteampassnet/teampass
author: nilsteampassnet
author_date: 2023-03-17 11:40:49+01:00
msg: 3.0.0.23

Fix for identified CWE-285: Improper Authorization
repository: repo_url: https://github.com/nilsteampassnet/teampass
repo_name: nilsteampassnet/TeamPass
description: Collaborative Passwords Manager
repo_language: PHP
owner: nilsteampassnet
file_changes: filename: error.php
change_type: ModificationType.MODIFY
diff: @@ -103,7 +103,7 @@ if (
                 <h3><i class="fa fa-warning text-danger"></i> Oops! <?php echo $errorCode; ?>.</h3>
 
                 <p>
-                    For security reason, you have been disconnected. Click to <a href="./includes/core/logout.php?user_id=" + <?php echo isset($_SESSION['user_id']) === true ? $_SESSION['user_id'] : ''; ?>>log in</a>.
+                    For security reason, you have been disconnected. Click to <a href="./includes/core/logout.php?token=" + <?php echo isset($_SESSION['key']) === true ? $_SESSION['key'] : ''; ?>>log in</a>.
                 </p>
 
             </div>

programming_language: PHP
filename: load.js.php
change_type: ModificationType.MODIFY
diff: @@ -482,7 +482,7 @@ if (
                 document.location.href = "index.php?page=profile";
             } else if ($(this).data('name') === 'logout') {
                 // Logout directly to login form
-                window.location.href = "./includes/core/logout.php?user_id=" + <?php echo $_SESSION['user_id']; ?>
+                window.location.href = "./includes/core/logout.php?token=<?php echo $_SESSION['key']; ?>";
             }
         }
     });
@@ -1674,7 +1674,7 @@ if (
                         }
                     );
 
-                    window.location.href = "./includes/core/logout.php?user_id=" + <?php echo $_SESSION['user_id']; ?>
+                    window.location.href = "./includes/core/logout.php?token=" + <?php echo $_SESSION['key']; ?>
                 } else if (store.get('teampassUser').admin_user_password) {
                     // now select if sending by email
                     $('#dialog-admin-change-user-password-info').html('<i class="fas fa-envelope-open-text fa-lg warning mr-2"></i><?php echo langHdl('information'); ?><br><br>'+

programming_language: PHP
filename: logout.php
change_type: ModificationType.MODIFY
diff: @@ -38,10 +38,11 @@ $get['user_id'] = $superGlobal->get('user_id', 'GET');
 // Update table by deleting ID
 if (isset($_SESSION['user_id']) === true && empty($_SESSION['user_id']) === false) {
     $user_id = $_SESSION['user_id'];
-} elseif (isset($get['user_id']) === true && empty($get['user_id']) === false) {
-    $user_id = $get['user_id'];
+} elseif (isset($get['token']) === true && empty($get['token']) === false) {
+    $user_token = $get['token'];
 } else {
     $user_id = '';
+    $user_token = '';
 }
 
 if (empty($user_id) === false && isset($_SESSION['CPM']) === true) {
@@ -65,8 +66,9 @@ if (empty($user_id) === false && isset($_SESSION['CPM']) === true) {
             'timestamp' => '',
             'session_end' => '',
         ],
-        'id=%i',
-        $user_id
+        'id=%i || key_tempo=%s',
+        $user_id,
+        $user_token
     );
     //Log into DB the user's disconnection
     if (isset($SETTINGS['log_connections']) === true

programming_language: PHP
filename: install.css
change_type: ModificationType.MODIFY
diff: @@ -121,11 +121,3 @@ h5 {
 .hidden {
   display: none;
 }
-
-.center-screen {
-	position:absolute;
-	top:50%;
-	left: 50%;
-	margin-right: -50%;
-	transform: translate(-50%, -50%);
-}
\ No newline at end of file

programming_language: CSS
filename: upgrade.php
change_type: ModificationType.MODIFY
diff: @@ -276,7 +276,36 @@ if (!isset($_GET['step']) && !isset($post_step)) {
                     <div class="card-header">
                         <h5>DataBase Informations</h5>
                     </div>
-                    <div class="card-body">';
+                    <div class="card-body">
+                        <!--<div class="form-group">
+                            <label>Host</label>
+                            <input type="text" class="form-control" name="db_host" id="db_host" class="ui-widget" value="'.DB_HOST.'">
+                        </div>
+                        
+                        <div class="form-group">
+                            <label>Database name</label>
+                            <input type="text" class="form-control" name="db_name" id="db_name" class="ui-widget" value="'.DB_NAME.'">
+                        </div>
+                        
+                        <div class="form-group">
+                            <label>Login</label>
+                            <input type="text" class="form-control" name="db_user" id="db_user" class="ui-widget" value="'.DB_USER.'">
+                        </div>
+                        
+                        <div class="form-group">
+                            <label>Password</label>
+                            <input type="text" class="form-control" name="db_pw" id="db_pw" class="ui-widget" value="'.$visible_pwd.'">
+                        </div>
+                        
+                        <div class="form-group">
+                            <label>Prefix</label>
+                            <input type="text" class="form-control" name="db_prefix" id="db_prefix" class="ui-widget" value="'.DB_PREFIX.'">
+                        </div>
+                        
+                        <div class="form-group">
+                            <label>Port</label>
+                            <input type="text" class="form-control" name="db_port" id="db_port" class="ui-widget" value="'.DB_PORT.'">
+                        </div>-->';
 
     // check if all database  info are available
     if ($dbSettings === true) {

programming_language: PHP