CVE-2015-10009 (published 2023-01-02T16:15Z)

A vulnerability was found in nterchange up to 4.1.0. It has been rated as critical. This issue affects the function getContent of the file app/controllers/code_caller_controller.php. The manipulation of the argument q with the input %5C%27%29;phpinfo%28%29;/* leads to code injection. The exploit has been disclosed to the public and may be used. Upgrading to version 4.1.1 is able to address this issue. The patch is named fba7d89176fba8fe289edd58835fe45080797d99. It is recommended to upgrade the affected component. The associated identifier of this vulnerability is VDB-217187.

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-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/nonfiction/nterchange_backend
commit_details: repo_url: https://github.com/nonfiction/nterchange_backend
author: Andy Vanee
author_date: 2015-04-21 16:18:51-06:00
msg: Addressing TLM vulnerability

A certain special escape sequence causes dynamic code callers to
execute arbitrary code.

    ?q=%5C%27%29;phpinfo%28%29;/*
repository: repo_url: https://github.com/nonfiction/nterchange_backend
repo_name: nonfiction/nterchange_backend
description: Content Management that gets out of your way
repo_language: PHP
owner: nonfiction
file_changes: filename: code_caller_controller.php
change_type: ModificationType.MODIFY
diff: @@ -86,14 +86,18 @@ class CodeCallerController extends AssetController {
 	function dynamicPHP(&$obj, $method, $include_file, $params=array()) {
 		$ret = '';
 		if (is_object($obj) && method_exists($obj, $method)) {
-			$ret .= "<?php\n" .
-				'include_once \'' . $include_file . '\';' . "\n" .
-				'$obj = unserialize(\'' . str_replace('\'', '\\\'', serialize($obj)) . '\');' . "\n" .
-				'$params = unserialize(\'' . str_replace('\'', '\\\'', serialize($params)) . '\');' . "\n" .
-				'print $obj->' . $method . '($params);' . "\n" .
-				"?>\n";
+			$ret .= '<?php include_once \'' . $include_file . '\';';
+			$ret .= '$obj = '    . $this->wrapSanitizedSerializer($obj)   . ';';
+			$ret .= '$params = ' . $this->wrapSanitizedSerializer($param) . ';';
+			$ret .= 'print $obj->' . $method . '($params);';
+			$ret .= '?>';
 		}
 		return $ret;
 	}
+
+	private function wrapSanitizedSerializer($obj) {
+		$encoded_serialized_string = base64_encode(serialize($obj));
+		return "unserialize(base64_decode('$encoded_serialized_string'))";
+	}
 }
 ?>

programming_language: PHP