Skip to content
AdminKit

Modbus TCP (port 502) remediation: a full OT network playbook

Blocking inbound access to port 502 stops the most urgent exposure, but a Modbus TCP deployment that still sits on a flat network, with no monitoring and no plan for legitimate remote maintenance, remains one misconfigured firewall rule away from being reachable again — AdminKit's Modbus check and this playbook cover the network-architecture work that makes the fix durable.

By AdminKit team, Netbase JSC · Updated

Key takeaways

  • Modbus TCP can’t authenticate a request, so the network around the device has to decide who may talk to it.
  • Close the internet path first, then record why it existed, so the underlying need gets a safer answer instead of a reopened port forward.
  • Segment OT from IT, allow only named hosts to reach port 502, and route remote access through something that authenticates first.
  • Monitor Modbus traffic for writes and new sources, and re-verify on a schedule; firewall rules drift.

Why is blocking the port only step one?

Modbus TCP was adapted directly from a serial protocol designed in 1979 for isolated factory networks, and it kept the same unauthenticated request-response format when it moved to IP. Nothing in the protocol itself distinguishes a trusted request from an untrusted one — that responsibility sits entirely with whatever network the device lives on. NIST SP 800-82, the federal government’s guide to operational technology security, frames this explicitly as a defense-in-depth problem: because protocols like Modbus can’t authenticate requests themselves, the surrounding network architecture has to do that job instead, through segmentation, monitoring, and controlled access paths rather than any single fix.

Step 1: What is exposed today, and why?

Before changing anything, establish your actual starting point. AdminKit’s Modbus exposure check tests whether a Modbus TCP endpoint on your own public IP or a verified asset accepts a connection from outside your network and answers an unauthenticated identity request — the specific, practical signal that matters more than just “is port 502 open.” Port check adds a broader picture of what else is reachable on the same connection, including whether port 502 itself is open.

Record what you find per site, because every later step depends on knowing why each path exists. A simple register is enough; the rows below are example entries:

DeviceAddress and portReachable fromWhy the path existsOwnerDecision
Pump PLC10.30.0.21:502Internet (port forward)Vendor remote monitoring, 2023Maintenance leadRemove forward; vendor via jump host
Energy meter gateway10.30.0.40:502Office LANBilling spreadsheet polls itFinanceAllow historian only
HMI10.30.0.10:502OT segment onlyOperator screensOperationsKeep

Step 2: How do you remove the direct internet path?

If port 502 is reachable from the public internet, remove the firewall rule or port forward causing it immediately — this is the single highest-leverage action and should happen before any of the architectural work below, not after. Document why the rule existed (a vendor’s remote monitoring, a one-time commissioning task, a forgotten maintenance window) so the next step addresses the actual underlying need rather than leaving a gap that gets reopened the same way.

Step 3: How should the OT network be segmented?

CISA’s industrial control systems guidance and NIST SP 800-82 both describe network segmentation — often following a layered model like the Purdue Enterprise Reference Architecture — as the core structural defense for protocols that can’t authenticate themselves. In practice:

  • Put Modbus devices and their controllers on a dedicated network segment, separate from general office or guest traffic, with a firewall between the two that permits only the specific traffic needed.
  • Treat any “flat” network where OT and IT traffic share the same broadcast domain as a standing risk — a flat network means a request from a business-side system (or an attacker who’s compromised one) can reach a Modbus device directly with no segmentation to stop it, even without any internet exposure at all.
  • Map and document every legitimate path into the OT segment, including vendor remote-support connections, so segmentation decisions are based on a known list rather than discovered after the fact.

The layered model those documents describe groups systems by function, with traffic allowed only between neighbouring layers and through a DMZ between plant and enterprise. Simplified:

LayerTypical systemsWho should reach port 502 here
Enterprise (levels 4–5)Office PCs, ERP, emailNothing directly
OT DMZHistorian replica, jump host, patch serverOnly the jump host, during maintenance
Site operations (level 3)Historian, engineering workstationNamed hosts that poll or program devices
Supervisory control (level 2)HMI, SCADA serversHMI and SCADA servers
Basic control and process (levels 0–1)PLCs, RTUs, drives, sensorsThe Modbus devices themselves

At the firewall between segments, allow Modbus only from the specific hosts that need it and drop everything else. An nftables example, with example addresses — the historian at 10.20.0.15 may poll the OT device subnet, nothing else may:

table inet ot_filter {
  chain forward {
    type filter hook forward priority 0; policy drop;
    ct state established,related accept
    ip saddr 10.20.0.15 ip daddr 10.30.0.0/24 tcp dport 502 accept
  }
}

Step 4: What should replace ad hoc remote access?

Modbus TCP exposure very commonly traces back to a port forward set up for a specific, real need — vendor remote support, monitoring from a central office — that outlived the project it was built for. Rather than a direct port forward:

  • Route remote access through a VPN concentrator or jump host that authenticates the connection before it ever reaches the Modbus device, so the device itself is never the thing facing the internet.
  • Where an integration only needs to read data, consider a gateway or historian that polls the Modbus device locally and serves data out to remote consumers over an authenticated channel, rather than exposing the Modbus port itself to anything beyond that one gateway.
  • Review remote-access paths on a schedule, not just when something breaks — a path set up for a vendor’s one-time commissioning work is a common source of exposure that nobody remembers to remove.
Remote access optionAuthenticates before reaching the deviceWrite access possibleInbound port at the site
Direct port forward to 502NoYesYes, 502 open to the internet
VPN into the OT networkYesYes, for anyone on the VPNYes, the VPN endpoint
Jump host in the OT DMZYes, with its own loginYes, from the jump host onlyYes, the jump host or VPN in front of it
Read-only gateway or historianYes, on its own interfaceNo, if it only pollsDepends on how data is published
Outbound-only connectorYesLimited to agreed sessionsNo

