Summary
An authenticated SQL injection vulnerability in WeGIA's Atendido_ocorrenciaControle endpoint allows crafted input in the id_memorando parameter to alter backend database queries.
Under these conditions, an attacker with valid credentials can exfiltrate the full database, access sensitive PII, and, in some misconfigured deployments, pivot into arbitrary file reads on the server.
Affected context
This vulnerability occurs in WeGIA deployments that expose the Atendido_ocorrenciaControle functionality to authenticated users and build SQL statements using the id_memorando parameter without proper query parameterization.
It is most relevant where application accounts have broad database privileges or where the database server can access the underlying filesystem.
The issue is present in versions prior to 3.6.2 and depends on how access control and database permissions are configured within a given installation.
Exploit preconditions
- Attack surface: HTTP(S) interface of the WeGIA web application, specifically the Atendido_ocorrenciaControle endpoint.
- Required access: Valid authenticated user account with permission to reach the affected endpoint.
- Trigger point: Server-side processing of requests that include attacker-controlled values in the
id_memorandoparameter. - Why exploitation is possible: User-supplied data is inserted directly into SQL query strings or is otherwise not parameterized or validated, allowing injection, manipulation of query structure, and abuse of database capabilities.
Why this happens
The core issue is a classic SQL injection flaw where dynamic SQL is constructed by concatenating or interpolating the id_memorando parameter into queries without using parameterized statements or adequate input handling.
This maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where attacker-controlled input is treated as part of the SQL syntax rather than as data.
As a result, an authenticated attacker can influence WHERE clauses, union in additional result sets, call database-specific functions, or leverage database features that access the underlying filesystem in permissive configurations.
Potential impact
- Full database content exfiltration, including tables containing personal or operational data
- Exposure of sensitive personally identifiable information (PII) about beneficiaries, staff, or donors
- Tampering with application data, such as inserting, updating, or deleting records
- Abuse of database-level functionality that may allow arbitrary file reads on the host in misconfigured environments
- Indirect impact on availability through destructive queries or resource-intensive operations
General mitigation guidance
Effective mitigation focuses on eliminating direct string-based SQL construction and tightening trust boundaries around user input:
- Adopt parameterized queries or prepared statements for all database operations involving user-supplied data, including
id_memorando. - Introduce strict server-side validation and type enforcement, especially for identifier and numeric parameters, ensuring only expected formats are accepted.
- Restrict database privileges so the application account has only the minimal permissions needed, limiting access to sensitive tables and filesystem-related features.
- Implement centralized input handling and query-building patterns to avoid ad-hoc SQL creation spread across the codebase.
- Consider adding application-layer access controls and data minimization so that even if a query is abused, the scope of accessible data is reduced.
How teams detect issues like this
Organizations can detect this class of issue using a combination of code-centric and behavior-centric approaches:
- Static analysis: Configure SAST rules to flag dynamic SQL construction that includes variables derived from HTTP parameters, particularly within the Atendido_ocorrenciaControle controller or related data access layers.
- Code review: Look for string concatenation or interpolation in SQL statements, absence of prepared statements, and inconsistent use of query parameterization patterns.
- Runtime monitoring: Use database activity monitoring or application logs to spot unusual query patterns, such as unexpected
UNION SELECT, subqueries, or queries referencing system tables from user-facing workflows. - Security testing: Apply authenticated SQL injection tests (e.g., with web vulnerability scanners or custom test cases) against authenticated endpoints that accept
id_memorandoor similar identifiers.

