/

CVE-2026-33991

Severity:

HIGH RISK

(8.8)

SQL Injection in WeGIA Tag Deletion Endpoint

CVE-2026-33991

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Data Manipulation and Potential Data Disclosure via SQL Injection

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

A SQL injection vulnerability in WeGIA's deletar_tag.php endpoint allows user-controlled input from HTTP request parameters to be concatenated directly into SQL queries without sanitization or prepared statements.

If an attacker can send crafted requests to this endpoint, they may be able to modify or delete database records, or in some environments, execute additional database-specific commands under the application's database account.

Affected context

This vulnerability occurs in WeGIA deployments that expose the html/socio/sistema/deletar_tag.php script to users, either directly or via application workflows.

It arises where request parameters are automatically extracted with extract($_REQUEST) and the resulting $id_tag variable is used in SQL statements through string concatenation.

The risk is higher when the database user account has broad privileges over tables used for tags or related entities, and when input validation or access control around tag deletion is weak or inconsistent.

Exploit preconditions

  • Attack surface: HTTP interface of the WeGIA application, specifically requests reaching deletar_tag.php.
  • Required access: Ability to send crafted requests containing id_tag (or equivalent) parameters; this may be unauthenticated or authenticated depending on deployment access controls.
  • Trigger point: Processing of the deletion request where extract($_REQUEST) populates $id_tag, which is then interpolated directly into SQL queries on lines 16–17.
  • Why exploitation is possible: The application performs dynamic SQL construction using untrusted request data, with no input validation, escaping, or prepared statements, allowing attackers to alter the intended SQL command structure.

Why this happens

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

The use of extract($_REQUEST) introduces an additional risk by implicitly creating variables from request parameters, making data flow harder to reason about and validate.

Instead of treating client-supplied values as data bound through parameterized queries, the implementation concatenates $id_tag into the SQL string, allowing control characters and SQL syntax from the attacker to modify the semantics of the query.

Potential impact

  • An attacker may delete arbitrary tag records or related entries in the database.
  • An attacker could manipulate WHERE clauses to affect more rows than intended, leading to bulk modification or deletion.
  • Depending on database configuration, the attacker may read additional data via UNION-based or error-based SQL injection techniques.
  • In environments where the database account has elevated privileges, the attacker could create, alter, or drop tables, impacting application integrity and availability.
  • In some database platforms, the attacker could potentially execute stored procedures or database-specific functions that extend impact beyond basic data access.

General mitigation guidance

Effective mitigation focuses on ensuring that user-controlled data cannot alter SQL command structure:

  • Replace string concatenation in SQL with parameterized queries or prepared statements so that values are always bound as data, not syntax.
  • Avoid extract($_REQUEST) and similar patterns that implicitly trust and expose request parameters; instead, explicitly read and validate expected inputs.
  • Apply input validation to enforce strict type and format constraints (e.g., numeric-only identifiers for tag IDs) before any database interaction.
  • Configure database accounts with least privilege, limiting their ability to create, drop, or modify schema objects beyond what the application genuinely requires.
  • Introduce application-level access controls around deletion operations to reduce who can reach sensitive endpoints.

How teams detect issues like this

Organizations can detect and prevent similar issues through a combination of review and tooling:

  • Use static analysis rules to flag direct concatenation of $_GET, $_POST, $_REQUEST, or extract()-derived variables into SQL strings.
  • During code review, treat any use of extract() as a signal for deeper inspection, and verify that all database interactions use prepared statements or safe query builders.
  • Enforce coding standards that mandate parameterized queries for all SQL access and discourage dynamic SQL construction.
  • Employ application security testing (SAST and DAST) tools configured to search for SQL injection patterns and unvalidated request parameters in database calls.
  • Monitor application and database logs for anomalous query patterns that include unexpected SQL keywords in user-supplied fields.

Sources

SourceLink
github.comgithub.com/LabRedesCefetRJ/WeGIA/security/advisories/GHSA-74xm-6wgf-x37j

Frequently asked

questions

Yes. If the affected endpoint is reachable over the network, an attacker can exploit the vulnerability remotely by sending crafted HTTP requests containing malicious id_tag values.

It depends on how WeGIA is deployed and configured. If access to the tag deletion functionality is not properly restricted, an unauthenticated attacker could potentially exploit it; otherwise, any user who can invoke the deletion endpoint could attempt exploitation.

The safest approach is to remove direct string concatenation of user input in SQL, replace it with prepared statements or parameterized queries, and avoid extract($_REQUEST) in favor of explicit, validated parameter handling.

Establish a standard of always using parameterized queries, enforce strict input validation, restrict database privileges, and integrate secure coding guidelines backed by automated checks (such as static analysis and CI pipeline policies) to catch unsafe patterns early in development.

Find out what's already
exploitable in your codebase.