CVE-2021-21863

7.8 HIGH

📋 TL;DR

This CVE describes an unsafe deserialization vulnerability in CODESYS Development System's Profile.FromFile() function. Attackers can craft malicious files to trigger arbitrary command execution on affected systems. Users of CODESYS Development System versions 3.5.16 and 3.5.17 are vulnerable.

💻 Affected Systems

Products:
  • CODESYS GmbH CODESYS Development System
Versions: 3.5.16 and 3.5.17
Operating Systems: Windows, Linux
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability exists in the ComponentModel Profile.FromFile() functionality when processing specially crafted files.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full system compromise with attacker gaining complete control over the CODESYS Development System host, potentially leading to lateral movement within industrial networks.

🟠

Likely Case

Remote code execution on the engineering workstation running CODESYS, allowing attackers to steal intellectual property, modify PLC programs, or disrupt operations.

🟢

If Mitigated

Limited impact if proper network segmentation and file validation controls prevent malicious files from reaching vulnerable systems.

🌐 Internet-Facing: MEDIUM - While the vulnerability requires file interaction, internet-facing engineering workstations or file sharing services could be targeted.
🏢 Internal Only: HIGH - Industrial control systems often have engineering workstations with CODESYS installed that process project files from various sources.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires the attacker to provide a malicious file that gets processed by the vulnerable function. Social engineering or compromised file shares could facilitate this.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Version 3.5.18 or later

Vendor Advisory: https://customers.codesys.com/index.php?eID=dumpFile&t=f&f=16805&token=ee583c498941d9fda86490bca98ff21928eec08a&download=

Restart Required: Yes

Instructions:

1. Download CODESYS Development System version 3.5.18 or later from the CODESYS customer portal. 2. Install the update following vendor instructions. 3. Restart the system to ensure all components are updated.

🔧 Temporary Workarounds

Restrict file processing

all

Implement strict controls on which files can be processed by CODESYS Development System, limiting to trusted sources only.

Network segmentation

all

Isolate engineering workstations running CODESYS from general network traffic and internet access.

🧯 If You Can't Patch

  • Implement application whitelisting to prevent execution of unauthorized processes from CODESYS
  • Deploy file integrity monitoring on CODESYS project directories and alert on unexpected file modifications

🔍 How to Verify

Check if Vulnerable:

Check CODESYS Development System version in Help > About. If version is 3.5.16 or 3.5.17, the system is vulnerable.

Check Version:

On Windows: Check Help > About in CODESYS Development System GUI. On Linux: Check installation directory or package manager.

Verify Fix Applied:

After updating, verify version is 3.5.18 or later in Help > About menu.

📡 Detection & Monitoring

Log Indicators:

  • Unexpected process execution from CODESYS context
  • File access errors in CODESYS logs when loading profiles
  • Unusual network connections from CODESYS process

Network Indicators:

  • Outbound connections from engineering workstations to unexpected destinations
  • File transfers to/from CODESYS systems from untrusted sources

SIEM Query:

Process Creation where Parent Process contains 'CODESYS' AND (Command Line contains 'cmd' OR Command Line contains 'powershell' OR Command Line contains 'bash')

🔗 References

📤 Share & Export