CVE-2025-0694
Executive Summary
CVE-2025-0694 is a vulnerability in CODESYS Control runtime systems that allows a low-privileged attacker with physical access to bypass path validation and gain full filesystem access. The flaw resides in insufficient path validation, enabling directory traversal or arbitrary file read/write operations. With a CVSS score of 6.6 (Medium), the attack vector is physical, but the impact on confidentiality, integrity, and availability is high. No public exploit code or proof-of-concept is currently available, and no patch has been released by the vendor. This vulnerability is particularly dangerous in industrial control system (ICS) environments where physical access to controllers is possible.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
CVSS Breakdown & Threat Level
- Attack Vector (AV): Physical (P) – Requires physical access to the device.
- Attack Complexity (AC): Low (L) – No special conditions needed.
- Privileges Required (PR): Low (L) – Attacker needs low-level access (e.g., user account).
- User Interaction (UI): None (N) – No user action required.
- Scope (S): Unchanged (U) – Vulnerability does not affect other components.
- Confidentiality (C): High (H) – Full filesystem read access.
- Integrity (I): High (H) – Full filesystem write access.
- Availability (A): High (H) – Could lead to denial of service or system compromise.
Threat Level: Medium (6.6) – Physical access requirement reduces exploitability, but impact is severe in ICS contexts.
Deep Dive & Mechanics
The vulnerability exists in the file path handling logic of CODESYS Control runtime. When a low-privileged user interacts with the system via physical console or local interface, the application fails to properly validate user-supplied paths. This allows an attacker to use directory traversal sequences (e.g., ../) to escape restricted directories and access arbitrary files on the filesystem.
Root Cause: The application does not sanitize or canonicalize file paths before performing filesystem operations. This is a classic path traversal vulnerability (CWE-22). The attacker can read sensitive configuration files, modify runtime parameters, or overwrite critical binaries.
Attack Scenario:
- Attacker gains physical access to the CODESYS Control device (e.g., via USB, serial console, or local terminal).
- Attacker logs in with low-privileged credentials (default or brute-forced).
- Attacker uses a vulnerable function (e.g., file upload, configuration load) that accepts a file path.
- Attacker supplies a path like
../../etc/passwdor../../config/system.cfg. - The application processes the path without validation, granting access to the target file.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
// Vulnerable: No path validation
int load_config(const char *user_path) {
char full_path[256];
snprintf(full_path, sizeof(full_path), "/config/%s", user_path);
FILE *f = fopen(full_path, "r");
// ... read file
}
Patched Code (Conceptual):
// Patched: Validate and canonicalize path
int load_config(const char *user_path) {
char full_path[256];
char resolved[256];
snprintf(full_path, sizeof(full_path), "/config/%s", user_path);
if (realpath(full_path, resolved) == NULL) {
return -1; // Error
}
if (strncmp(resolved, "/config/", 8) != 0) {
return -1; // Path escape detected
}
FILE *f = fopen(resolved, "r");
// ... read file
}
Key Differences:
- Use of
realpath()to resolve symlinks and..sequences. - Check that the resolved path stays within the allowed directory.
- Reject any path that escapes the sandbox.
Exploitation & Lab Setup
Red Team (Offensive)
Prerequisites:
- Physical access to a CODESYS Control device (e.g., Raspberry Pi running CODESYS, WAGO PLC, etc.).
- Low-privileged user account (e.g.,
userwith default passworduser).
Exploitation Steps:
- Connect to the device via serial console or SSH (if enabled).
- Log in with low-privileged credentials.
- Identify a vulnerable endpoint (e.g., file upload, configuration load).
- Craft a path traversal payload:
../../etc/passwd - Execute the command or API call to read the file.
- For write access, use a payload like:
Then write malicious content.../../tmp/backdoor.sh
Example Command (if shell access):
# Read sensitive file
cat /config/../../etc/shadow
# Write a backdoor
echo "malicious_code" > /config/../../usr/bin/backdoor
Blue Team (Defensive)
Detection:
- Monitor for path traversal patterns in logs (e.g.,
../,..\\). - Alert on file access outside expected directories.
- Use file integrity monitoring (FIM) on critical system files.
Prevention:
- Restrict physical access to devices (locked cabinets, access control).
- Enforce least privilege – remove default low-privileged accounts.
- Implement application-level path validation and canonicalization.
- Use chroot jails or containerization to isolate the runtime.
Hunting:
- Search for file read/write events to sensitive paths (e.g.,
/etc/shadow,/etc/passwd). - Look for unusual process behavior (e.g.,
catorechoaccessing system files).
Indicators of Compromise (IOCs)
- File Paths:
/etc/passwd/etc/shadow/config/../../etc/shadow/var/log/auth.log(modified)
- Process Names:
cat,echo,cp,mvexecuted by low-privileged user on system files.
- Log Entries:
- Repeated path traversal patterns in application logs.
- Unauthorized file access attempts.
- Network (if applicable):
- Outbound connections from the device to unknown IPs (data exfiltration).
Detection Engineering
YARA Rule
rule CVE_2025_0694_PathTraversal {
meta:
description = "Detects path traversal attempts in CODESYS Control logs"
author = "Valters IT"
date = "2025-04-10"
cve = "CVE-2025-0694"
strings:
$traversal1 = "../" ascii wide nocase
$traversal2 = "..\\" ascii wide nocase
$traversal3 = "/etc/" ascii wide nocase
$traversal4 = "/var/" ascii wide nocase
condition:
any of ($traversal*) and filesize < 10KB
}
Sigma Rule
title: CVE-2025-0694 Path Traversal in CODESYS Control
id: 8a9b3c2d-1e5f-4a7b-9c8d-0e1f2a3b4c5d
status: experimental
description: Detects path traversal attempts in CODESYS Control logs
author: Valters IT
date: 2025-04-10
logsource:
category: application
product: codesys_control
detection:
selection:
EventID: 1001
Message|contains:
- '../'
- '..\\'
- '/etc/'
- '/var/'
condition: selection
falsepositives:
- Legitimate use of relative paths in configuration
level: high
Suricata Rule
alert tcp any any -> any 2455 (msg:"CVE-2025-0694 CODESYS Control Path Traversal"; flow:to_server,established; content:"../"; nocase; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Restrict Physical Access: Place CODESYS Control devices in locked cabinets or secure areas.
- Disable Unnecessary Accounts: Remove or disable default low-privileged accounts.
- Apply Vendor Patch: Monitor CODESYS security advisories for an official patch.
- Implement Workaround: If possible, use a reverse proxy or application firewall to filter path traversal patterns.
Long-Term Fixes:
- Code Review: Ensure all file path operations use canonicalization and whitelist-based validation.
- Least Privilege: Run the CODESYS runtime with minimal filesystem permissions.
- Logging & Monitoring: Enable detailed logging of file access and alert on anomalies.
Valters IT Signature This report was generated by Valters IT DevSecOps AI. For questions, contact security@valters-it.com.
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.