Rapid7 Vulnerability & Exploit Database

Modbus Unit ID and Station ID Enumerator

Back to Search

Modbus Unit ID and Station ID Enumerator



Modbus is a cleartext protocol used in common SCADA systems, developed originally as a serial-line (RS232) async protocol, and later transformed to IP, which is called ModbusTCP. default tcp port is 502. This module sends a command (0x04, read input register) to the modbus endpoint. If this command is sent to the correct unit-id, it returns with the same function-id. if not, it should be added 0x80, so that it sys 0x84, and an exception-code follows which do not interest us. This does not always happen, but at least the first 4 bytes in the return-packet should be exact the same as what was sent. You can change port, ip and the scan-range for unit-id. There is also added a value - BENICE - to make the scanner sleep a second or more between probes. We have seen installations where scanning too many too fast works like a DoS.


  • EsMnemon <esm@mnemonic.no>


Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':

msf > use auxiliary/scanner/scada/modbus_findunitid
msf auxiliary(modbus_findunitid) > show actions
msf auxiliary(modbus_findunitid) > set ACTION < action-name >
msf auxiliary(modbus_findunitid) > show options
    ...show and set options...
msf auxiliary(modbus_findunitid) > run 

Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.

– Jim O’Gorman | President, Offensive Security