Detect command injection against Modbus TCP/RTU in ICS/SCADA environments by monitoring unauthorized writes, anomalous function codes, malformed frames, and deviations from communication baselines using ICS-aware IDS and deep packet inspection. Use when deploying IDS for Modbus OT networks, investigating unauthorized PLC register/coil changes, or responding to FrostyGoop-style Modbus attacks.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Detect command injection against Modbus TCP/RTU in ICS/SCADA environments by monitoring unauthorized writes, anomalous function codes, malformed frames, and deviations from communication baselines using ICS-aware IDS and deep packet inspection. Use when deploying IDS for Modbus OT networks, investigating unauthorized PLC register/coil changes, or responding to FrostyGoop-style Modbus attacks.
When deploying intrusion detection for environments using Modbus TCP (port 502) or Modbus RTU
When investigating suspected unauthorized modifications to PLC registers or coils
When building detection analytics for OT SOC monitoring Modbus-heavy environments
When responding to FrostyGoop-style attacks that leverage Modbus TCP for operational impact
When performing baseline validation after a suspected compromise of a Modbus master
Do not use for detecting attacks on non-Modbus protocols (see detecting-dnp3-protocol-anomalies for DNP3), for general IT network intrusion detection, or for Modbus device configuration (see performing-ot-vulnerability-scanning-safely).
Prerequisites
Network SPAN/TAP on the segment carrying Modbus TCP traffic (typically port 502)
Baseline of normal Modbus communication patterns (masters, slaves, function codes, register ranges, polling intervals)
Suricata, Zeek, or commercial OT IDS deployed with Modbus protocol parsers enabled
Understanding of Modbus function codes used in the environment (read vs write operations)
Access to PLC programming documentation to validate expected register ranges
Workflow
Step 1: Build Modbus Communication Baseline
Capture and analyze normal Modbus traffic to establish what constitutes legitimate communication patterns.
Step 2: Deploy Suricata Rules for Modbus Attack Detection
# Suricata IDS Rules for Modbus Command Injection Detection# Reference: MITRE ATT&CK for ICS, FrostyGoop analysis# Unauthorized Modbus write from non-engineering workstationalertmodbus!$MODBUS_AUTHORIZED_WRITERSany->$OT_PLC_SUBNET502(msg:"MODBUS-INJECTUnauthorizedwriteoperationdetected";modbus_func:write_single_coil;flow:to_server,established;classtype:attempted-admin;sid:4000001;rev:1;priority:1;)alertmodbus!$MODBUS_AUTHORIZED_WRITERSany->$OT_PLC_SUBNET502(msg:"MODBUS-INJECTUnauthorizedwritemultipleregisters";modbus_func:write_multiple_registers;flow:to_server,established;classtype:attempted-admin;sid:4000002;rev:1;priority:1;)# Modbus broadcast write affecting all slavesalertmodbusanyany->$OT_PLC_SUBNET502(msg:"MODBUS-INJECTBroadcastwritecommand(UnitID0)";modbus_unit_id:0;flow:to_server,established;classtype:attempted-admin;sid:4000003;rev:1;priority:1;)# Excessive Modbus write rate (potential automated attack)alertmodbusanyany->$OT_PLC_SUBNET502(msg:"MODBUS-INJECTExcessivewriterate-possibleautomatedattack";modbus_func:write_multiple_registers;flow:to_server,established;threshold:typethreshold,trackby_src,count20,seconds60;classtype:attempted-admin;sid:4000004;rev:1;)# Modbus diagnostics/restart commandalertmodbusanyany->$OT_PLC_SUBNET502(msg:"MODBUS-INJECTDiagnosticsfunctioncodedetected";modbus_func:diagnostics;flow:to_server,established;classtype:attempted-dos;sid:4000005;rev:1;)# FrostyGoop-pattern: write to specific register ranges used for heating controlalertmodbusanyany->$OT_PLC_SUBNET502(msg:"MODBUS-INJECTPotentialFrostyGoop-writetoheatingcontrolregisters";modbus_func:write_multiple_registers;content:"|0010|";offset:8;depth:2;flow:to_server,established;classtype:attempted-admin;sid:4000010;rev:1;priority:1;)
Key Concepts
Term
Definition
Modbus TCP
Industrial protocol operating on TCP port 502, lacking authentication or encryption, making it vulnerable to command injection
Function Code
Single byte in Modbus PDU specifying the operation (read coils, write registers, diagnostics); monitoring for unauthorized function codes is key to detection
MBAP Header
Modbus Application Protocol header in TCP variant containing transaction ID, protocol ID, length, and unit ID
FrostyGoop
First known malware using Modbus TCP for real-world operational impact, disrupted Ukrainian district heating in 2024
Unit ID
Address of the target Modbus slave device; Unit ID 0 is a broadcast affecting all slaves
Register Range
Specific memory addresses in the PLC; legitimate operations access known ranges; out-of-range access indicates reconnaissance or manipulation
Common Scenarios
Scenario: FrostyGoop-Style Heating Control Attack
Context: A building automation system uses Modbus TCP to control HVAC equipment. Monitoring detects unexpected write commands to heating control registers from an IP not associated with any authorized BMS controller.
Approach:
Verify the source IP against the authorized Modbus master list
Check if any authorized maintenance or configuration change is in progress
Capture full Modbus transaction including register addresses and values being written
Compare written values against safe operating ranges for the heating equipment
If unauthorized, immediately block the source IP at the industrial firewall
Inspect the source device for compromise indicators (malware, unauthorized remote access)
Verify current setpoints on all affected controllers against known-good values
Restore safe setpoints if manipulation is confirmed
Pitfalls: Modbus lacks authentication, so the source IP is the only identifier -- attackers can spoof IPs if ARP protections are not in place. Do not assume all writes are malicious; legitimate SCADA operations include writes. Always verify against the change management log before escalating.
Output Format
MODBUS INJECTION DETECTION REPORT
====================================
Analysis Period: [start] to [end]
Monitoring Point: [interface/SPAN description]
TRAFFIC SUMMARY:
Total Modbus Packets: [count]
Read Operations: [count]
Write Operations: [count]
Unauthorized Writes Detected: [count]
ALERTS:
[CRITICAL] Unauthorized write from [IP] to PLC [IP]
Function: Write Multiple Registers (FC 16)
Registers: [start]-[end]
MITRE: T0855 - Unauthorized Command Message
BASELINE DEVIATIONS:
New Modbus masters: [list]
Unusual function codes: [list]
Out-of-range register access: [list]
RECOMMENDED ACTIONS:
1. Verify source [IP] authorization status
2. Block unauthorized sources at industrial firewall
3. Validate PLC register values against known-good state