CVE-2022-31804

7.5 HIGH

📋 TL;DR

CVE-2022-31804 is a memory allocation vulnerability in CODESYS Gateway Server V2 where unauthenticated attackers can send oversized requests to cause out-of-memory crashes. This affects industrial control systems using CODESYS Gateway Server V2 without proper input validation. The vulnerability allows denial of service attacks against critical industrial infrastructure.

💻 Affected Systems

Products:
  • CODESYS Gateway Server V2
Versions: All versions before the fix
Operating Systems: Windows, Linux
Default Config Vulnerable: ⚠️ Yes
Notes: Affects all default installations of CODESYS Gateway Server V2. The vulnerability is in the core gateway functionality.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete denial of service causing industrial process disruption, production downtime, and potential safety implications in critical infrastructure.

🟠

Likely Case

Gateway server crashes requiring manual restart, causing temporary loss of connectivity to industrial controllers and monitoring systems.

🟢

If Mitigated

Limited impact with proper network segmentation and monitoring allowing quick detection and recovery.

🌐 Internet-Facing: HIGH - Unauthenticated remote exploitation makes internet-exposed instances extremely vulnerable to simple DoS attacks.
🏢 Internal Only: MEDIUM - Internal attackers or malware could still exploit this, but requires network access to the gateway.

🎯 Exploit Status

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

Simple to exploit by sending oversized requests. No authentication required. Likely to be included in industrial control system attack toolkits.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: CODESYS Gateway Server V2 with security update

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

Restart Required: Yes

Instructions:

1. Download the security update from CODESYS customer portal. 2. Stop the CODESYS Gateway Server service. 3. Apply the update according to vendor instructions. 4. Restart the service. 5. Verify the fix is applied.

🔧 Temporary Workarounds

Network Segmentation

all

Isolate CODESYS Gateway Server from untrusted networks and restrict access to authorized IP addresses only.

Firewall Rules

all

Implement strict firewall rules to limit connections to the gateway server port (typically 1217/tcp).

🧯 If You Can't Patch

  • Implement strict network access controls to limit which systems can communicate with the gateway
  • Deploy network-based intrusion detection to monitor for oversized requests and alert on potential exploitation attempts

🔍 How to Verify

Check if Vulnerable:

Check CODESYS Gateway Server version against vendor advisory. If running unpatched V2, assume vulnerable.

Check Version:

Check CODESYS Gateway Server version in administration interface or service properties

Verify Fix Applied:

Verify the gateway server version matches the patched version from CODESYS advisory and test with normal-sized requests.

📡 Detection & Monitoring

Log Indicators:

  • Gateway service crashes
  • Out of memory errors in system logs
  • Unusually large request sizes logged

Network Indicators:

  • Large TCP packets to gateway port (1217)
  • Multiple connection attempts with oversized payloads

SIEM Query:

source="codesys_gateway" AND (event="crash" OR event="out_of_memory" OR size>1000000)

🔗 References

📤 Share & Export