Skip to main content
Vulnerability Database/CVE-2025-22132

CVE-2025-22132: Wegia XSS Vulnerability in File Upload

CVE-2025-22132 is a Cross-Site Scripting flaw in Wegia that allows attackers to execute malicious scripts through file uploads. This article covers the technical details, affected versions, and mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2025-22132 Overview

CVE-2025-22132 is a Cross-Site Scripting (XSS) vulnerability in WeGIA, a web manager for charitable institutions. The flaw resides in the file upload functionality of the WeGIA/html/socio/sistema/controller/controla_xlsx.php endpoint. An authenticated attacker can upload a file containing malicious JavaScript, which executes in the context of a victim's browser when the file is accessed. The vulnerability is tracked under [CWE-79] and is fixed in WeGIA version 3.2.7.

Critical Impact

Successful exploitation enables session hijacking, credential theft, and client-side code execution against users of a charitable institution's WeGIA deployment.

Affected Products

  • WeGIA versions prior to 3.2.7
  • Component: wegia:wegia
  • Endpoint: html/socio/sistema/controller/controla_xlsx.php

Discovery Timeline

  • 2025-01-07 - CVE-2025-22132 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2025-22132

Vulnerability Analysis

The vulnerability stems from insufficient validation on files uploaded through controla_xlsx.php. The endpoint accepts files without enforcing MIME type or extension restrictions, allowing an attacker to upload content containing HTML or JavaScript payloads. When a victim loads the stored file, the browser renders it and executes the embedded script in the application's origin.

The exploitation requires high privileges and user interaction, consistent with an authenticated upload workflow. The scope change indicates that script execution impacts resources beyond the vulnerable component, affecting the browsers of other authenticated users. According to EPSS data from 2026-10-19, the vulnerability has a modest exploitation probability relative to the broader CVE population.

Root Cause

The original controla_xlsx.php implementation created upload directories and stored files without validating extension, MIME type, or content. The directory lacked a .htaccess configuration to prevent server-side handler execution or inline rendering of attacker-controlled content, allowing uploaded HTML or JavaScript to be served in a scriptable context.

Attack Vector

An authenticated attacker submits a crafted file to the vulnerable upload endpoint. Once stored, the file URL is distributed or accessed by another user. The victim's browser interprets the file content as HTML/JavaScript, executing the attacker's payload with access to session cookies, document data, and application APIs in the WeGIA origin.

php
// Patched controla_xlsx.php introduces extension and MIME allowlisting
// Source: https://github.com/nilsonLazarin/WeGIA/commit/330f641db43cfb0c8ea8bb6025cc0732de4d4d6b
<?php
$r = array(
    "resultado" => false,
    "mensagem" => "Ocorreu um erro ao processar o arquivo."
);

$diretorio = "../tabelas/";

if (!is_dir($diretorio)) {
    if (!mkdir($diretorio, 0755, true)) {
        $r['mensagem'] = "Erro ao criar diretório de upload.";
        echo json_encode($r);
        exit;
    }
}

if (!empty($_FILES['arquivo']['name'])) {
    // Lista de extensões e tipos MIME permitidos
    $extensoesPermitidas = array('jpg', 'jpeg', 'png', 'gif');
    // ...validation logic...
}

Detection Methods for CVE-2025-22132

Indicators of Compromise

  • Files with HTML, SVG, or script extensions present in the ../tabelas/ upload directory.
  • Uploaded files whose MIME type or magic bytes do not match the declared extension.
  • Outbound requests from authenticated user browsers to attacker-controlled domains following access to a stored upload URL.

Detection Strategies

  • Inspect web server access logs for POST requests to controla_xlsx.php followed by GET requests to files under ../tabelas/.
  • Scan the upload directory for files containing <script, javascript:, or event-handler attributes such as onerror= and onload=.
  • Correlate authenticated session activity with anomalous JavaScript execution patterns in browser telemetry.

Monitoring Recommendations

  • Enable file integrity monitoring on the WeGIA upload directories to flag new or modified files.
  • Log and alert on HTTP responses from the upload directory that return Content-Type: text/html or image/svg+xml.
  • Monitor for privilege escalation or session reuse following any confirmed XSS execution.

How to Mitigate CVE-2025-22132

Immediate Actions Required

  • Upgrade WeGIA to version 3.2.7 or later, which contains the official fix.
  • Audit the ../tabelas/ directory and remove any files that are not legitimate spreadsheets or images.
  • Rotate active user sessions and reset credentials for accounts that may have been exposed to malicious uploads.

Patch Information

The maintainers released a fix in commit 330f641 that rewrites controla_xlsx.php to enforce an extension and MIME allowlist and adds a .htaccess file to the controller directory that disables script execution. See the GitHub Security Advisory GHSA-h8hr-jhcx-fcv9 and the upstream commit for full details.

Workarounds

  • Restrict access to the controla_xlsx.php endpoint to trusted administrators until the patch is applied.
  • Deploy a web application firewall rule that blocks uploads containing <script> tags or JavaScript URI schemes.
  • Serve the upload directory with Content-Disposition: attachment headers to prevent inline browser rendering.
bash
# Apache .htaccess hardening applied by the official patch
# Source: https://github.com/nilsonLazarin/WeGIA/commit/330f641db43cfb0c8ea8bb6025cc0732de4d4d6b
<Files *>
    SetHandler none
    SetHandler default-handler
    Options -ExecCGI
</Files>

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.