This week's scan review surfaced new Modbus devices answering on the public internet. Modbus and related ICS protocols are actively probed on the open internet, with 29,957 addresses scanned on honeypots in 31 days [1]. Most Modbus implementations have no login, so any device answering on the public network is an exposure [1]. Automated sweeps still find fresh Modbus responders, so detection and response must be automated too. Manual review of scan output fails when the scanner returns new hits every week.
Why this Modbus recon matters
This week's sweep found devices answering Modbus requests. Honeypot data shows actors read Modbus device IDs and status lists, though write attempts are rare [1]. That read-only pattern still reveals device identity and operating state to unauthenticated observers. National authorities are scrutinizing energy and industrial facilities with internet access [2]. Academic analysis of publicly accessible OT confirms that these systems were designed for closed networks, not for internet exposure [3]. Each new Modbus responder found in a scan expands the fingerprintable attack surface for plant operations. An attacker who knows the device ID and status list can plan targeted interaction without triggering write-based alerts. Open protocol access plus absent authentication means a single scan result exposes an entire control loop to the internet.

Automate detection with n8n and Semgrep
Build a detection loop that treats each new Modbus hit as a signal. Use n8n to pull scan results, enrich them with asset context, and post alerts to a team chat or ticket system. OTDraw can map where those devices sit on the network. A typical n8n workflow polls the scan output with an HTTP request node, compares new addresses against a known-device list in a function node, and creates a ticket for any unknown responder. The workflow can query a CMDB to check if the address falls inside a scheduled maintenance window. Unknown addresses get an OT exposure tag and a ticket assigned to the plant security lead. Add an error-handling node so the workflow retries on transient scan API failures. Set the n8n workflow to run on a fixed schedule matching the scan cadence. Semgrep scans infrastructure-as-code files for rules that expose port 502 or bind Modbus services to public interfaces. Write a Semgrep rule that flags any resource definition with a public ingress rule targeting Modbus ports. The same honeypot study recorded 29,957 probed addresses [1]. Extend the n8n flow to pull historical scan data for the same address if needed.
Code-level response with CodeQL and OWASP
Use CodeQL to query application code for unsafe serial communication wrappers or hardcoded unit identifiers. CodeQL traces data flow from network input to Modbus function calls and flags paths that lack authentication checks. Pair that with OWASP guidance on secure architecture for industrial systems. This is practical guidance. National authorities are reviewing OT systems with internet access [2]. CodeQL queries catch third-party libraries that open raw TCP sockets without authentication checks. Academic analysis notes that OT protocols often lack access control by design [3], so code-level controls must compensate for protocol weaknesses. A CodeQL query can look for Modbus write function calls in application code and require a review comment before merge. OWASP guidance recommends treating unauthenticated protocol exposure as a design flaw, which matches what the scans show. Developers add a CodeQL query to the CI pipeline so any new Modbus integration fails the build unless it includes authentication middleware. Security teams run the same query against existing repositories to find legacy Modbus integrations that predate current hardening standards. CodeQL also detects hardcoded Modbus unit identifiers in source code, which helps asset owners map code to physical devices.

Closing actions tied to this event
Export this week's Modbus findings from your scan pipeline and cross-check each address against your asset inventory. Add a Semgrep rule that flags any new infrastructure-as-code change exposing Modbus on a public interface. Configure an n8n workflow to open a ticket whenever a previously unseen Modbus responder appears in scan output. Confirm exposed devices have write functions disabled and only read-only device ID queries are permitted. Schedule a review of all OT devices near data centers. Add a Modbus query to your weekly scan review cadence so new responders do not go unnoticed. Review CodeQL results for any application that talks to the exposed Modbus devices. Update your runbook to include Modbus port closure as a standard remediation step. Assign ownership of each exposed Modbus address to a specific operations team before the next scan cycle. Block inbound access to Modbus ports at the network edge for any address not on an approved remote-management list. Move exposed Modbus devices behind a jump host or gateway so they are not reachable directly from the internet. Document response time for each Modbus ticket to measure whether the n8n workflow meets your service-level target.