Unitronics PCOM Client - Metasploit


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

Module Overview


Name: Unitronics PCOM Client
Module: auxiliary/scanner/scada/pcomclient
Source code: modules/auxiliary/scanner/scada/pcomclient.rb
Disclosure date: -
Last modification time: 2019-02-08 19:22:48 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): 20256
List of CVEs: -

Unitronics Vision PLCs allow unauthenticated PCOM commands to query PLC registers.

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/scanner/scada/pcomclient
msf auxiliary(pcomclient) > show targets
    ... a list of targets ...
msf auxiliary(pcomclient) > set TARGET target-id
msf auxiliary(pcomclient) > show options
    ... show and set options ...
msf auxiliary(pcomclient) > exploit

Required Options


  • RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'

Knowledge Base


Vulnerable Application


Unitronics Vision PLCs using PCOM protocol

Verification Steps


  1. Do: use scanner/scada/pcomclient
  2. Do: set RHOST=IP where IP is the IP address of the target
  3. Do: run to send PCOM command

## Scenarios

msf > use scanner/scada/pcomclient
msf auxiliary(scanner/scada/pcomclient) > show options

Module options (auxiliary/scanner/scada/pcomclient):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   ADDRESS  0                yes       PCOM memory address (0 - 65535)
   LENGTH   3                yes       Number of values to read (1 - 255) (read only)
   OPERAND  MI               yes       Operand type (Accepted: Input, Output, SB, MB, MI, SI, ML, SL)
   RHOST                     yes       The target address
   RPORT    20256            yes       The target port (TCP)
   UNITID   0                no        Unit ID (0 - 127)
   VALUES                    no        Values to write (0 - 65535 each) (comma separated) (write only)


Auxiliary action:

   Name  Description
   ----  -----------
   READ  Read values from PLC memory


msf auxiliary(scanner/scada/pcomclient) > set RHOST 192.168.1.1
RHOST => 192.168.1.1
msf auxiliary(scanner/scada/pcomclient) > run

[*] 192.168.1.1:20256 - Reading 03 values (MI) starting from 0000 address
[+] 192.168.1.1:20256 - [00000] : 0
[+] 192.168.1.1:20256 - [00001] : 1
[+] 192.168.1.1:20256 - [00002] : 0
[*] Auxiliary module execution completed
msf auxiliary(scanner/scada/pcomclient) >

Go back to menu.

Msfconsole Usage


Here is how the scanner/scada/pcomclient auxiliary module looks in the msfconsole:

msf6 > use auxiliary/scanner/scada/pcomclient

msf6 auxiliary(scanner/scada/pcomclient) > show info

       Name: Unitronics PCOM Client
     Module: auxiliary/scanner/scada/pcomclient
    License: Metasploit Framework License (BSD)
       Rank: Normal

Provided by:
  Luis Rosa <[email protected]>

Available actions:
  Name   Description
  ----   -----------
  READ   Read values from PLC memory
  WRITE  Write values to PLC memory

Check supported:
  No

Basic options:
  Name     Current Setting  Required  Description
  ----     ---------------  --------  -----------
  ADDRESS  0                yes       PCOM memory address (0 - 65535)
  LENGTH   3                yes       Number of values to read (1 - 255) (read only)
  OPERAND  MI               yes       Operand type (Accepted: Input, Output, SB, MB, MI, SI, ML, SL, SDW, MDW)
  RHOSTS                    yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
  RPORT    20256            yes       The target port (TCP)
  UNITID   0                no        Unit ID (0 - 127)
  VALUES                    no        Values to write (0 - 65535 each) (comma separated) (write only)

Description:
  Unitronics Vision PLCs allow unauthenticated PCOM commands to query 
  PLC registers.

References:
  https://unitronicsplc.com/Download/SoftwareUtilities/Unitronics%20PCOM%20Protocol.pdf

Module Options


This is a complete list of options available in the scanner/scada/pcomclient auxiliary module:

msf6 auxiliary(scanner/scada/pcomclient) > show options

Module options (auxiliary/scanner/scada/pcomclient):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   ADDRESS  0                yes       PCOM memory address (0 - 65535)
   LENGTH   3                yes       Number of values to read (1 - 255) (read only)
   OPERAND  MI               yes       Operand type (Accepted: Input, Output, SB, MB, MI, SI, ML, SL, SDW, MDW)
   RHOSTS                    yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
   RPORT    20256            yes       The target port (TCP)
   UNITID   0                no        Unit ID (0 - 127)
   VALUES                    no        Values to write (0 - 65535 each) (comma separated) (write only)

Auxiliary action:

   Name  Description
   ----  -----------
   READ  Read values from PLC memory

Advanced Options


Here is a complete list of advanced options supported by the scanner/scada/pcomclient auxiliary module:

msf6 auxiliary(scanner/scada/pcomclient) > show advanced

Module advanced options (auxiliary/scanner/scada/pcomclient):

   Name            Current Setting  Required  Description
   ----            ---------------  --------  -----------
   CHOST                            no        The local client address
   CPORT                            no        The local client port
   ConnectTimeout  10               yes       Maximum number of seconds to establish a TCP connection
   Proxies                          no        A proxy chain of format type:host:port[,type:host:port][...]
   SSL             false            no        Negotiate SSL/TLS for outgoing connections
   SSLCipher                        no        String for SSL cipher - "DHE-RSA-AES256-SHA" or "ADH"
   SSLVerifyMode   PEER             no        SSL verification method (Accepted: CLIENT_ONCE, FAIL_IF_NO_PEER_CERT, NONE, PEER)
   SSLVersion      Auto             yes       Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Auto, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
   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 scanner/scada/pcomclient module can do:

