/

CVE-2026-33134

Severity:

CRITICAL RISK

(9.3)

SQL Injection in WeGIA restaurar_produto.php Endpoint

CVE-2026-33134

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Authenticated attackers can achieve full database compromise via SQL injection.

Severity:

CRITICAL RISK

(9.3)

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 versions 3.6.5 and below contain an authenticated SQL injection vulnerability in the html/matPat/restaurar_produto.php endpoint, where the id_produto GET parameter is interpolated directly into SQL queries.

An authenticated attacker who can access this endpoint may inject arbitrary SQL commands, potentially leading to full database compromise and exposure or modification of sensitive institutional data.

Affected context

This vulnerability appears in WeGIA deployments (version 3.6.5 and below) where:

  • Users can authenticate and reach the html/matPat/restaurar_produto.php script
  • The application runs with a database account that has broad privileges on the schema
  • Input from the id_produto GET parameter is processed by the backend without additional filtering or protections at the web server or WAF level

In such configurations, the trusted, authenticated context of the application becomes a conduit for attacker-controlled SQL.

Exploit preconditions

  • Attack surface: HTTP(S) interface to the html/matPat/restaurar_produto.php endpoint.
  • Required access: Valid authenticated user account with permission to invoke the affected functionality.
  • Input vector: The id_produto parameter supplied via the URL query string ($_GET).
  • Trigger point: Execution of the SQL queries in restaurar_produto.php that interpolate id_produto directly into SQL strings.
  • Why exploitation is possible: The parameter is taken directly from $_GET and concatenated into SQL without sanitization, type-casting, or parameterized queries, allowing attacker-controlled SQL syntax to be executed by the database engine.

Why this happens

The core issue is the direct concatenation of user-supplied input into SQL statements, mapping to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').

In restaurar_produto.php, the id_produto value from $_GET is trusted as-is and embedded into two SQL query strings without:

  • Using prepared statements with bound parameters
  • Enforcing numeric type-casting for what appears to be an identifier
  • Applying server-side validation or encoding

This pattern allows the attacker to alter the structure of the SQL queries themselves, rather than only influencing data values, resulting in arbitrary SQL execution under the application's database privileges.

Potential impact

  • Full read access to database tables, which may expose sensitive donor, beneficiary, or operational data.
  • Unauthorized modification or deletion of records, potentially disrupting charitable operations and reporting.
  • Creation or modification of application-level accounts or roles stored in the database.
  • Escalation of privileges within the application if authorization logic relies on database-stored flags or roles.
  • Potential pivot to underlying infrastructure if database features (e.g., file access, stored procedures) are misconfigured and overly powerful.

General mitigation guidance

Effective mitigation focuses on eliminating string-concatenated SQL and tightening trust boundaries around user input:

  • Replace dynamic SQL concatenation with parameterized queries / prepared statements for all database interactions, especially where user input is involved.
  • Enforce strict server-side validation and type constraints for identifiers such as id_produto, ensuring only expected numeric formats are accepted.
  • Centralize database access patterns in a data access layer that enforces parameter binding and discourages ad-hoc SQL construction.
  • Apply least-privilege principles to the application's database account, limiting its ability to perform destructive or administrative operations.
  • Consider adding a web application firewall (WAF) or reverse proxy with rules to detect and block obvious SQL injection patterns, as a defense-in-depth measure rather than a primary fix.

How teams detect issues like this

Organizations can use multiple approaches to detect this class of vulnerability:

  • Static analysis: Configure SAST tools or linters to flag direct concatenation of $_GET, $_POST, and other request-derived variables into SQL strings, and to enforce the use of prepared statements.
  • Code review: During manual reviews, treat any dynamic SQL construction as high risk; look specifically for query-building patterns in PHP files that reference superglobals and lack clear parameter binding.
  • Dynamic testing: Employ DAST tools or targeted penetration tests that inject SQL meta-characters into parameters like id_produto and monitor for database errors, anomalous responses, or data leakage.
  • Logging and monitoring: Enable detailed application and database logging to spot unexpected query patterns, syntax errors driven by user input, or spikes in failed queries involving the vulnerable endpoint.

Sources

SourceLink
github.comgithub.com/LabRedesCefetRJ/WeGIA/pull/1457
github.comgithub.com/LabRedesCefetRJ/WeGIA/releases/tag/3.6.6
github.comgithub.com/LabRedesCefetRJ/WeGIA/security/advisories/GHSA-qg95-x997-66wq

Frequently asked

questions

Yes. Any attacker who can reach the web interface over the network and authenticate to the application can attempt to exploit the vulnerability by sending crafted requests to the affected endpoint.

Yes. The vulnerable restaurar_produto.php functionality is only reachable to authenticated users, so the attacker must first obtain valid credentials or abuse an existing account.

Replace all instances of string-concatenated SQL with parameterized queries, enforce strict type-casting for identifier parameters such as id_produto, and ensure that all user-controlled data is validated before being used in database interactions.

Adopt a development standard that prohibits dynamic SQL concatenation, introduce framework-level data access helpers that require parameter binding, integrate static analysis into CI pipelines to flag unsafe patterns, and train developers on secure coding practices for database access.

Find out what's already
exploitable in your codebase.