CVE-2014-7235 (published 2014-10-07T14:55Z)

htdocs_ari/includes/login.php in the ARI Framework module/Asterisk Recording Interface (ARI) in FreePBX before 2.9.0.9, 2.10.x, and 2.11 before 2.11.1.5 allows remote attackers to execute arbitrary code via the ari_auth cookie, related to the PHP unserialize function, as exploited in the wild in September 2014.

Severity: HIGH
CVSS v2 base score: 10.0 (AV:N/AC:L/Au:N/C:C/I:C/A:C)

Weakness information:
cwe_id: CWE-94
cwe_name: Improper Control of Generation of Code ('Code Injection')
description: The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
extended_description: 
            When a product allows a user's input to contain code syntax, it might be possible for an attacker to craft the code in such a way that it will alter the intended control flow of the product. Such an alteration could lead to arbitrary code execution.
            Injection problems encompass a wide variety of issues -- all mitigated in very different ways. For this reason, the most effective way to discuss these weaknesses is to note the distinct features which classify them as injection weaknesses. The most important issue to note is that all injection problems share one thing in common -- i.e., they allow for the injection of control plane data into the user-controlled data plane. This means that the execution of the process may be altered by sending code in through legitimate data channels, using no other mechanism. While buffer overflows, and many other flaws, involve the use of some further issue to gain execution, injection problems need only for the data to be parsed. The most classic instantiations of this category of weakness are SQL injection and format string vulnerabilities.
         
         

Fix information:
repo_url: https://github.com/FreePBX/fw_ari
commit_details: repo_url: https://github.com/FreePBX/fw_ari
author: Andrew Nagy
author_date: 2014-09-30 19:42:59-04:00
msg: FREEPBX-8070 Turn all serialized into json
repository: repo_url: https://github.com/FreePBX/fw_ari
repo_name: FreePBX-ContributedModules/fw_ari
repo_language: PHP
owner: FreePBX
file_changes: filename: login.php
change_type: ModificationType.MODIFY
diff: @@ -53,11 +53,16 @@ class Login {
     $data = '';
     $chksum = '';
     if (isset($_COOKIE['ari_auth'])) {
-      $buf = unserialize(stripslashes($_COOKIE['ari_auth']));
-      list($data,$chksum) = $buf;
+      $buf = json_decode($_COOKIE['ari_auth'],true);
+      if(!is_array($buf)) {
+        $data = false;
+        $chksum = false;
+      } else {
+        list($data,$chksum) = $buf;
+      }
     }
     if (md5($data) == $chksum) {
-      $data = unserialize($crypt->decrypt($data,$ARI_CRYPT_PASSWORD));
+      $data = json_decode($crypt->decrypt($data,$ARI_CRYPT_PASSWORD),true);
       $username = $data['username'];
       $password = $data['password'];
     }
@@ -290,11 +295,11 @@ class Login {
       if ($auth && $remember) {
 
         $data = array('username' => $username, 'password' => $password);
-        $data = $crypt->encrypt(serialize($data),$ARI_CRYPT_PASSWORD);
+        $data = $crypt->encrypt(json_encode($data),$ARI_CRYPT_PASSWORD);
 
         $chksum = md5($data);
 
-        $buf = serialize(array($data,$chksum));
+        $buf = json_encode(array($data,$chksum));
         setcookie('ari_auth',$buf,time()+365*24*60*60,'/');
       }
 
@@ -484,4 +489,4 @@ class Login {
 }
 
 
-?>
\ No newline at end of file
+?>

programming_language: PHP
filename: module.xml
change_type: ModificationType.MODIFY
diff: @@ -3,11 +3,12 @@
 	<modtype>framework</modtype>
 	<repo>standard</repo>
 	<name>FreePBX ARI Framework</name>
-	<version>2.11.1.4</version>
+	<version>2.11.1.5</version>
 	<publisher>Schmooze Com Inc</publisher>
 	<license>GPLv3+</license>
 	<licenselink>http://www.gnu.org/licenses/gpl-3.0.txt</licenselink>
 	<changelog>
+		*2.11.1.5* FREEPBX-8070 SECURITY ISSUE Exec shell on a host using bug in Asterisk Recording Interface index.php
 		*2.11.1.4* Force removal of User Panel Tab
 		*2.11.1.3* Delete user panel tab because it comes from this module now
 		*2.11.1.2* Resolve issue of user panel tab removement

programming_language: SQL