Is port 4840 (OPC UA) exposed to the internet?
AdminKit's short answer: if port 4840 on your public IP accepts a connection, an OPC UA server may describe its endpoints to anyone online, and can accept sessions from strangers if it still allows security mode None with anonymous users. OPC UA belongs behind a VPN or DMZ. This guide shows how to test it and close it.
By AdminKit team, Netbase JSC · Updated
Key takeaways
- Port 4840 is the registered port for OPC UA’s binary TCP transport, used by PLCs, SCADA and HMI servers, edge gateways and historians.
- OPC UA has real security features: signed or signed-and-encrypted channels, certificates, and user tokens. A server can still be configured to offer security mode None and anonymous users.
- Every OPC UA server has a discovery endpoint that answers without message security and describes how to connect, which tells a stranger what the server accepts.
- AdminKit’s port check does not test 4840. Test it by hand from outside, then move the server behind a VPN or into a DMZ.
What is listening on port 4840?
OPC UA, the OPC Unified Architecture, is the data exchange standard the OPC Foundation maintains for industrial equipment and software, published as the IEC 62541 series. It connects field devices and controllers to SCADA, MES and cloud systems through a self-describing information model, and it is part of the same machine protocols family as Modbus, BACnet and DNP3. Our glossary entry on OPC UA gives the one-page background.
The binary transport is called OPC UA TCP. The specification’s section on OPC UA TCP says a socket is the transport connection and that endpoint URLs for it use the opc.tcp scheme. The IANA registry lists opcua-tcp on port 4840. A server can be configured to listen on another port, so 4840 is the default to test first, not the only one. These are the kinds of systems that answer on it:
| System | Typical role | Why it matters if reachable from outside |
|---|---|---|
| PLC or controller with an embedded OPC UA server | Publishes process values and may accept writes and method calls | Gives direct access to the controller’s data model |
| SCADA or HMI server | Exposes tags from many devices to other software | One address can expose a whole line or site |
| Edge gateway or aggregating server | Translates Modbus, EtherNet/IP or other protocols into OPC UA | Puts older devices behind a single, reachable endpoint |
| Historian or MES connector | Reads production data for reporting | Often runs on ordinary servers with ordinary patch lag |
| Local Discovery Server | Lists the OPC UA servers on a host | Tells a stranger which other servers exist there |
What do the security modes None, Sign and SignAndEncrypt mean?
An OPC UA client and server first set up a secure channel, and the security mode decides how much protection that channel gets. The Security Mode settings section of the OPC UA security model names three modes and states that the None profile shall be disabled by default. It also says that the choice between Sign and SignAndEncrypt depends on the site’s security management system, and that Sign is sufficient where data confidentiality is not required.
| Security mode | What the channel gets | What it means on an exposed port |
|---|---|---|
| None | No signing and no encryption | Messages can be read and altered in transit, and no application certificate identifies the client |
| Sign | Messages are signed, so changes are detected | Traffic is readable but tampering is detected; the client presents an application certificate the server checks against its trust list |
| SignAndEncrypt | Messages are signed and encrypted | Both integrity and confidentiality, with the same certificate check |
The default in the specification is good, but a default is not a deployment. A server that was given a None endpoint for commissioning, or for an older client, keeps offering it until someone removes it. GetEndpoints lists every endpoint a server offers and the client picks one, so when None sits next to the secured modes, the weakest offer is the one that counts.
Why does an anonymous user token matter?
The secure channel identifies applications. Users are identified separately, when the client activates a session with a user identity token. The UserTokenPolicy definition describes the token types a server can accept and says that a token type of ANONYMOUS indicates the server does not require any user identification; in that case the client’s application instance certificate is used as the user identification. The other types are a username and password, an X.509 certificate, or a token issued by an authorization service.
Put the two settings together and the risk is easy to read. An endpoint that offers security mode None has no application certificate on the channel, and an anonymous token adds no user identity, so a session on that endpoint carries nothing that says who opened it. What the session can then do depends on the server’s own access rules: some servers only allow reading, others let any session write values or call methods. Either way, it is a decision the server makes without knowing who is asking.
What does the discovery endpoint reveal?
Every OPC UA server has a discovery endpoint so clients can learn how to connect. The Discovery Service Set overview requires that every server have a discovery endpoint clients can reach without a session, and that discovery endpoints not require message security. The GetEndpoints service returns each endpoint’s server certificate, security mode, security policy and supported user token types, which is exactly the list a client needs, and exactly the list an outsider would want.
The security model names this risk. Its description of server profiling is an attacker deducing the identity, type, software version or vendor of a server from its responses, in order to apply knowledge about that product’s vulnerabilities. OPC UA limits what a server tells clients it has not identified, but the endpoint list is still answered. The same overview also says servers shall let administrators disable the discovery endpoint, with clients then relying on endpoint details configured by hand.
How does an OPC UA server end up reachable from the internet?
Rarely on purpose. These are the usual paths:
- A cloud or MES connection set up inbound. A port forward lets an outside service poll the plant’s OPC UA server, and the same forward works for anyone else.
- A vendor support path. A machine builder asks for remote access to a controller for commissioning or warranty work, and the forward stays after the job.
- An edge gateway on a public address. A gateway that bridges plant protocols into OPC UA sits on a cellular or DSL line with a public IP and no access list.
- A flat network. The plant network shares a firewall policy with the office, and a broad rule written for another purpose also allows 4840.
How do you read AdminKit’s port check for port 4840?
AdminKit’s open ports check tests the public IP you are browsing from, using TCP connections to a fixed list: 23, 554, 1883, 8883, 502, 7547, 80, 443 and 8080. It also lists BACnet/IP (47808) and CoAP (5683) as not scanned, because they run over UDP. Port 4840 is not on that list, so the check says nothing about OPC UA either way. Confirm the address you are testing first with what is my IP.
Read a port check result from a site that runs OPC UA like this:
| What the result shows | What it tells you about OPC UA |
|---|---|
| “0/9 TCP port(s) open” with an OK status | Only the nine listed TCP ports were tested. Port 4840 may still be reachable |
| 502 (Modbus/TCP) open | A Modbus device on the same site answers from outside. Some gateways bridge Modbus into OPC UA, so test 4840 as well |
| 80, 443 or 8080 open | A device, gateway or router web interface is exposed. Close it, and test 4840 too |
If Modbus devices sit on the same network, AdminKit’s Modbus exposure check checks whether the public IP you are connecting from has a Modbus/TCP industrial device reachable from the internet on port 502 by default. It speaks Modbus, not OPC UA, so it is not an OPC UA test; is Modbus TCP (port 502) exposed covers that side.
How do you confirm port 4840 from outside?
Use a machine outside the site’s network, such as a laptop on a mobile hotspot, and test only your own public address. A TCP connection test is enough to show the exposure, and it sends no OPC UA at all (a documentation address is shown):
nc -vz -w 3 203.0.113.40 4840
A “succeeded” or “open” reply means something accepted a TCP connection on 4840 from the internet. A refusal or a timeout means the port is closed or filtered on that path. If your servers are configured on other ports, test those too; the endpoint URLs in your client configuration list them.
If you want to see what the server tells a stranger, point an OPC UA client your team already uses at your own endpoint from the same outside machine and look at the endpoint list before logging in. If it shows security mode None or an anonymous token policy, that is the configuration to change. Do not browse, write or call methods on production equipment as a test; a reachability check and the endpoint list are enough to justify the fix.
How do you find the listener inside the network?
An outside test shows that something answers; it doesn’t say which system. Work from the edge inward:
- On the site router or firewall, list inbound rules and port forwards for TCP 4840. Note the internal address each one points to, and who asked for it.
- On that address, find what is bound to the port. On a Linux gateway or server:
$ ss -tlnp | grep 4840
LISTEN 0 128 0.0.0.0:4840 0.0.0.0:* users:(("opcua-gw",pid=812,fd=9))
The output above is illustrative; the process name will be whatever your server software is called. On a Windows host, Get-NetTCPConnection -LocalPort 4840 in PowerShell shows the listening process ID.
- If the address is a PLC or panel, look it up in the asset list and ask the engineer or machine builder responsible why it has a public path.
How do you fix an exposed port 4840?
Take the server off the internet first, then tighten what remains:
- Remove the port forward or public address for 4840 and any other OPC UA port. Re-run the outside test and keep the dated result.
- Put OPC UA behind a VPN or in a DMZ. NIST SP 800-82 recommends layered network segmentation, a DMZ between corporate and OT networks, multi-factor authentication for remote access to OT systems, and disabling unused ports and services.
- Disable security mode None and anonymous access on every endpoint that does not need them, and require Sign or SignAndEncrypt with trusted certificates and real user tokens.
- Disable the discovery endpoint or stop registering where clients can be configured by hand, and keep the server’s trust list short.
- Consider reverse connect where the server must talk to an outside client. The reverse connect section of the security model describes the server opening the connection to the client, which needs no inbound port on the plant side; the client must then validate that the connection comes from the right server.
- Keep the stack patched. The OPC Foundation publishes security advisories for vulnerabilities reported to it, and notes that many OPC products are built on SDKs that must be updated first; ask your vendors how they track the SDK inside their products.
Security settings matter in practice, not only on paper. Germany’s federal security agency BSI summarises its OPC UA security analysis (in German) as finding no systematic security flaws in the specification, while a vulnerability was found in the reference implementation that could be exploited when security functions were switched off. The specification’s own section on OPC UA and site security says the same thing from the other side: a site’s requirements, not the specification, decide how OPC UA is deployed, inside a defense-in-depth design where no single layer protects against all attacks.
Factories often run EtherNet/IP controllers next to OPC UA servers; see is port 44818 (EtherNet/IP) exposed for that port. If engineers and vendors need remote access to plant systems without an inbound port, OT Remote Access is a Netbase custom engagement that gives outbound-only, recorded sessions; see factories and facilities for the related checks and services.
Which networks may you test?
Every check this page links to is for assets you own or are explicitly authorized to test. Never scan, probe, or attempt to connect to a network or device 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
What is port 4840 used for?
Port 4840 is the port IANA registers as opcua-tcp for the OPC UA Connection Protocol, the binary TCP transport that OPC UA clients reach with opc.tcp URLs. PLCs, SCADA and HMI servers, edge gateways and historians use it to exchange data. A server can be configured to listen on another port, so 4840 is a default rather than a rule.
Does OPC UA have security built in?
Yes. The OPC UA security model defines three security modes, None, Sign and SignAndEncrypt, and user tokens for usernames, X.509 certificates and issued tokens. The specification says the None profile shall be disabled by default, but a deployed server can still be configured to offer it, and to accept anonymous users, so the protection depends on configuration.
What does an anonymous user token mean on an OPC UA server?
The UserTokenPolicy definition says a token type of ANONYMOUS indicates the server does not require any user identification, and that the client's application instance certificate is then used as the user identification. On an endpoint that also uses security mode None, no certificate secures the channel, so nothing identifies the caller.
Does AdminKit's port check test port 4840?
No. The port check tests a fixed list of nine TCP ports (23, 554, 1883, 8883, 502, 7547, 80, 443, 8080) on the public IP you connect from, and lists two UDP ports as not scanned. Port 4840 is not on that list, so a clean result says nothing about OPC UA. Test 4840 manually from outside your network.
Is turning on SignAndEncrypt enough to expose OPC UA safely?
No. Message security protects the channel, but the discovery endpoint still answers without it, and the server's software remains reachable by anyone. The OPC UA security model itself places its features inside a site's wider defense-in-depth programme, and NIST SP 800-82 recommends segmentation and a DMZ, so keep 4840 off the internet as well.
Sources
- OPC Foundation — OPC Unified Architecture
- OPC 10000-2 (v1.05) — 4.8 Security Mode settings
- OPC 10000-2 (v1.05) — 4.4 OPC UA relationship to site security
- OPC 10000-2 (v1.05) — 4.3.8 Server profiling
- OPC 10000-2 (v1.05) — 6.14 Reverse Connect
- OPC 10000-4 (v1.05) — 5.5.1 Discovery Service Set overview
- OPC 10000-4 (v1.05) — 7.41 UserTokenPolicy
- OPC 10000-6 (v1.05) — 7.2 OPC UA TCP
- OPC Foundation — Security advisories (security bulletins)
- BSI — Sicherheitsanalyse OPC UA (security analysis of OPC UA)
- NIST SP 800-82 Rev. 3 — Guide to Operational Technology (OT) Security
- IANA — Service Name and Transport Protocol Port Number Registry
Want AdminKit to watch this for you?
Free checks tell you the state today. Protective DNS and monitoring tell you when it changes.
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.