The vulnerability, identified as GHSA-xp9f-pvvc-57p4, is a classic 'Zip Slip' issue within the ci4-cms-erp/ci4ms package. The root cause lies in the Backup::restore function located in modules/Backup/Controllers/Backup.php. According to the vulnerability description and confirmed by the patch analysis, the function failed to sanitize the filenames of files contained within an uploaded ZIP archive before extraction.
The vulnerable code used ZipArchive::extractTo() directly on the uploaded file. This allowed an authenticated user with backup creation permissions to upload a specially crafted ZIP file containing directory traversal paths (e.g., ../../public/shell.php). Upon extraction, the server would place the malicious shell.php file in the public webroot, granting the attacker remote code execution capabilities.
The fixing commit 8bc77b62495ae3da2023d717bda5cc520c4b848f addresses this flaw by removing the direct call to extractTo(). Instead, the patched code iterates through the files in the ZIP archive one by one. For each file, it uses the basename() function on the entry name. This is a critical security step, as basename() effectively strips out any directory path information (like ../), ensuring that only the filename is considered. The code now explicitly extracts only the SQL file to a safe location, preventing the Zip Slip vulnerability.