Skip to content
RCE Advisory Intermediate CVE-2021-21867

CODESYS Development System ObjectManager.plugin ObjectStream.ProfileByteArray Unsafe Deserialization vulnerability

The CODESYS Development System deserialises untrusted data from the 'Profile' field of an imported XML project file using BinaryFormatter, which is unsafe. An attacker can craft a malicious project file that, when imported, executes arbitrary commands on the victim's machine.

Patrick DeSantis Follow

Originally disclosed on Cisco Talos

High 8.8 View original

An unsafe deserialization vulnerability exists in the ObjectManager.plugin ObjectStream.ProfileByteArray functionality of CODESYS GmbH CODESYS Development System 3.5.16 and 3.5.17. A specially crafted file can lead to arbitrary command execution.

Patrick DeSantis, on Cisco Talos

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 report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The application uses BinaryFormatter.Deserialize on untrusted input from the 'Profile' field of an imported XML project file, which allows arbitrary object deserialisation and code execution.

Impact

An attacker could execute arbitrary commands on the victim's machine with the privileges of the user running CODESYS, but the victim must import a malicious project file.

What the attacker needed

Victim imports a malicious project file

How it was found

  1. Generate a malicious payload using ysoserial.net with BinaryFormatter and TypeConfuseDelegate.
  2. Insert the payload into the 'Profile' array field of a project file.
  3. Import the project file into CODESYS Development System.
  4. The payload executes the specified command (e.g., notepad.exe).

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 report has not been written yet. The Original tab links to the source.

When a program loads data from a file, it sometimes converts that data back into objects in memory. If the program does this without checking the data, an attacker can include a special object that runs commands when loaded. Here, importing a project file with a malicious 'Profile' field causes the program to run the attacker's command.

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 Patrick DeSantis

View all

35 more disclosed reports, best first.

More from Cisco Talos

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.