/

CVE-2026-35395

Severity:

HIGH RISK

(8.8)

SQL Injection in WeGIA DespachoDAO Memorando Handling

CVE-2026-35395

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Arbitrary SQL Execution and Data Compromise

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

WeGIA, a web manager for charitable institutions, contains a SQL injection vulnerability in the DespachoDAO memorando handling, where the id_memorando parameter from $_REQUEST is directly concatenated into SQL queries.

Any authenticated user who can control this parameter may execute arbitrary SQL commands against the application database, potentially exposing or altering sensitive institutional data.

Affected context

The vulnerability occurs in WeGIA installations prior to version 3.6.9 within the PHP data access layer file dao/memorando/DespachoDAO.php.

In this context, the id_memorando parameter is read from $_REQUEST (e.g., GET or POST) without validation or sanitation and embedded into SQL statements that run against the backend database.

The risk materializes when authenticated users can influence this parameter through application workflows that invoke the affected DAO methods.

Exploit preconditions

  • Attack surface: HTTP endpoints that trigger queries in DespachoDAO.php using the id_memorando parameter.
  • Required access: Authenticated access to the WeGIA application with the ability to submit or modify requests containing id_memorando.
  • Trigger point: Application actions that perform database operations (SELECT/UPDATE/DELETE/INSERT) in DespachoDAO based on the supplied id_memorando value.
  • Why exploitation is possible: User-controlled data is directly interpolated into SQL strings without parameterization, escaping, or type enforcement, enabling crafted input to alter the intended SQL structure.

Why this happens

This issue stems from constructing SQL queries via string concatenation with untrusted input taken directly from $_REQUEST.

Instead of using prepared statements or bound parameters, the code embeds id_memorando variables directly into the SQL text, allowing an attacker to inject additional SQL tokens.

This is a classic instance of CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the application fails to treat user-supplied data strictly as data, mixing it with control syntax.

Potential impact

  • Unauthorized reading of sensitive tables, including personal or institutional records.
  • Modification or deletion of memorando-related data or other business records.
  • Creation of rogue accounts or escalation of application privileges via database changes.
  • Destruction or corruption of database contents, impacting application availability and integrity.
  • Potential pivoting to access additional systems that rely on the same database or credentials.

General mitigation guidance

Effective mitigation focuses on separating data from control in all database interactions and reducing trust in incoming parameters:

  • Replace string-concatenated SQL with prepared statements and bound parameters for all queries using id_memorando and other user-controlled values.
  • Enforce strict input validation and type checking (e.g., ensuring identifiers are integers) at the controller or DAO boundary before reaching the database layer.
  • Centralize database access patterns to a data access layer that mandates parameterization and rejects dynamic SQL string building.
  • Apply least-privilege to the database account used by WeGIA so that, even if a query is manipulated, its capabilities are limited to necessary operations.
  • Use secure coding guidelines and development standards that explicitly forbid direct interpolation of $_REQUEST, $_GET, or $_POST into SQL.

How teams detect issues like this

Organizations can detect this and similar flaws by combining code-level and behavior-level analysis:

  • Static analysis: Configure SAST rules to flag direct use of $_REQUEST, $_GET, or $_POST variables in SQL query strings and to require parameterized queries in DAO classes.
  • Code review: During manual reviews, focus on data access files (like DespachoDAO.php) and look for concatenated SQL, missing input validation, and absence of prepared statements.
  • Policy enforcement: Introduce coding policies that prohibit raw SQL concatenation and enforce the use of a database abstraction layer or ORM with parameter binding.
  • Runtime monitoring: Use database activity monitoring to spot anomalous or malformed SQL patterns that indicate injection attempts, and feed those insights back into secure development practices.

Sources

SourceLink
github.comgithub.com/LabRedesCefetRJ/WeGIA/security/advisories/GHSA-43jm-pcrq-w7gv

Frequently asked

questions

Yes, it is exploitable remotely over HTTP, but only by users who can authenticate to the WeGIA application and reach the affected functionality that uses id_memorando.

The description indicates that any authenticated user is sufficient. Elevated roles are not strictly required, although higher-privileged accounts might be able to access more data once the database is compromised.

The most robust fix is to replace all dynamically concatenated SQL with prepared statements and bound parameters, combined with strict type and range validation of all user-controlled inputs before they are used in any query.

Adopting a secure data access layer that enforces parameterization by default, banning raw query concatenation in coding guidelines, using static analysis in CI pipelines, and performing regular security code reviews of database-related code are effective long-term prevention strategies.

Find out what's already
exploitable in your codebase.