CVE-2015-5721 (published 2016-09-03T20:59Z)

Malware Information Sharing Platform (MISP) before 2.3.90 allows remote attackers to conduct PHP object injection attacks via crafted serialized data, related to TemplatesController.php and populate_event_from_template_attributes.ctp.

Severity: HIGH
CVSS v2 base score: 7.5 (AV:N/AC:L/Au:N/C:P/I:P/A:P)
CVSS v3 base score: 9.8, CRITICAL (CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H)

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/MISP/MISP
commit_details: repo_url: https://github.com/MISP/MISP
author: Iglocska
author_date: 2015-07-01 08:38:40+02:00
msg: Security fix: Fix to a possible PHP Object injection

- unserialized user input replaced with json_decode
repository: repo_url: https://github.com/MISP/MISP
repo_name: MISP/MISP
description: MISP (core software) - Open Source Threat Intelligence and Sharing Platform
repo_language: PHP
owner: MISP
file_changes: filename: TemplatesController.php
change_type: ModificationType.MODIFY
diff: @@ -22,12 +22,9 @@ class TemplatesController extends AppController {
 
 	public function beforeFilter() { // TODO REMOVE
 		parent::beforeFilter();
-		$this->Security->unlockedActions = array('saveElementSorting', 'populateEventFromTemplate', 'uploadFile', 'deleteTemporaryFile');
+		$this->Security->unlockedActions = array('uploadFile', 'deleteTemporaryFile');
 	}
 	
-	public function fetchFormFromTemplate($id) {
-		
-	}
 	
 	public function index() {
 		$conditions = array();
@@ -136,6 +133,7 @@ class TemplatesController extends AppController {
 	}
 	
 	public function add() {
+		if (!$this->userRole['perm_template']) throw new MethodNotAllowedException('You are not authorised to do that.');
 		if ($this->request->is('post')) {
 			unset($this->request->data['Template']['tagsPusher']);
 			$tags = $this->request->data['Template']['tags'];
@@ -332,7 +330,7 @@ class TemplatesController extends AppController {
 			}
 			
 			if (isset($this->request->data['Template']['attributes'])) {
-				$attributes = unserialize($this->request->data['Template']['attributes']);
+				$attributes = json_decode($this->request->data['Template']['attributes'], true);
 				$this->loadModel('Attribute');
 				$fails = 0;
 				foreach($attributes as $k => &$attribute) {

programming_language: PHP
filename: populate_event_from_template_attributes.ctp
change_type: ModificationType.MODIFY
diff: @@ -29,7 +29,7 @@ endforeach;?>
 							'id' => 'attributes',
 							'label' => false,
 							'type' => 'hidden',
-							'value' => serialize($attributes),
+							'value' => json_encode($attributes),
 					));
 				?>
 			</fieldset>

programming_language: PHP