Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

modbus enumerate

Scans a configurable address range across all four Modbus data types to discover which addresses a device will serve without error:

Data typeFunction codeDefault scan
Holding registersFC03yes
Input registersFC04yes
CoilsFC01yes
Discrete inputsFC02yes

Addresses are read in blocks of 125 (the Modbus maximum per request). The scan reports each contiguous accessible range and the total number of readable locations. This reveals the full attack surface available to an unauthenticated attacker.

Status

ResultMeaning
passAt least one accessible address found
failNo accessible addresses, or connection failed

Severity classification

SeverityCondition
HighMore than 100 accessible addresses of a given type
HighSummary finding when any data is found
Medium1-100 accessible addresses of a given type
InfoNo accessible addresses for a data type
InfoNo data found at all, or connection failed

Usage

iottack modbus enumerate --host <HOST> [OPTIONS]
iottack modbus enumerate --serial <DEVICE> [OPTIONS]

Options

FlagShortDefaultDescription
--host <HOST>-H(required or –serial)Target hostname or IP for Modbus/TCP
--tcp-port <PORT>-502Modbus/TCP port
--serial <DEVICE>-s(required or –host)Serial device for Modbus RTU (e.g., /dev/ttyUSB0)
--baud <BAUD>-9600Baud rate for RTU serial
--unit <ID>-u1Modbus unit/slave ID (1-247)
--timeout-ms <MS>-t3000Per-block timeout (lower values speed up the scan)
--start-addr <ADDR>-S0First address to scan
--end-addr <ADDR>-E999Last address to scan (inclusive)
--no-holding-offSkip holding register scan (FC03)
--no-input-offSkip input register scan (FC04)
--no-coils-offSkip coil scan (FC01)
--no-discrete-offSkip discrete input scan (FC02)
--output <FILE>-o-Save result to a file
--format <FORMAT>-ftexttext or json
--verbose-v-Increase log verbosity

Performance notes

Each block read is one round-trip. For the default range (0-999) with all four data types, the scan issues approximately 36 requests (⌈1000/125⌉ * 4 = 32-36). Reduce --timeout-ms (e.g., 500) for faster scans when the network is reliable.

Examples

Full default scan over TCP:

iottack modbus enumerate --host 192.168.1.100

Scan a wider range with a shorter timeout:

iottack modbus enumerate --host 192.168.1.100 \
  --start-addr 0 --end-addr 9999 --timeout-ms 500

Only scan holding registers and coils:

iottack modbus enumerate --host 192.168.1.100 \
  --no-input --no-discrete

RTU serial, unit 5:

iottack modbus enumerate --serial /dev/ttyUSB0 --unit 5

Example output

Plugin name:    modbus/enumerate
Execution time: 3.21 s
Status:         pass

[HIGH] Modbus/TCP: 875 accessible Holding Registers (FC03) in range 0-999
  Unit 1: 875 addresses in 2 contiguous block(s) are readable without
  authentication.
  Evidence:
    Accessible ranges: 0-874, 900-999
    Total accessible: 875

[MEDIUM] Modbus/TCP: 16 accessible Coils (FC01) in range 0-999
  Unit 1: 16 addresses in 1 contiguous block(s) are readable without
  authentication.
  Evidence:
    Accessible ranges: 0-15
    Total accessible: 16

[INFO] Modbus/TCP: no accessible Input Registers (FC04) in range 0-999
[INFO] Modbus/TCP: no accessible Discrete Inputs (FC02) in range 0-999

[HIGH] Modbus/TCP: 891 total accessible data points on unit 1
  Enumeration of addresses 0-999 found 891 readable locations across all
  scanned data types.
    Holding Registers (FC03): 875 accessible (2 range(s): 0-874, 900-999)
    Input Registers    (FC04): no accessible addresses
    Coils              (FC01): 16 accessible (1 range(s): 0-15)
    Discrete Inputs    (FC02): no accessible addresses