CVE-2021-21865

7.8 HIGH

📋 TL;DR

This CVE-2021-21865 is an unsafe deserialization vulnerability in CODESYS Development System that allows arbitrary command execution when processing malicious files. Attackers can exploit this by providing specially crafted files to the PackageManagement.plugin ExtensionMethods.Clone() functionality. This affects users of CODESYS Development System 3.5.16 who process untrusted files.

💻 Affected Systems

Products:
  • CODESYS GmbH CODESYS Development System
Versions: 3.5.16
Operating Systems: Windows, Linux
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability exists in the PackageManagement.plugin ExtensionMethods.Clone() functionality when processing files.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise with remote code execution leading to data theft, system destruction, or lateral movement within the network.

🟠

Likely Case

Local privilege escalation or arbitrary code execution within the context of the CODESYS application, potentially leading to industrial control system compromise.

🟢

If Mitigated

Limited impact if proper file validation and sandboxing are implemented, restricting the attacker to the application's permissions.

🌐 Internet-Facing: MEDIUM
🏢 Internal Only: HIGH

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires the attacker to provide a malicious file to the vulnerable functionality. Public technical details exist in the Talos Intelligence report.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 3.5.17.0 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.17.0 or later from the official CODESYS website. 2. Install the update following vendor instructions. 3. Restart the system to ensure all components are updated.

🔧 Temporary Workarounds

Restrict File Processing

all

Limit the types of files that can be processed by the CODESYS Development System to only trusted sources.

Application Whitelisting

all

Implement application whitelisting to prevent execution of unauthorized binaries that might be dropped via exploitation.

🧯 If You Can't Patch

  • Implement network segmentation to isolate CODESYS systems from critical infrastructure.
  • Deploy endpoint detection and response (EDR) solutions to monitor for suspicious process creation and file activity.

🔍 How to Verify

Check if Vulnerable:

Check the CODESYS Development System version. If it is 3.5.16, the system is vulnerable.

Check Version:

Check the version in the CODESYS Development System application interface or consult system documentation.

Verify Fix Applied:

Verify that the CODESYS Development System version is 3.5.17.0 or later.

📡 Detection & Monitoring

Log Indicators:

  • Unusual process creation from CODESYS processes
  • Errors or exceptions related to PackageManagement.plugin or deserialization

Network Indicators:

  • Unexpected outbound connections from CODESYS systems

SIEM Query:

Process creation where parent process contains 'CODESYS' and child process is suspicious (e.g., cmd.exe, powershell.exe, wmic.exe)

🔗 References

📤 Share & Export