Skip to content
RU

Port 502 — Modbus TCP

Key idea:

TCP/502 is the standard port for Modbus TCP, an industrial protocol for PLCs (Programmable Logic Controllers) and SCADA systems. No built-in auth or encryption — originally designed for isolated OT networks. Exposing 502 to the internet is catastrophic (Shodan lists 20k+ exposed Modbus devices). Fix: IP whitelist + VPN, or proxy through Modbus Secure (TCP/802).

Below: details, example, related, FAQ.

Check your host & ports →

Details

  • Protocol: Modbus/TCP (no RFC, de-facto standard from Schneider Electric 1999)
  • Function codes: 03 read holding, 06 write register, 16 write multiple
  • Security: no auth, no TLS (Modbus/TCP Security on port 802 adds it)
  • Shodan query: port:502 — publicly scanned
  • Detection: Nmap --script modbus-discover

Example

# Check if the port is open
$ nc -zv 192.168.1.10 502

# Nmap scan
$ nmap -p 502 --script modbus-discover 192.168.1.10

# Python pymodbus — read registers
from pymodbus.client import ModbusTcpClient
client = ModbusTcpClient('192.168.1.10', port=502)
resp = client.read_holding_registers(0, count=10)
print(resp.registers)

Related

Understanding Modbus TCP Security Risks

Modbus TCP operates over TCP port 502 and is widely utilized in industrial environments for communication between devices such as PLCs and SCADA systems. However, its design lacks inherent security features, making it vulnerable to various cyber threats. The absence of authentication and encryption allows malicious actors to easily intercept or manipulate data transmissions.

Exposing Modbus TCP to the internet can lead to catastrophic consequences, such as unauthorized access to critical infrastructure. For example, Shodan reveals over 20,000 Modbus devices publicly accessible online, highlighting the urgency for organizations to take measures to secure their networks.

To mitigate these risks, organizations should consider implementing the following security practices:

  • IP Whitelisting: Restrict access to Modbus devices by allowing only specific IP addresses to communicate with them.
  • Virtual Private Networks (VPNs): Use VPNs to create secure tunnels for Modbus traffic, ensuring that data is encrypted during transmission.
  • Modbus Secure: Transition to Modbus Secure (TCP/802), which incorporates encryption and authentication, thus enhancing the security of the communication protocol.

By understanding the security risks associated with Modbus TCP and taking proactive measures, organizations can better protect their industrial systems from potential cyber threats.

Practical Configuration for Securing Modbus TCP

Securing Modbus TCP communications is critical for safeguarding industrial systems. Below are practical configuration examples that can help secure your Modbus devices.

1. IP Whitelisting Example:

In a typical firewall configuration, you can allow only specific IP addresses to access your Modbus TCP devices. For instance, if your Modbus device has an IP address of 192.168.1.100 and you want to allow access only from 192.168.1.50, you can use the following rules:

iptables -A INPUT -p tcp --dport 502 -s 192.168.1.50 -j ACCEPT
iptables -A INPUT -p tcp --dport 502 -j DROP

2. Setting Up a VPN:

To ensure secure access to Modbus devices, set up a VPN server. For example, using OpenVPN, you can configure it as follows:

openvpn --config server.conf

In the server.conf, specify the subnet that will be used for the VPN clients.

3. Transitioning to Modbus Secure:

If you are moving to Modbus Secure, you will need to implement a Modbus Secure gateway. This typically involves updating your device configurations to point to the gateway:

modbus_client --host  --port 802 --secure

By applying these configurations, you can significantly enhance the security of your Modbus TCP communications and protect your industrial systems from unauthorized access.

Common Questions About Modbus TCP on Port 502

As organizations increasingly rely on Modbus TCP for industrial automation, several common questions arise regarding its usage, security, and best practices. This section addresses some of these frequently asked questions.

1. What is Modbus TCP?

Modbus TCP is a communication protocol used for transmitting data over TCP/IP networks. It is widely used in industrial automation for communication between devices like PLCs and SCADA systems.

2. Why is port 502 significant?

Port 502 is the default port used by Modbus TCP. It is essential for establishing communication between Modbus devices and clients, making it a critical component of industrial networks.

3. What are the security implications of using Modbus TCP?

Modbus TCP lacks built-in security features such as encryption and authentication, making it vulnerable to attacks if exposed to the internet. This can lead to unauthorized access and manipulation of industrial processes.

4. How can I secure my Modbus TCP communications?

To secure Modbus TCP communications, you can implement IP whitelisting, use VPNs, and consider transitioning to Modbus Secure, which includes encryption and authentication features.

5. Are there any tools to monitor Modbus traffic?

Yes, various tools can monitor Modbus traffic, such as Wireshark and Modbus-specific monitoring tools. These can help detect anomalies and unauthorized access attempts in real-time.

By addressing these common questions, organizations can better understand Modbus TCP and implement effective strategies to secure their industrial communications.

ICMP PingHost availability and latency
Port ScannerOpen TCP port detection
LatencyResponse time in milliseconds
Packet LossPercentage of dropped packets

Why teams trust us

ICMP+TCP
check protocols
14
key ports scanned
2,014
checks in 30 days
3
regions

How it works

1

Enter IP or domain

2

ICMP packets sent

3

Latency & packet loss shown

How Do Ping and Port Scanning Work?

Ping sends ICMP packets to a host and measures response time. Port scanning checks which TCP ports are open and accepting connections — helping diagnose serviceavailability issues.

Configurable Ping

Choose packet count (3, 4, 6, 10). Stats: min/avg/max latency and packet loss.

Common Port Scanner

Check 14 key ports: HTTP, HTTPS, SSH, FTP, SMTP, MySQL, PostgreSQL, and more.

Cloud-Based Check

Testing from our server — see site availability from outside, not just your local network.

Uptime Monitoring

Need constant monitoring? Create a monitor — checks every minute with notifications.

Who uses this

DevOps

availability diagnosis

Network engineers

TCP port scanning

Developers

connection debugging

SRE

basic health check

Common Mistakes

ICMP blocked = server is downMany servers block ICMP. Ping fails but site works — check ports instead.
High ping = server problemLatency depends on geography. 150ms between continents is normal, not an error.
Closed ports — cause for alarmClosed ports of unused services are good. Unnecessary open ports are a risk.
One check = sufficientNetworks are unstable. A single timeout ≠ a problem. Check multiple times or set up monitoring.

Best Practices

Combine ping and port checksPing shows host availability, ports show specific service availability. Use both.
Check from different locationsThe problem may be local. A cloud test shows the real picture.
Close unused portsEvery open port is a potential attack vector. Keep only necessary ports open.
Set up monitoringManual checks do not scale. Set up automated monitoring with notifications.

Get more with a free account

Ping check history, host availability monitoring and downtime alerts.

Sign up free

Learn more

Frequently Asked Questions

Why care?

If you run industrial automation (factory, energy, water) this is a key ICS port. A leak has physical consequences (stopping a pipeline).

Safe to expose to the internet?

Never in plain-text. Either VPN or Modbus Secure (802) with TLS.

Alternative?

OPC UA (4840) — modern, secure, structured data. New projects pick it.

Try the live tool that powered this guide

Free plan — 10 monitors, checks every 5 min, no card required. Upgrade for 1-minute interval and multi-region monitoring.