SSD Advisory – IBM Informix Dynamic Server and Informix Open Admin Tool Multiple Vulnerabilities

Credit to Author: SSD / Maor Schwartz| Date: Tue, 23 May 2017 06:41:53 +0000

Want to get paid for a vulnerability similar to this one?
Contact us at: sxsxdx@xbxexyxoxnxdxsxexcxuxrxixtxy.xcom

Vulnerabilities Summary
The following advisory describes six (6) vulnerabilities found in Informix Dynamic Server and Informix Open Admin Tool.

IBM Informix Dynamic Server Exceptional, low maintenance online transaction processing (OLTP) data server for enterprise and workgroup computing.

IBM Informix Dynamic Server has many features that cater to a variety of user groups, including developers and administrators. One of the strong features of IDS is the low administration cost. IDS is well known for its hands-free administration. To make server administration even easier, a new open source, platform-independent tool called OpenAdmin Tool (OAT) is now available to IDS users. The OAT includes a graphical interface for administrative tasks and performance analysis tools.

Vulnerabilities:

  1. Unauthentication static PHP code injection that leads to remote code execution
  2. Heap buffer overflow
  3. Remote DLL Injection that leads to remote code execution (1)
  4. Remote DLL Injection that leads to remote code execution (2)
  5. Remote DLL Injection that leads to remote code execution (3)
  6. Remote DLL Injection that leads to remote code execution (4)

Credit
An independent security researcher has reported this vulnerability to Beyond Security’s SecuriTeam Secure Disclosure program

Vendor response
IBM has released patches to address those vulnerabilities and issued the following CVE’s:

  • CVE-2016-2183
  • CVE-2017-1092

For more Information – http://www-01.ibm.com/support/docview.wss?uid=swg22002897

Vulnerabilities Details
IBM Informix Dynamic Server installs a PHP enable Apache server as a Windows Service (“Apache_for_OAT”) which listens on public port 8080 (tcp/http) for incoming requests to the OpenAdmin web panel. It runs with NT AUTHORITYSYSTEM privileges.

Unauthentication static PHP code injection that leads to remote code execution
IBM Informix Dynamic Server Developer is vulnerable to Unauthentication static PHP code injection by invoking welcomeService.php which offers a SOAP interface.

The welcomeServer.php class suffers of a static PHP code injection into the “saveHomePage” method. Arbitrary code can be injected into ‘config.php‘, which is accessible to remote users. Given this, a remote attacker could execute arbitrary code/commands with the privileges of the target service.

Vulnerable code – C:Program Files (x86)IBM Informix Software BundleOATApache_2.2.22htdocsopenadminserviceswelcomewelcomeService.php

If we will look into saveHomePage() method inside
C:Program Files (x86)IBM Informix Software BundleOATApache_2.2.22htdocsopenadminserviceswelcomewelcomeServer.php:

Note that $new_home_page is the unique parameter of a SOAP request and it is controlled;

The resulting file could look like this:

config.php is not protected so we can execute system() through a GET request.

Proof of Concept

Heap buffer overflow
IBM Informix Dynamic Server Developer is vulnerable to Unauthentication heap buffer overflow. By submitting connection parameters to index.php, through the ‘server’ property, it is possible to trigger a heap buffer overflow vulnerability into the underlying PHP Informix extension (php_pdo_informix.dll).

When attaching WinDbg to the httpd.exe sub-process, it shows:

esi is controlled by the attacker and could be used to execute arbitrary code or to create denial of service conditions

Proof of Concept

Remote DLL Injection that leads to remote code execution (1)
IBM Informix Dynamic Server Developer is vulnerable to Unauthentication Remote DLL Injection that leads to remote code execution.

by submitting connection parameters to index.php, setting the ‘act‘ parameter to ‘login‘ and the ‘do‘ one to ‘testconn‘, it is possible to inject arbitrary statements into a connection string for the underlying Informix database.

The __construct() method of the PDO_OAT.php library passing them to PDO::__construct() without prior sensitization

Given this it is possible to inject the “TRANSLATIONDLL” connection parameter and to point it to an arbitrary dll from a remote network share, prepared by the attacker. If the dll entry point contains malicious code, this will be executed instantly. This can be done ex. through the ‘HOST‘ parameter of a POST request.

Vulnerable code – C:Program Files (x86)IBM Informix Software BundleOATApache_2.2.22htdocsopenadminmoduleslogin.php

