Summary
WeGIA versions prior to 3.6.10 contain a stored cross-site scripting vulnerability in the Member Registration (Cadastrar Sócio) feature, where untrusted input in the Member Name (Nome Sócio) field is saved without proper sanitization.
When other users later view pages that render this stored data, the injected script can execute in their browser, potentially leading to account compromise or unauthorized actions within the application.
Affected context
The vulnerability arises in WeGIA's web interface for managing members of charitable institutions, specifically in the "Member Registration" workflow.
It affects deployments where user-provided text in the "Member Name" field is:
- Accepted from end users or semi-trusted operators,
- Persisted to the application's database, and
- Rendered back into HTML responses without contextual output encoding.
Any page or URL that displays the stored member name becomes a potential execution point for attacker-controlled JavaScript.
Exploit preconditions
- Attack surface: HTTP(S) web interface for member management.
- Required access: Ability to submit or modify the "Member Name" (Nome Sócio) field—typically any authenticated user with permissions to register or edit members; in some configurations this could be broader.
- Trigger point: Viewing of a page or URL where the stored member name is rendered in the DOM (e.g., member lists, detail pages, reports).
- Why exploitation is possible: The application stores raw user input and later injects it into HTML output without applying context-aware escaping or sanitization, allowing embedded script content to be interpreted by the browser.
Why this happens
This issue is a classic stored cross-site scripting flaw mapped to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting).
The underlying pattern is:
- Data from a user-controlled input field ("Member Name") is trusted as display text.
- The value is persisted server-side and reused in multiple views.
- When rendered, the value is inserted into an HTML context without proper output encoding, sanitization, or use of safe templating constructs.
Browsers therefore treat parts of the stored value as active markup or script, enabling attacker-supplied JavaScript to run in the context of the application's origin.
Potential impact
- Theft of session identifiers or authentication tokens via malicious JavaScript.
- Impersonation of victim users, including administrators, within the WeGIA application.
- Unauthorized actions performed on behalf of logged-in users (e.g., modifying records, changing configurations).
- Injection of misleading or fraudulent content into application pages.
- Lateral movement by chaining XSS with other browser-based attacks (e.g., CSRF token extraction).
General mitigation guidance
Effective mitigation emphasizes context-aware output encoding and strict handling of untrusted data:
- Ensure that all user-controlled fields, including "Member Name," are encoded when rendered into HTML (e.g., escaping
<,>,",',&) and further constrained if used within attributes or script contexts. - Use templating engines or frameworks that apply automatic, context-sensitive escaping by default, and avoid disabling these features.
- Apply server-side validation to restrict the allowed character set and length for textual fields that should not contain markup, rejecting or normalizing unexpected input.
- Separate data from presentation logic by avoiding direct concatenation of user input into HTML, JavaScript, or inline event handlers.
- Follow a least-privilege model for user roles so that not all users can create or modify data that is widely visible across the system.
How teams detect issues like this
To detect similar issues, organizations can combine manual and automated approaches:
- Static analysis: Configure SAST tools with rules that flag concatenation of request parameters or database fields into HTML responses without encoding, especially in presentation layers and templates.
- Code review: During peer review, trace the lifecycle of user inputs like "Member Name" from controller to view, ensuring that rendering steps always use safe encoding APIs; treat any raw HTML injection as a review blocker.
- Dynamic testing: Employ DAST or automated browser-based scanners to inject benign XSS probes into form fields and monitor for reflection or storage-based execution on subsequent views.
- Security testing policies: Enforce guidelines in CI/CD pipelines that require XSS-focused checks for all new or modified views, with fail conditions when unsafe rendering patterns are detected.

