Summary
WeGIA's backup import and controller-dispatch flow can allow a user with backup-management permission to make the application include a controller file from an uploaded archive. If the archive is stored in the configured backup directory and user-controlled values influence the include path, code may run with the web server's privileges.
Affected context
The issue involves the backup upload endpoint and controller dispatch in WeGIA. The described path depends on the configured backup directory, the application accepting a crafted gzip-compressed tar archive, and a user-controlled modulo value being combined with nomeClasse for require_once(). Authorization may also be affected when the whitelisted InternoControle has an empty resource list treated as authorized.
Exploit preconditions
- Attack surface: Web-accessible backup import and controller dispatch functionality.
- Required access: Permission to manage backups and upload an archive.
- Trigger point: A controller request that uses the user-controlled
modulovalue to construct arequire_once()path. - Why exploitation is possible: The uploaded archive can be addressed through a
phar://path, and the authorization check may treat the selected whitelisted controller's empty resource list as authorized.
Why this happens
The application uses user-influenced values to construct a PHP file inclusion path, allowing an uploaded archive to supply a controller file that is then included and invoked. This is an improper control of a filename used in an include or require operation, mapping to CWE-98. The archive upload also relates to CWE-434, unrestricted upload of files with dangerous types, because uploaded content can become a source of executable code when used by the include path.
Potential impact
- Arbitrary code may execute with the privileges of the web-server process.
- Sensitive data, configuration, credentials, or source files could be accessed or modified.
- Host commands could be run, and services reachable by the web-server account could be affected.
General mitigation guidance
Defensive patterns include avoiding include paths derived from request parameters and mapping accepted controller names to fixed, trusted files. Authorization should be explicit and deny by default, including when a resource list is empty. Treat uploaded archives as untrusted: validate their structure and contents, store them outside executable paths, and prevent user-controlled archive names or paths from influencing code loading. Apply least privilege to the web-server account and do not rely on PHP Phar settings alone to prevent archive reads through stream wrappers.
How teams detect issues like this
- Use static analysis to find
require_once()and related include operations whose paths depend on request parameters or uploaded-file locations. - Review backup upload handling for archive validation, storage location, and path traversal or stream-wrapper risks.
- Inspect authorization logic for empty or missing resource lists that result in access being granted.
- Enforce code-review and CI policies that restrict dynamic include paths and executable content in upload directories.
- Correlate logs for backup uploads and unusual controller dispatch requests.

