☼
⌃
☰

Modbus

Table of Contents

Related: Industrial Control Systems Programmable Logic Controller SCADA

Modbus

Description

Created in 1979 by Modicon (now Schneider Electric), Modbus has become a "de facto" standard in Operational Technology (OT) due to its simplicity and royalty-free nature. It operates at Layer 7 of the OSI model and is primarily used to move data between control devices and data collection systems.

Protocol Variations

Modbus exists in three primary formats depending on the transmission medium:

  1. Modbus RTU (Remote Terminal Unit): Used over serial communication (RS-485/RS-232). It represents data in binary format and is known for its efficiency and reliability in harsh industrial environments.
  2. Modbus ASCII: A serial variation that uses ASCII characters. It is slower than RTU but easier for humans to read and more tolerant of timing issues.
  3. Modbus TCP/IP: Wraps the Modbus message inside a TCP/IP packet, allowing communication over standard Ethernet networks (typically on Port 502).

DData Model and Addressing

Modbus organizes data into four primary tables based on the type of data and the access permissions:

Data Type Access Description
Coils Read-Write Single-bit values used to control ON/OFF outputs (e.g., turning on a motor).
Discrete Inputs Read-Only Single-bit values from physical inputs (e.g., a limit switch being triggered).
Input Registers Read-Only 16-bit values representing analog data (e.g., current temperature).
Holding Registers Read-Write 16-bit values used for configuration or multi-word data storage.

Security Considerations

The primary challenge with standard Modbus is that it was designed before cybersecurity was a concern for industrial plants.

  • Lack of Authentication: Modbus does not require a password or handshake; any device on the network can send commands to a PLC.
  • No Encryption: Traffic is sent in cleartext, allowing attackers to sniff sensitive process data or perform Man-in-the-Middle (MitM) attacks.
  • Modern Fixes: Modern implementations use Modbus/TCP Security, which incorporates TLS (Transport Layer Security) to provide encryption and authentication.

Examples

1. Reading a Temperature Sensor (Request/Response)

A SCADA system (Client) wants to read the current temperature from a PLC (Server) at address 1.

Request: ID: 01 | Function Code: 04 (Read Input Register) | Address: 00 01 | Count: 00 01 Response: ID: 01 | Function Code: 04 | Byte Count: 02 | Value: 03 E8 (1000 in decimal)

2. Scanning for Modbus Devices

Penetration testers and security researchers use nmap to identify Modbus-enabled devices during an audit.

SH
# Scan a network range for the default Modbus port and identify the device ID
nmap -p 502 --script modbus-discover 192.168.1.0/24