CVE-2021-33394 (published 2021-05-27T19:15Z)

Cubecart 6.4.2 allows Session Fixation. The application does not generate a new session cookie after the user is logged in. A malicious user is able to create a new session cookie value and inject it to a victim. After the victim logs in, the injected cookie becomes valid, giving the attacker access to the user's account through the active session.

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

Weakness information:
cwe_id: CWE-384
cwe_name: Session Fixation
description: Authenticating a user, or otherwise establishing a new user session, without invalidating any existing session identifier gives an attacker the opportunity to steal authenticated sessions.
extended_description: 
            Such a scenario is commonly observed when:
            
               A web application authenticates a user without first invalidating the existing session, thereby continuing to use the session already associated with the user.
               An attacker is able to force a known session identifier on a user so that, once the user authenticates, the attacker has access to the authenticated session.
               The application or container uses predictable session identifiers.
	    
	    In the generic exploit of session fixation vulnerabilities, an attacker creates a new session on a web application and records the associated session identifier. The attacker then causes the victim to associate, and possibly authenticate, against the server using that session identifier, giving the attacker access to the user's account through the active session.
         
         

Fix information:
repo_url: https://github.com/cubecart/v6
commit_details: repo_url: https://github.com/cubecart/v6
author: Al Brookbanks
author_date: 2021-05-20 08:15:48+01:00
msg: #2870 - session fixation
repository: repo_url: https://github.com/cubecart/v6
repo_name: cubecart/v6
description: CubeCart Version 6
repo_language: PHP
owner: cubecart
file_changes: filename: admin.class.php
change_type: ModificationType.MODIFY
diff: @@ -349,6 +349,7 @@ class Admin
             if ($result) {
                 if (!$GLOBALS['session']->blocked()) {
                     $this->_logged_in = true;
+                    $GLOBALS['session']->regenerateSessionId();
                     $update = array(
                         'blockTime'  => 0,
                         'browser'  => htmlspecialchars($_SERVER['HTTP_USER_AGENT']),

programming_language: PHP
filename: session.class.php
change_type: ModificationType.MODIFY
diff: @@ -528,6 +528,13 @@ class Session
         return empty($_SESSION[$namespace][$name]);
     }
 
+    public function regenerateSessionId() {
+        $old_session = $this->getId();
+        session_regenerate_id();
+        Database::getInstance()->update('CubeCart_sessions', array('session_id' => $this->getId()), array('session_id' => $old_session), false);
+        $this->set_cookie(session_name(), session_id(), time()+$this->_session_timeout);
+    }
+
     /**
      * Set a session value to something
      *

programming_language: PHP
filename: user.class.php
change_type: ModificationType.MODIFY
diff: @@ -275,6 +275,7 @@ class User
                 }
                 if (!$GLOBALS['session']->blocked()) {
                     // possibly replaceable with session_set_save_handler?
+                    $GLOBALS['session']->regenerateSessionId();
                     $GLOBALS['db']->update('CubeCart_sessions', array('customer_id' => $user[0]['customer_id']), array('session_id' => $GLOBALS['session']->getId()));
                     $GLOBALS['db']->update('CubeCart_cookie_consent', array('customer_id' => $user[0]['customer_id']), array('session_id' => $GLOBALS['session']->getId()));
                     $GLOBALS['session']->set('language', $user[0]['language'], 'client');

programming_language: PHP