The Modbus Organization also defines Modbus/TCP Security, a TLS-based variant that IANA registers as mbap-s on port 802. Where both devices and clients support it, it adds authentication to the protocol itself, but most installed equipment speaks plain Modbus TCP, so the network controls above remain the main defense.

Step 5: What should you monitor?

A firewall rule can be changed back, accidentally or otherwise. NIST SP 800-82 recommends monitoring OT network traffic for anomalous patterns — unexpected source addresses attempting Modbus connections, unusual volumes of write-function-code requests — as a detective control that catches a re-opened exposure or a compromised internal host even when the preventive controls (segmentation, access control) are working as designed.

The open-source network monitor Zeek includes a Modbus analyzer that writes one log line per request and response, with the transaction ID, unit identifier, function name and any exception, per its Modbus script documentation. Fed from a mirror port on the OT switch, it gives you entries like these (example data, fields trimmed):

ts          id.orig_h    id.resp_h    tid  unit  func                     pdu_type
1762761600  10.20.0.15   10.30.0.21   1    1     READ_HOLDING_REGISTERS   REQ
1762761612  10.10.4.88   10.30.0.21   7    1     WRITE_SINGLE_REGISTER    REQ

The second line is the kind worth an alert: a write from an office-side address that never appears in the register from step 1. Signals to watch:

  • Write function codes (5, 6, 15, 16) from any host that normally only reads.
  • Any Modbus traffic from a source address not on your list of known pollers.
  • Read Device Identification requests (function 43) arriving from many sources or in bursts, which suggests discovery scanning.
  • Modbus sessions outside agreed maintenance windows.

Step 6: How often should you re-verify?

Re-run port check after each change, and periodically afterward — a network change elsewhere, a new vendor connection, or a firmware update can reintroduce exposure without anyone touching the Modbus device’s own configuration. Re-run the Modbus exposure check as well for protocol-level confirmation on top of that. If you’re responsible for more than one site, see using port check to inventory IoT and OT device exposure for turning this repeated step into a running record across all of them.

Is this pattern unique to Modbus?

Other protocols built for isolated, trusted industrial or IoT networks — MQTT on sensor and building-automation networks, BACnet/IP in building controls, DNP3 on electric and water utility SCADA systems — share the same root cause: no authentication in the protocol itself, meaning the network around it has to carry that weight. See our guide on hardening a home or SMB MQTT broker if your environment runs both. OT and IT networks also turn out less isolated than assumed in practice: the 2017 NotPetya worm spread primarily over SMB file-sharing between Windows hosts, and the damage at affected shipping and logistics firms came from exactly that kind of office-to-industrial spillover.

OT Remote Access is a Netbase custom engagement that replaces exactly the kind of ad hoc port-forwarded access described in Step 4 with outbound-only connections from the site and recorded maintenance sessions limited to agreed windows. Talk to our team if you want it designed and run for your plant; otherwise, the steps above are the fix.

Defensive use only

Every check this guide links to is for equipment you own or are explicitly authorized to test. Never scan, probe, or attempt to connect to industrial equipment or a network you don’t control — AdminKit’s active checks only ever run against the IP making the request or an asset you’ve verified ownership of. See our Disclaimer and Acceptable Use Policy for the full terms.

This guide is general information, not a security audit of your specific network — see our disclaimer for what AdminKit's guidance does and does not commit to.

Frequently asked questions

I already blocked port 502 at the firewall. What else is there to do?

Blocking the port removes direct internet exposure, which is the single highest-priority step, but it doesn't address network segmentation, whether other internal systems can still reach the Modbus device, or how legitimate remote maintenance will happen going forward without just reopening the same hole later.

What does NIST actually recommend for protocols like Modbus that have no built-in authentication?

NIST SP 800-82, the federal guide to industrial control systems security, recommends defense-in-depth: network segmentation that isolates control-system traffic from business and internet-facing networks, monitoring for anomalous traffic, and strict control over any remote-access path, rather than relying on the protocol itself to provide security it was never designed to have.

What's the Purdue Model, and why does it matter here?

The Purdue Enterprise Reference Architecture is a widely used model for segmenting industrial networks into levels — from field devices and controllers up through supervisory systems to business IT — with controlled, monitored crossings between levels. A Modbus device ending up reachable from the internet usually means a path exists straight from a business or internet-facing level down to a field-device level, skipping the segmentation the model calls for.

Can I just add a username and password to my Modbus setup?

Not to the Modbus TCP protocol itself — it has no authentication field to add one to. The fix has to happen around the protocol: at the network layer (firewalls, segmentation, VPNs) or by placing an authenticating gateway in front of the device, not within Modbus TCP's own message format.

How do I check my current exposure before starting this playbook?

AdminKit's Modbus exposure check (/tools/modbus-check/) tests whether a Modbus TCP endpoint on your own public IP or a verified asset accepts a connection on port 502 and answers an unauthenticated identity request (never a coil or register read). Port check tells you whether port 502 and other device ports are reachable at all — run both first to confirm your starting state, and again after each remediation step.

Want AdminKit to watch this for you?

Free checks tell you the state today. Protective DNS and monitoring tell you when it changes.

Huy Nguyen (David), Founder and CEO of Netbase JSC

Talk to an expert

Huy Nguyen (David), Founder & CEO, Netbase JSC

Ask whether this fix applies to your setup, or get a second pair of eyes on your DNS and mail records.