Extract zip from Modbus communication - Metasploit


This page contains detailed information about how to use the auxiliary/analyze/modbus_zip metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Extract zip from Modbus communication
Module: auxiliary/analyze/modbus_zip
Source code: modules/auxiliary/analyze/modbus_zip.rb
Disclosure date: -
Last modification time: 2019-06-18 14:08:47 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): 502
List of CVEs: -

This module is able to extract a zip file sent through Modbus from a pcap. Tested with Schneider TM221CE16R

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


msf > use auxiliary/analyze/modbus_zip
msf auxiliary(modbus_zip) > show targets
    ... a list of targets ...
msf auxiliary(modbus_zip) > set TARGET target-id
msf auxiliary(modbus_zip) > show options
    ... show and set options ...
msf auxiliary(modbus_zip) > exploit

Knowledge Base


Vulnerable Application


This module is able to extract a zip file sent through Modbus from a pcap.

Tested with Schneider TM221CE16R

Verification Steps


  1. Do: use auxiliary/analyze/modbus_zip
  2. Do: set PCAPFILE <PATH_TO_PCAP> where PATH_TO_PCAP is the PATH to the pcap file
  3. Do: exploit extract the zip file

Options


MODE

Default: UPLOAD. Changes offset within a packet that is used to check for a zip header.

Scenarios


msf > use auxiliary/analyze/modbus_zip
msf auxiliary(analyze/modbus_zip) > set PCAPFILE file.pcap
PCAPFILE => file.pcap
auxiliary(analyze/modbus_zip) > set MODE DOWNLOAD
MODE => DOWNLOAD
msf auxiliary(analyze/modbus_zip) > exploit
[*] Running module against 0.0.0.0

[*] Zip start on packet 1370
[*] Zip end on packet 1452
[*] Done!
[*] Auxiliary module execution completed

Go back to menu.

Msfconsole Usage


Here is how the analyze/modbus_zip auxiliary module looks in the msfconsole:

msf6 > use auxiliary/analyze/modbus_zip

msf6 auxiliary(analyze/modbus_zip) > show info

       Name: Extract zip from Modbus communication
     Module: auxiliary/analyze/modbus_zip
    License: Metasploit Framework License (BSD)
       Rank: Normal

Provided by:
  Jos�� Diogo Monteiro <[email protected]>
  Luis Rosa <[email protected])>

Check supported:
  No

Basic options:
  Name      Current Setting  Required  Description
  ----      ---------------  --------  -----------
  FILENAME                   no        Zip file output name
  MODE      UPLOAD           yes       Extract zip from upload/download capture (Accepted: UPLOAD, DOWNLOAD)
  PCAPFILE                   yes       Pcap to read
  RPORT     502              yes       The target port

Description:
  This module is able to extract a zip file sent through Modbus from a 
  pcap. Tested with Schneider TM221CE16R

Module Options


This is a complete list of options available in the analyze/modbus_zip auxiliary module:

msf6 auxiliary(analyze/modbus_zip) > show options

Module options (auxiliary/analyze/modbus_zip):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   FILENAME                   no        Zip file output name
   MODE      UPLOAD           yes       Extract zip from upload/download capture (Accepted: UPLOAD, DOWNLOAD)
   PCAPFILE                   yes       Pcap to read
   RPORT     502              yes       The target port

Advanced Options


Here is a complete list of advanced options supported by the analyze/modbus_zip auxiliary module:

msf6 auxiliary(analyze/modbus_zip) > show advanced

Module advanced options (auxiliary/analyze/modbus_zip):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   VERBOSE    false            no        Enable detailed status messages
   WORKSPACE                   no        Specify the workspace for this module

Auxiliary Actions


This is a list of all auxiliary actions that the analyze/modbus_zip module can do:

msf6 auxiliary(analyze/modbus_zip) > show actions

Auxiliary actions:

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

Evasion Options


Here is the full list of possible evasion options supported by the analyze/modbus_zip auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 auxiliary(analyze/modbus_zip) > 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.

Zip file not found in <PCAPFILE>


Here is a relevant code snippet related to the "Zip file not found in <PCAPFILE>" error message:

79:	    end
80:	
81:	    filename = datastore['FILENAME'] || 'project.zip'
82:	    unless data.empty?
83:	      path = store_loot(filename, 'application/zip', datastore['RHOSTS'], data, filename, 'modbus.zip')
84:	      print_good "Zip file saved in loot: #{path}"
85:	    else
86:	      print_status "Zip file not found in #{datastore['PCAPFILE']}"
87:	    end
88:	  end
89:	end

Go back to menu.


Go back to menu.

See Also


Check also the following modules related to this module:

Authors


  • José Diogo Monteiro <jdlopes[at]student.dei.uc.pt>
  • Luis Rosa <lmrosa[at]dei.uc.pt)>

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.