CVE-2022-31802

9.8 CRITICAL

📋 TL;DR

CVE-2022-31802 is an authentication bypass vulnerability in CODESYS Gateway Server V2 where only a portion of the password is validated. Attackers can authenticate by providing a short password that matches the beginning of the actual password. This affects CODESYS Gateway Server V2 versions prior to V2.3.9.38.

💻 Affected Systems

Products:
  • CODESYS Gateway Server V2
Versions: All versions prior to V2.3.9.38
Operating Systems: Windows, Linux
Default Config Vulnerable: ⚠️ Yes
Notes: Affects all installations using password authentication. CODESYS Gateway Server V3 is not affected.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete compromise of industrial control systems, allowing attackers to modify PLC logic, disrupt operations, or cause physical damage.

🟠

Likely Case

Unauthorized access to industrial networks, data theft, manipulation of industrial processes, and lateral movement to other systems.

🟢

If Mitigated

Limited impact if strong network segmentation, monitoring, and additional authentication layers are in place.

🌐 Internet-Facing: HIGH - Gateway servers exposed to internet are directly vulnerable to authentication bypass.
🏢 Internal Only: HIGH - Internal attackers or compromised systems can exploit this to gain unauthorized access.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires network access to the Gateway Server but authentication is bypassed. No public exploit code is known, but the vulnerability is simple to exploit.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: V2.3.9.38

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

Restart Required: Yes

Instructions:

1. Download CODESYS Gateway Server V2 version 2.3.9.38 or later from the CODESYS website. 2. Stop the CODESYS Gateway service. 3. Install the update. 4. Restart the service.

🔧 Temporary Workarounds

Network Segmentation

all

Isolate CODESYS Gateway Server from untrusted networks and internet.

Disable Password Authentication

all

Use certificate-based authentication instead of password authentication if supported.

🧯 If You Can't Patch

  • Implement strict network access controls to limit connections to trusted IP addresses only.
  • Enable detailed logging and monitoring for authentication attempts and implement alerting for failed/suspicious logins.

🔍 How to Verify

Check if Vulnerable:

Check the CODESYS Gateway Server version in the administration interface or via the installed software list.

Check Version:

On Windows: Check Programs and Features. On Linux: Check package manager or run 'codesys-gateway --version' if available.

Verify Fix Applied:

Verify the version is 2.3.9.38 or higher and test authentication with partial passwords to confirm they are rejected.

📡 Detection & Monitoring

Log Indicators:

  • Multiple failed authentication attempts followed by successful login with short passwords
  • Authentication logs showing successful logins from unexpected sources

Network Indicators:

  • Unusual network traffic to CODESYS Gateway port (typically 1217/TCP)
  • Authentication attempts with short password strings

SIEM Query:

source="codesys_gateway.log" AND (event="authentication_success" AND password_length<8) OR (event="authentication_failure" AND password_length<8)

🔗 References

📤 Share & Export