Vulnerabilities > CVE-2017-14143 - Use of Hard-coded Credentials vulnerability in Kaltura Server

047910
CVSS 7.5 - HIGH
Attack vector
NETWORK
Attack complexity
LOW
Privileges required
NONE
Confidentiality impact
PARTIAL
Integrity impact
PARTIAL
Availability impact
PARTIAL
network
low complexity
kaltura
CWE-798
exploit available
metasploit

Summary

The getUserzoneCookie function in Kaltura before 13.2.0 uses a hardcoded cookie secret to validate cookie signatures, which allows remote attackers to bypass an intended protection mechanism and consequently conduct PHP object injection attacks and execute arbitrary PHP code via a crafted userzone cookie.

Vulnerable Configurations

Part Description Count
Application
Kaltura
140

Common Weakness Enumeration (CWE)

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Reverse Engineering
    An attacker discovers the structure, function, and composition of an object, resource, or system by using a variety of analysis techniques to effectively determine how the analyzed entity was constructed or operates. The goal of reverse engineering is often to duplicate the function, or a part of the function, of an object in order to duplicate or "back engineer" some aspect of its functioning. Reverse engineering techniques can be applied to mechanical objects, electronic devices or components, or to software, although the methodology and techniques involved in each type of analysis differ widely.
  • Software Reverse Engineering
    An attacker discovers the structure, function, and composition of a type of computer software by using a variety of analysis techniques to effectively determine how the software functions and operates, or if vulnerabilities or security weakness are present within the implementation. Reverse engineering methods, as applied to software, can utilize a wide number approaches and techniques. Methodologies for software reverse engineering fall into two broad categories, 'white box' and 'black box.' White box techniques involve methods which can be applied to a piece of software when an executable or some other compiled object can be directly subjected to analysis, revealing at least a portion of its machine instructions that can be observed upon execution. 'Black Box' methods involve interacting with the software indirectly, in the absence of the ability to measure, instrument, or analyze an executable object directly. Such analysis typically involves interacting with the software at the boundaries of where the software interfaces with a larger execution environment, such as input-output vectors, libraries, or APIs.
  • Reverse Engineer an Executable to Expose Assumed Hidden Functionality or Content
    An attacker analyzes a binary file or executable for the purpose of discovering the structure, function, and possibly source-code of the file by using a variety of analysis techniques to effectively determine how the software functions and operates. This type of analysis is also referred to as Reverse Code Engineering, as techniques exist for extracting source code from an executable. Several techniques are often employed for this purpose, both black box and white box. The use of computer bus analyzers and packet sniffers allows the binary to be studied at a level of interactions with its computing environment, such as a host OS, inter-process communication, and/or network communication. This type of analysis falls into the 'black box' category because it involves behavioral analysis of the software without reference to source code, object code, or protocol specifications. White box analysis techniques include file or binary analysis, debugging, disassembly, and decompilation, and generally fall into categories referred to as 'static' and 'dynamic' analysis. Static analysis encompasses methods which analyze the binary, or extract its source code or object code without executing the program. Dynamic analysis involves analyzing the program during execution. Some forms of file analysis tools allow the executable itself to be analyzed, the most basic of which can analyze features of the binary, such as the strings contained within the file. More sophisticated forms of static analysis analyze the binary file and extract assembly code, and possibly source code representations, from analyzing the structure of the file itself. Dynamic analysis tools execute the binary file and monitor its in memory footprint, revealing its execution flow, memory usage, register values, and machine instructions. This type of analysis is most effective for analyzing the execution of binary files whose content has been obfuscated or encrypted in its native executable form. Debuggers allow the program's execution to be monitored, and depending upon the debugger's sophistication may show relevant source code for each step in execution, or may display and allow interactions with memory, variables, or values generated by the program during run-time operations. Disassemblers operate in reverse of assemblers, allowing assembly code to be extracted from a program as it executes machine code instructions. Disassemblers allow low-level interactions with the program as it executes, such as manipulating the program's run time operations. Decompilers can be utilized to analyze a binary file and extract source code from the compiled executable. Collectively, the tools and methods described are those commonly applied to a binary executable file and provide means for reverse engineering the file by revealing the hidden functions of its operation or composition.
  • Read Sensitive Strings Within an Executable
    An attacker engages in activities to discover any sensitive strings are present within the compiled code of an executable, such as literal ASCII strings within the file itself, or possibly strings hard-coded into particular routines that can be revealed by code refactoring methods including static and dynamic analysis. One specific example of a sensitive string is a hard-coded password. Typical examples of software with hard-coded passwords include server-side executables which may check for a hard-coded password or key during a user's authentication with the server. Hard-coded passwords can also be present in client-side executables which utilize the password or key when connecting to either a remote component, such as a database server, licensing server, or otherwise, or a processes on the same host that expects a key or password. When analyzing an executable the attacker may search for the presence of such strings by analyzing the byte-code of the file itself. Example utilities for revealing strings within a file include 'strings,' 'grep,' or other variants of these programs depending upon the type of operating system used. These programs can be used to dump any ASCII or UNICODE strings contained within a program. Strings can also be searched for using a hex editors by loading the binary or object code file and utilizing native search functions such as regular expressions. More sophisticated methods of searching for sensitive strings within a file involve disassembly or decompiling of the file. One could, for example, utilize disassembly methods on an ISAPI executable or dll to discover a hard-coded password within the code as it executes. This type of analysis usually involves four stages in which first a debugger is attached to the running process, anti-debugging countermeasures are circumvented or bypassed, the program is analyzed step-by-step, and breakpoints are established so that discrete functions and data structures can be analyzed. Debugging tools such as SoftICE, Ollydbg, or vendor supplied debugging tools are often used. Disassembly tools such as IDA pro, or similar tools, can also be employed. A third strategy for accessing sensitive strings within a binary involves the decompilation of the file itself into source code that reveals the strings. An example of this type of analysis involves extracting source code from a java JAR file and then using functionality within a java IDE to search the source code for sensitive, hard-coded information. In performing this analysis native java tools, such as "jar" are used to extract the compiled class files. Next, a java decompiler such as "DJ" is used to extract java source code from the compiled classes, revealing source code. Finally, the source code is audited to reveal sensitive information, a step that is usually assisted by source code analysis programs.
  • Protocol Reverse Engineering
    An attacker engages in activities to decipher and/or decode protocol information for a network or application communication protocol used for transmitting information between interconnected nodes or systems on a packet-switched data network. While this type of analysis inherently involves the analysis of a networking protocol, it does not require the presence of an actual or physical network. Although certain techniques for protocol analysis benefit from manipulating live 'on-the-wire' interactions between communicating components, static or dynamic analysis techniques applied to executables as well as to device drivers such as network interface drivers, can also be used to reveal the function and characteristics of a communication protocol implementation. Depending upon the methods used, protocol reverse engineering can involve similar methods as those employed when reverse engineering an executable, or the process may involve observing, interacting, and modifying actual communications occurring between hosts. The goal of protocol reverse engineering is to derive the data transmission syntax, as well as to extract the meaningful content, including packet or content delimiters used by the protocol. This type of analysis is often performed on closed-specification protocols, or proprietary protocols, but is also useful for analyzing publicly available specifications to determine how particular implementations deviate from published specifications. There are several challenges inherent to protocol reverse engineering depending upon the nature of the protocol being analyzed. There may also be other types of factors which complicate the process such as encryption or ad hoc obfuscation of the protocol. In general there are two kinds of networking protocols, each associated with its own challenges and analysis approaches or methodologies. Some protocols are human-readable, which is to say they are text-based protocols. Examples of these types of protocols include HTTP, SMTP, and SOAP. Additionally, application-layer protocols can be embedded or encapsulated within human-readable protocols in the data portion of the packet. Typically, human-readable protocol implementations are susceptible to automatic decoding by the appropriate tools, such as Wireshark/ethereal, tcpdump, or similar protocol sniffers or analyzers. The presence of well-known protocol specifications in addition to easily identified protocol delimiters, such as Carriage Return or Line Feed characters (CRLF) result in text-based protocols susceptibility to direct scrutiny through manual processes. Protocol reverse engineering against protocol implementation such as HTTP is often performed to identify idiosyncratic implementations of a protocol by a server or client. In the case of application-layer protocols which are embedded within text-based protocols, analysis techniques typically benefit from the well-known nature of the encapsulating protocols and can focus on discovering the semantic characteristics of the proprietary protocol or API, since the syntax and protocol delimiters of the underlying protocols can be readily identified. When performing protocol analysis of machine-readable (non-text-based) protocols difficulties emerge as the protocol itself was designed to be read by computing process. Such protocols are typically composed entirely in binary with no apparent syntax, grammar, or structural boundaries. Examples of these types of protocols are IP, UDP, and TCP. Binary protocols with published specifications can be automatically decoded by protocol analyzers, but in the case of proprietary, closed-specification, binary protocols there are no immediate indicators of packet syntax such as packet boundaries, delimiters, or structure, or the presence or absence of encryption or obfuscation. In these cases there is no one technology that can extract or reveal the structure of the packet on the wire, so it is necessary to use trial and error approaches while observing application behavior based on systematic mutations introduced at the packet-level. Tools such as Protocol Debug (PDB) or other packet injection suites are often employed. In cases where the binary executable is available, protocol analysis can be augmented with static and dynamic analysis techniques.

