Skip to content
RCE Advisory Intermediate CVE-2021-21864

CODESYS Development System ComponentModel ComponentManager.StartupCultureSettings Unsafe Deserialization vulnerability

The CODESYS Development System reads a file named APStartupCulture from user or program data directories and deserialises it with BinaryFormatter, which is unsafe for untrusted data. An attacker who can place a malicious file there could achieve arbitrary command execution when the application starts.

Patrick DeSantis Follow

Originally disclosed on Cisco Talos

High 7.8 View original

An unsafe deserialization vulnerability exists in the ComponentModel ComponentManager.StartupCultureSettings 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 a file from a user-writable location without validating its contents, which is inherently unsafe for untrusted input.

Impact

An attacker could execute arbitrary commands with the privileges of the user running CODESYS, but only if they can place a file in the specified directories.

What the attacker needed

Write access to C:\ProgramData\ or user AppData; no APStartupCulture.xml present; victim starts CODESYS

How it was found

  1. Place a file named APStartupCulture (without an extension) in C:\ProgramData\ or C:\Users<user>\AppData\Roaming\.
  2. Ensure no APStartupCulture.xml file exists in the user's AppData\Roaming folder.
  3. Start the CODESYS Development System application.
  4. The application reads the file and passes it to BinaryFormatter.Deserialize, triggering the vulnerability.

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.

Deserialisation is when a program turns stored data back into objects. If the data comes from an untrusted source, an attacker can craft it so that the program runs their code instead of just reading data. Here, a file in a predictable location is loaded without any safety check, so anyone who can write that file can run commands on the machine.

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.