OPC UA - PORT 4840

Basic info

  • A machine-to-machine communication protocol for industrial control systems (ICS).

  • Standard port: 4840/TCP.

  • Used in:

    • Manufacturing lines

    • Power & energy networks

    • Oil & gas

    • Water plants

  • Provides structured data exchange between PLCs, sensors, and control software.

For attackers, this is gold: a single OPC UA server can expose device data, configurations, and control endpoints.


Enumeration

Nmap Scan

Output:

Banner Grab & Enumeration

Use the opcua-info NSE script:

This extracts:

  • Server application name

  • Security policies supported (None, Basic256, etc.)

  • Endpoints & available services

To reveal security issues in OPC UA servers, scan it with OpalOPCarrow-up-right.

Shodan / Censys

Search for:


Exploitation

Once you find an OPC UA server, you have multiple attack routes:

1. No Authentication (Anonymous Login)

Many deployments allow anonymous access. Use the Python opcua client:

2. Information Disclosure

OPC UA servers expose tags, variables, and node data. This can reveal:

  • Factory layout

  • Device models & firmware versions

  • Process values (temperatures, flow rates, etc.)

Example Python snippet:

3. Vulnerabilities (CVE-2018-4840 & more)

Poor implementations of OPC UA are vulnerable to buffer overflows and denial of service.

Metasploit has a module:

This can crash or prove exploitability in vulnerable stacks. With ROP chains, it becomes RCE.


Automated Tools

Claroty’s OPC UA Exploit Framework is a research toolkit for fuzzing, testing, and exploiting OPC UA servers/clients. It was the backbone of Team82’s discovery of dozens of OPC UA vulnerabilities.

Installation & How to guide

⚠️ Make sure you’re running Python 3.8+ and have pip installed.

The framework has four modules:

  • sanity β†’ Simple probes

  • attacks β†’ Exploit payloads

  • corpus β†’ Saved fuzz cases

  • server β†’ Fake OPC UA server for testing

1. Run a Sanity Test (check target is alive)

This checks if the OPC UA service is responding.

2. Enumerate Nodes

Useful for info-gathering on exposed objects.

3. Launch an Attack

Example: Remote Stack Overflow (DoS)

If the server crashes β†’ it’s vulnerable.

4. Reuse Payloads (Corpus)

This lets you replay fuzzing payloads that previously triggered bugs.

5. Use the Built-in Test Server

circle-check

Last updated