Exploit-Db

  • descriptionKaltura - Remote PHP Code Execution over Cookie (Metasploit). CVE-2017-14143. Remote exploit for PHP platform. Tags: Metasploit Framework (MSF)
    fileexploits/php/remote/43876.rb
    idEDB-ID:43876
    last seen2018-01-24
    modified2018-01-24
    platformphp
    port
    published2018-01-24
    reporterExploit-DB
    sourcehttps://www.exploit-db.com/download/43876/
    titleKaltura - Remote PHP Code Execution over Cookie (Metasploit)
    typeremote
  • descriptionKaltura < 13.1.0 - Remote Code Execution. CVE-2017-14143. Webapps exploit for PHP platform
    fileexploits/php/webapps/43028.py
    idEDB-ID:43028
    last seen2017-10-23
    modified2017-10-23
    platformphp
    port
    published2017-10-23
    reporterExploit-DB
    sourcehttps://www.exploit-db.com/download/43028/
    titleKaltura < 13.1.0 - Remote Code Execution
    typewebapps

Metasploit

descriptionThis module exploits an Object Injection vulnerability in Kaltura. By exploiting this vulnerability, unauthenticated users can execute arbitrary code under the context of the web server user. Kaltura makes use of a hardcoded cookie secret which allows to sign arbitrary cookie data. After passing this signature check, the base64- decoded data is passed to PHPs unserialize() function which allows for code execution. The constructed object is again based on the SektionEins Zend code execution POP chain PoC. Kaltura versions prior to 13.1.0 are affected by this issue. A valid entry_id (which is required for this exploit) can be obtained from any media resource published on the kaltura installation. This module was tested against Kaltura 13.1.0-2 installed on Ubuntu 14.04.
idMSF:EXPLOIT/LINUX/HTTP/KALTURA_UNSERIALIZE_COOKIE_RCE
last seen2020-05-31
modified2017-11-21
published2017-10-23
referenceshttps://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-14143
reporterRapid7
sourcehttps://github.com/rapid7/metasploit-framework/blob/master//modules/exploits/linux/http/kaltura_unserialize_cookie_rce.rb
titleKaltura Remote PHP Code Execution over Cookie