msf6 auxiliary(scanner/scada/pcomclient) > show actions

Auxiliary actions:

   Name   Description
   ----   -----------
   READ   Read values from PLC memory
   WRITE  Write values to PLC memory

Evasion Options


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

msf6 auxiliary(scanner/scada/pcomclient) > show evasion

Module evasion options:

   Name                Current Setting  Required  Description
   ----                ---------------  --------  -----------
   TCP::max_send_size  0                no        Maxiumum tcp segment size.  (0 = disable)
   TCP::send_delay     0                no        Delays inserted before every send.  (0 = disable)

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 ADDRESS


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

67:	      pcom_ascii_payload
68:	  end
69:	
70:	  def read
71:	    if datastore['LENGTH'] + datastore['ADDRESS'] > 65535
72:	      print_error("Invalid ADDRESS")
73:	      return
74:	    end
75:	
76:	    case datastore['OPERAND']
77:	    when "Input"

Unknown operand <OPERAND>


Here is a relevant code snippet related to the "Unknown operand <OPERAND>" error message:

93:	    when "SDW"
94:	      cc = "RNJ"
95:	    when "MDW"
96:	      cc = "RND"
97:	    else
98:	      print_error("Unknown operand #{datastore['OPERAND']}")
99:	      return
100:	    end
101:	
102:	    address = datastore['ADDRESS'].to_s(16).rjust(4,'0')
103:	    length = datastore['LENGTH'].to_s(16).rjust(2,'0')

Unknown answer <CC>


Here is a relevant code snippet related to the "Unknown answer <CC>" error message:

124:	    when "GF"
125:	      size = 4
126:	    when "RN"
127:	      size = 8
128:	    else
129:	      print_error("Unknown answer #{cc}")
130:	      return
131:	    end
132:	    data.scan(/.{#{size}}/).each_with_index {|val, i|
133:	      print_good("[#{(start_addr + i).to_s.rjust(5,'0')}] : #{val.to_i(16)}")}
134:	  end

Input operand is read only


Here is a relevant code snippet related to the "Input operand is read only" error message:

135:	
136:	  def write
137:	    values = datastore['VALUES'].split(",")
138:	    case datastore['OPERAND']
139:	    when "Input"
140:	      print_error("Input operand is read only")
141:	      return
142:	    when "Output"
143:	      cc = "SA"
144:	    when "SB"
145:	      cc = "SS"

Unknown operand <OPERAND>


Here is a relevant code snippet related to the "Unknown operand <OPERAND>" error message:

156:	    when "SDW"
157:	      cc = "SDJ"
158:	    when "MDW"
159:	      cc = "SND"
160:	    else
161:	      print_error("Unknown operand #{datastore['OPERAND']}")
162:	      return
163:	    end
164:	
165:	    address = datastore['ADDRESS'].to_s(16).rjust(4,'0')
166:	    length = values.length.to_s(16).rjust(2,'0')

The option VALUES is not set


Here is a relevant code snippet related to the "The option VALUES is not set" error message:

173:	  def run
174:	    connect
175:	    case action.name
176:	    when "READ"
177:	      if datastore['LENGTH'] == nil
178:	        print_error("The option VALUES is not set")
179:	        return
180:	      else
181:	        ans = read
182:	        if ans == nil
183:	          print_error("No answer from PLC")

No answer from PLC


Here is a relevant code snippet related to the "No answer from PLC" error message:

178:	        print_error("The option VALUES is not set")
179:	        return
180:	      else
181:	        ans = read
182:	        if ans == nil
183:	          print_error("No answer from PLC")
184:	          return
185:	        end
186:	        print_read_ans(ans.to_s[10..(ans.length-4)])
187:	      end
188:	    when "WRITE"

The option VALUES is not set


Here is a relevant code snippet related to the "The option VALUES is not set" error message:

185:	        end
186:	        print_read_ans(ans.to_s[10..(ans.length-4)])
187:	      end
188:	    when "WRITE"
189:	      if datastore['VALUES'] == nil
190:	        print_error("The option VALUES is not set")
191:	        return
192:	      else
193:	        ans = write
194:	        if ans == nil
195:	          print_error("No answer from PLC")

No answer from PLC


Here is a relevant code snippet related to the "No answer from PLC" error message:

190:	        print_error("The option VALUES is not set")
191:	        return
192:	      else
193:	        ans = write
194:	        if ans == nil
195:	          print_error("No answer from PLC")
196:	          return
197:	        end
198:	      end
199:	    else
200:	      print_error("Unknown action #{action.name}")

Unknown action <ACTION.NAME>


Here is a relevant code snippet related to the "Unknown action <ACTION.NAME>" error message:

193:	        ans = write
194:	        if ans == nil
195:	          print_error("No answer from PLC")
196:	          return
197:	        end
198:	      end
199:	    else
200:	      print_error("Unknown action #{action.name}")
201:	    end
202:	  end
203:	end

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • Luis Rosa <lmrosa[at]dei.uc.pt>

Version


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

Go back to menu.