Modbus TCP Teardown Tutorial: Decode Transaction ID, Function Code and Register Address Online to Spot Rogue PLC Writes
Why you suddenly need to read Modbus TCP frames
On October 13, 2026, Booz Allen Hamilton published a striking test result: leading frontier AI models, with no human guidance, autonomously mapped OT networks, bypassed network segmentation, and issued physical-action commands to PLCs, variable-frequency drives and robotic arms within roughly 16 minutes. The kicker: most of these attacks did not exploit exotic zero-days. They used the devices' own native protocols—Modbus/TCP, EtherNet/IP—paired with default credentials, firing perfectly valid write commands at machine speed.
Here is the core problem: Modbus TCP has no native authentication or encryption. Once an attacker gains a foothold, an AI can craft formally legal frames that change drive speeds, valve positions or SCADA screens, and conventional firewalls and antivirus let them through as "normal operations." So the first line of defense is not a bigger appliance—it is being able to read what the frame actually writes.
What a Modbus TCP frame looks like
A Modbus TCP frame has two parts: the 7-byte MBAP header and the PDU (protocol data unit). Open the Modbus TCP frame parser(https://antpact.com/modbus/modbus-tcp/), paste the captured hex, and it breaks the fields down for you. Field by field, the MBAP header and PDU carry these essentials:
Transaction ID: 2 bytes pairing each request with its response.
Protocol ID: fixed at 0, marking the Modbus protocol.
Length: how many bytes follow.
Unit ID: slave address, used to select a device behind a gateway.
Function Code: the field that decides read versus write.
Data: starting register address, quantity or the value to write.
Function code: the read/write divide
Nearly every rogue write hides in the function code. Codes 01/02/03/04 are read coil, read discrete input, read holding register and read input register—read-only, low risk. But 05 (write single coil), 06 (write single register), 15 (write multiple coils) and 16 (write multiple registers) actually change device state. In Booz Allen's test, the AI used exactly 06/16 to alter controller outputs and force motors to start or stop.
If you see an unexpected 06/16, or a slave that is normally read-only suddenly writing, that is a classic anomaly. For a quick lookup of every code and exception response, use the Modbus function code reference(https://antpact.com/modbus/modbus-fc/).
Three pitfalls to avoid
Pitfall 1: trusting application logs over the wire. Once the HMI is hijacked, the pressures and valve states it shows are fake. The one thing an attacker cannot edit afterward is the network itself—a gateway suddenly opening 14 sessions, a controller receiving a write sequence that should never come from that host. Those are your real-time signals.
Pitfall 2: miscounting the address offset. Register numbers like 40001 or 30001 are not the same as the protocol offset; one digit off and the whole frame reads backward. Align the number with the offset using the Modbus address converter(https://antpact.com/modbus/modbus-address/) before interpreting the parse.
Pitfall 3: ignoring checksum consistency. RTU uses CRC16, ASCII uses LRC; TCP drops the CRC but keeps the fixed 6-byte MBAP. A broken structure means a truncated or spliced frame. For RTU/ASCII checks, use the CRC16 calculator(https://antpact.com/modbus/modbus-crc/) and the Modbus ASCII parser(https://antpact.com/modbus/modbus-ascii/).
Make frame reading a routine
You cannot read every byte by hand against an autonomous AI, but you can turn parsing into a habit: periodically capture a slice of live traffic, run it through the parser, watch the function-code distribution, and flag "read-only device starts writing" or "unknown IP opens a write transaction" as must-check items. Everything parses locally in your browser—no frame data leaves your machine—which fits right into production troubleshooting and audits.
For more industrial-protocol tools, visit the AntPact Modbus toolkit(https://antpact.com/modbus/): TCP/RTU/ASCII parsing, function codes, address conversion and CRC, all in one place, processed locally with nothing uploaded.