Packetstorm

Seebug

bulletinFamilyexploit
description### 1) Unauthenticated Remote Code Execution through unserialize() from cookie data Because of a hardcoded cookie secret, the cookie signature validation can be bypassed and malicious user input can be passed via the 'userzone' cookie to the unserialize() function: ``` abstract class kalturaAction extends sfAction { private $cookieSecret = 'y3tAno3therS$cr3T'; // [...] protected function getUserzoneCookie() { $cookie = $this->getContext()->getRequest()->getCookie('userzone'); $length = strlen($cookie); if ($length <= 0) return null; $serialized_data = substr($cookie, 0, $length - 32); $hash_signiture = substr($cookie, $length - 32); // check the signiture if (md5($serialized_data . $this->cookieSecret) != $hash_signiture) return null; $userzone_data = unserialize(base64_decode($serialized_data)); ``` To pass this validation the base64 encoded serialized object has to be hashed and this hash appended to the encoded data. A Zend Framework POP chain [1] can then be used to execute PHP code when unserializing. When using PHP7 a different chain has to be used because the e-modifier for preg_replace is not available anymore. To execute the getUserzoneCookie() function the getAllEntriesAction has to be called with a valid entry ID. This ID can be obtained from any public video object which is embedded and typically begins with '0_'. ### 2) Authenticated Remote Code Execution through unserialize() in the admin panel The admin panel provides a few 'Developer System Helper' functions to encode/decode user supplied data. The 'wiki_decode' function will take user input and pass it nearly untouched to unserialize(): ``` // slightly formatted for better readability if ( $algo == "wiki_encode" ) { $res = str_replace( array ( "|" , "/") , array ("|01" , "|02"), base64_encode(serialize($str)) ); } By passing a base64 encoded malicious serialized object, PHP code can be executed. ``` ### 3) Multiple Cross-Site Scripting vulnerabilities under the API path A few cross-site scripting vulnerabilities were found earlier this year and fixed [2]. However, this fix was insufficient because PHPs strip_tags() function only strips tags and is not adequate to secure against XSS vulnerabilities. There are a few places where this can be exploited to inject javascript code: // server/admin_console/web/tools/bigRedButton.php, line 8 ``` $partnerId = strip_tags($_GET['partnerId']); // [...] <script> var partnerId = <?php echo $partnerId; ?>; ``` As can be seen above no tags need to be inserted here to execute javascript code. A simple partnerId=alert(1) will be executed in this scenario. This also affects a few other files. server/admin_console/web/tools/bigRedButton.php ``` - $_GET['partnerId'] - $_GET['playerVersion'] ``` server/admin_console/web/tools/bigRedButtonPtsPoc.php ``` - $_GET['partnerId'] - $_GET['playerVersion'] - $_GET['secret'] - $_GET['entryId'] - $_GET['adminUiConfId'] - $_GET['uiConfId'] ``` server/admin_console/web/tools/AkamaiBroadcaster.php ``` - $_GET['streamUsername'] - $_GET['streamPassword'] - $_GET['streamRemoteId'] - $_GET['streamRemoteBackupId'] - $_GET['entryId'] ``` server/admin_console/web/tools/XmlJWPlayer.php ``` - $_GET['entryId'] ``` server/alpha/web/lib/bigRedButtonPtsPocHlsjs.php ``` - $_GET['partnerId'] - $_GET['playerVersion'] ``` ### Additional notes: The already published Server Side Request Forgery attack [3] was not fixed properly, because only an additional check for the http(s) protocol was added. This still allows to talk to some backend services (like the memcached) or other machines. There is a whitelist in place to make this more secure, but I could not find a way how to set this up. This is likely responsible for a lot of insecure default installations of Kaltura in the wild. ### Recommendation: It is recommended to upgrade to the latest version of Kaltura. ### Disclosure Timeline: * 16. August 2017 - Notified vendor * 22. August 2017 - Remote Command Execution vulnerabilities fixed * 05. September 2017 - Cross-Site scripting vulnerabilities fixed * 11. September 2017 - Kaltura 13.2.0 released * 12. September 2017 - Released advisory
idSSV:96768
last seen2017-11-19
modified2017-10-24
published2017-10-24
reporterRoot
sourcehttps://www.seebug.org/vuldb/ssvid-96768
titleKaltura - Remote Code Execution and Cross-Site Scripting