Let’s look into C:Program Files (x86)IBM Informix Software BundleOATApache_2.2.22htdocsopenadminlibPDO_OAT.php

At [***] the getDSN() function is called
At [****] and following various parameters are concatenated into a connection string without prior sanitization and set to $dsn
At [*****] the resulting connection string it’s passed to PDO::__construct(), resulting in the dll to be loaded instantly.

Remote DLL Injection that leads to remote code execution (2)
IBM Informix Dynamic Server Developer is vulnerable to Unauthentication Remote DLL Injection that leads to remote code execution.

By submitting a SOAP request to oliteService.php, specifying ex. the ‘canConnectToIDS‘ method, it is possible to inject arbitrary parameters into a
database connection string for the underlying Informix database.

It is possible to inject ex. the ‘TRANSLATIONDLL‘ parameter and, if this parameter points to a dll into an existing remote network
share, the dll will be injected into the remote Apache process. If malicious code is contained into the dll entry point, this will
be executed instantly.

Vulnerable code is located inside the getDBConnection() function of the underlying oliteServer.php PHP class, where connection parameters are concatenated without prior sanitization.

Vulnerable code – C:Program Files (x86)IBM Informix Software BundleOATApache_2.2.22htdocsopenadminservicesoliteoliteService.php

The SOAP interface can be interrogated without prior authentication, Let’s take a look into ‘canConnectToIDS‘ method inside
C:Program Files (x86)IBM Informix Software BundleOATApache_2.2.22htdocsopenadminservicesoliteoliteServer.php

$server, $host, $port, $protocol are received from the SOAP request and they are fully controlled;
at [1] doDatabaseWork() is called, then look:

At [2] getDBConnection() is called with controlled parameters, finally look:

At [3] a connection string is concatenated without prior sanitization, arbitrary parameters can be injected via ‘;’; ‘TRANSLATIONDLL’ and other dangerous parameters can be specified.

At [4], the resulting connection string is passed to the PDO object, causing the dll to be loaded before the authentication is performed.

Remote DLL Injection that leads to remote code execution (3)
IBM Informix Dynamic Server Developer is vulnerable to Unauthentication Remote DLL Injection that leads to remote code execution.

The specific flaw exists within two PHP scripts in OpenAdmin tool.

  1. MACH11Server.php allows to insert a row into the underlying SQLite Database without prior authentication, by sending a specific SOAP request to MACH11Service.php and specifying the ‘addServerToCache‘ method.
  2. pinger.php construct a connection string for the underlying Informix database, based on the row previously inserted. Given this it is possible to inject the ‘TRANSLATIONDLL‘ property into this connection string and to cause the Apache process to load the pointed dll from a remote network share controlled by the attacker.

vulnerable code – C:Program Files (x86)IBM Informix Software BundleOATApache_2.2.22htdocsopenadminservicesidsadminMACH11Server.php

The previously empty ‘connections‘ table is populated with one row.

Let’s look at C:Program Files (x86)IBM Informix Software BundleOATApache_2.2.22htdocsopenadminlibpinger.php

at [1] a connection string is concatenated with values taken from SQLite connection table. Arbitrary properties can be specified through “;”, leading to remote code
execution, when [2] the PDO object is instantiated.

Remote DLL Injection that leads to remote code execution (4)
IBM Informix Dynamic Server Developer is vulnerable to Unauthentication Remote DLL Injection that leads to remote code execution.

By contact the ‘adminapiService.php‘ SOAP interface and constructing a proper request to this endpoint, with the ‘createSBSpace‘ method specified, it possible to inject parameters into a connection string for the underlying Informix database.

vulnerable code – C:Program Files (x86)IBM Informix Software BundleOATApache_2.2.22htdocsopenadminservicesadminapiadminapiService.php

There is no check before handling request.

Let’s look into the createSBSpace() method from C:Program Files (x86)IBM Informix Software BundleOATApache_2.2.22htdocsopenadminservicesadminapiadminapiServer.php

at [1] doDatabaseWork() is called with a controlled $connectionObj parameter.

At [2] the ‘soapdb‘ class is instantiated with controlled parameters

__construct() method from C:Program Files (x86)IBM Informix Software BundleOATApache_2.2.22htdocsopenadminservicesadminapisoapdb.php

at [3] a connection string is concatenated with user-controlled parameters

at [4] PDO::__construct() is called, then the dll is loaded by the Apache process.

Print Friendly

https://blogs.securiteam.com/index.php/feed