Xoops CMS 2.5.10 - Stored Cross-Site Scripting (XSS) (Authenticated)

Exploit Author: tmrswrr Analysis Author: www.bubbleslearn.ir Category: WebApps Language: PHP Published Date: 2023-06-14
# Exploit Title: Xoops CMS 2.5.10 - Stored Cross-Site Scripting (XSS) (Authenticated)
# Date: 2023-06-12
# Exploit Author: tmrswrr
# Vendor Homepage: https://xoops.org/
# Software https://github.com/XOOPS/XoopsCore25/releases/tag/v2.5.10
# Version: 2.5.10
# Tested : https://www.softaculous.com/apps/cms/Xoops


--- Description ---

1) Login admin panel and click Image Manager , choose Add Category : 
https://demos5.softaculous.com/Xoopshkqdowiwqq/modules/system/admin.php?fct=images
2) Write your payload in the Category Name field and submit:
Payload: <script>alert(1)</script>
3) After click multiupload , when you move the mouse to the payload name, you will see the alert button
https://demos5.softaculous.com/Xoopshkqdowiwqq/modules/system/admin.php?fct=images&op=multiupload&imgcat_id=2


Xoops CMS 2.5.10 Stored Cross-Site Scripting Vulnerability: A Deep Dive into Authenticated XSS Exploitation

Recent security research has uncovered a critical stored Cross-Site Scripting (XSS) vulnerability in Xoops CMS 2.5.10, a widely used open-source content management system. This flaw, discovered by cybersecurity researcher tmrswrr, allows authenticated administrators to inject malicious scripts into the application's persistent storage—making it a particularly dangerous threat due to its long-term impact and elevated privilege context.

Understanding the Vulnerability: Stored XSS in Context

Unlike reflected XSS, where payloads are executed immediately upon user interaction, stored XSS involves malicious code being permanently saved within the application’s database or file system. When a victim visits a page containing the stored payload, the script executes automatically, often without any user interaction beyond viewing the content.

With Xoops CMS 2.5.10, this vulnerability manifests in the Image Manager module—specifically during category creation. An authenticated admin can exploit this flaw by inserting malicious code into the Category Name field, which is then stored and rendered in subsequent UI interactions.

Exploitation Steps: A Real-World Attack Scenario

The attack chain is straightforward but highly effective due to the high privilege of the attacker:

  • Step 1: Log in to the admin panel using valid credentials.
  • Step 2: Navigate to Image Manager via: https://demos5.softaculous.com/Xoopshkqdowiwqq/modules/system/admin.php?fct=images.
  • Step 3: Select Add Category and enter a malicious payload in the Category Name field:
<script>alert(1)</script>

This payload, when submitted, gets stored in the database under the category name field. The system does not sanitize or escape this input, allowing the script to persist.

Step 4: After creating the category, proceed to the multiupload function:

https://demos5.softaculous.com/Xoopshkqdowiwqq/modules/system/admin.php?fct=images&op=multiupload&imgcat_id=2

Upon hovering over the category name (which contains the script), the browser executes the JavaScript code, triggering an alert(1) popup—a clear demonstration of XSS execution.

Why This is a Critical Risk

Although the exploit appears simple, it underscores a deeper architectural flaw: inadequate input sanitization in a privileged administrative interface. The fact that this vulnerability is authenticated means attackers need only compromise an admin account—common in real-world scenarios due to weak password policies, phishing, or credential reuse.

Once an admin is compromised, the attacker can:

  • Inject persistent scripts that redirect users to malicious sites.
  • Steal session cookies or authentication tokens via document.cookie access.
  • Trigger browser-based malware or perform lateral movement within the network.
  • Use the XSS as a foothold for further exploitation, such as injecting phishing forms or manipulating user behavior.

Technical Analysis: The Root Cause

The vulnerability stems from a lack of output encoding and input validation in the Image Manager module. Specifically:

  • Category names are stored directly into the database without escaping HTML characters.
  • When rendering category names in the UI (e.g., in dropdowns or tooltips), the application outputs the raw data without sanitization.
  • JavaScript execution is triggered by mouse events (e.g., hover), which are commonly used in modern web interfaces—making the exploit stealthy and user-triggered.

This behavior violates OWASP’s XSS Prevention Guidelines, which mandate the use of context-aware output encoding and input validation at all stages.

Security Best Practices and Mitigation

For administrators and developers using Xoops CMS, immediate remediation is essential:

  • Update to a patched version: Upgrade to Xoops 2.5.11 or later, which includes fixes for this and other XSS vulnerabilities.
  • Implement Input Sanitization: Use libraries like HTML Purifier or built-in PHP functions such as htmlspecialchars() to escape user input before storage.
  • Enforce Context-Aware Encoding: Never output raw user data in HTML contexts. Always encode based on the output context (e.g., attribute, script, text).
  • Use Content Security Policy (CSP): Deploy a strict CSP header to block inline scripts and reduce the impact of XSS.
  • Regular Security Audits: Conduct code reviews and penetration testing, especially on admin interfaces.

Example: Corrected Code Implementation

Here is a corrected snippet demonstrating proper sanitization in the category creation process:


// Before: Raw input stored
$cat_name = $_POST['cat_name']; // Vulnerable

// After: Sanitized and encoded
$cat_name = htmlspecialchars($_POST['cat_name'], ENT_QUOTES, 'UTF-8');
// Store in database safely
$db->insert('image_categories', ['name' => $cat_name]);

Explanation: The use of htmlspecialchars() ensures that special characters like < and > are converted to their HTML entities (&lt; and &gt;), preventing script execution. The ENT_QUOTES flag also escapes double quotes, which is crucial when inserting data into HTML attributes.

Conclusion: Lessons from Xoops 2.5.10

The Xoops CMS 2.5.10 stored XSS vulnerability serves as a stark reminder that even well-established open-source projects are not immune to security flaws. The combination of authenticated access, stored payload persistence, and lack of input sanitization creates a potent attack vector.

For cybersecurity professionals, this case highlights the importance of:

  • Testing administrative interfaces rigorously.
  • Implementing defense-in-depth strategies.
  • Adopting secure coding practices from the outset.

Always assume that user input is malicious—validate, sanitize, and encode before storage or display. This vulnerability is not just a bug; it's a cautionary tale for the entire web application ecosystem.