Skip to content
RCE Write-up Advanced

SATisfying our way into remote code execution in the OPC UA industrial stack

Two vulnerabilities in the Unified Automation OPC UA C++ SDK: an out-of-bounds read in string conversion leaks heap memory, and an integer overflow in argument replacement leads to a heap overflow. An authenticated high-privilege attacker could chain these to achieve remote code execution on the demo server.

JFrogSecurity Follow

Published on jfrog.com

The JFrog Security team recently competed in the Pwn2Own Miami 2022 hacking competition which focuses on Industrial Control Systems (ICS) security. One of our research targets for the competition was the Unified Automation C++-based OPC UA Server SDK.

JFrog Security Research Team (@JFrogSecurity), on jfrog.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely two separate coding errors: a loop that skips bytes without checking for the string terminator, and an integer overflow in a size calculation for a buffer.

Impact

An authenticated high-privilege attacker could achieve remote code execution, though the exploit's success rate was low and required multiple attempts.

What the attacker needed

High-privilege authentication; ability to write to a string node; ability to upload PubSub configuration

The fix

The vulnerabilities were fixed in version 1.7.7 of the SDK.

How it was found

  1. Authenticate to the OPC UA server with high privileges.
  2. Write a specially crafted string to a node to trigger the out-of-bounds read.
  3. Read the node to leak heap memory and bypass ASLR.
  4. Upload a PubSub configuration with crafted field names to trigger the heap overflow.
  5. Overwrite a function pointer in a heap object to redirect execution to a ROP chain.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

OPC UA is a protocol used in industrial systems to read and write data values called nodes. A string conversion function reads past the end of a string and returns extra memory to the client, leaking information. A separate function that fills in placeholders in a format string miscalculates a buffer size, allowing an attacker to write beyond the buffer and potentially run their own code.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by JFrogSecurity

View all

3 more disclosed reports, best first.

More from Unified Automation

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.