-
Notifications
You must be signed in to change notification settings - Fork 30
Description
A Stored Cross-Site Scripting (XSS) vulnerability was discovered in the application's result template rendering mechanism. The issue stems from the fact that user-supplied input is stored in the database without proper sanitization or output encoding and is later embedded in an HTML context using a template string as described in:

Caption: The program setting that allows user input to be interpreted as raw HTML, which is where the XSS vulnerability exists.
This allows malicious users to inject JavaScript payloads during data entry (e.g., login forms, comments, or user profiles). When another user views or retrieves this data, the malicious JavaScript is executed in their browser, without requiring any interaction (zero-click exploitation).
Proof of Concept (PoC)
User 1 submits the following payload during data entry (e.g., in a form):
First Name, <script>alert('XSS')</script>When User 2 searches for or views the name:
Upon rendering, the application displays the user’s input, which contains the malicious JavaScript code. This script executes immediately when the page loads, displaying the alert box or potentially running arbitrary JavaScript under User 2's session context.
CVSS Score
- Overall CVSS Score: 6.3
- CVSS v3.1 Vector: AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:N/E:F/RL:W/RC:C/CR:M/IR:H/AR:L/MAV:N/MAC:L/MPR:L/MUI:R/MS:U/MC:H/MI:L/MA:N
Note: The CVSS score could realistically range between 6.0 to 8.0, depending on the application's context, such as the sensitivity of the data handled or the potential for privilege escalation.
Impact
- Session Hijacking: Attackers can steal session cookies, leading to account takeover.
- Account Takeover: Attackers can access sensitive user data, leading to full account compromise.
- Reputation Damage: Trust could be compromised if users encounter malicious behavior on the site.
- Low-Interaction Exploitation: The exploit triggers automatically when a vulnerable page is loaded, requiring no further clicks or actions.
Recommendation
Mitigation Steps:
- Output Encoding: Sanitize dynamic data before injecting into HTML using a secure template engine that escapes output by default.
- Input Validation: Restrict input types and use allowlists to limit user-submitted content.
- Template Rendering: Avoid interpreting user input as raw HTML. Use text-based rendering.
Developer Guidance:
Update template handling so that variable placeholders do not allow raw HTML interpretation unless explicitly required and securely handled.
References
- OWASP XSS Prevention Cheat Sheet
- CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')