Summary
In the core update functionality of baserCMS, some parameters sent from the admin panel are passed to the exec() function without proper validation or escaping. This issue allows an authenticated CMS administrator to execute arbitrary OS commands on the server (Remote Code Execution, RCE).
This vulnerability is not a UI-level issue such as screen manipulation or lack of CSRF protection, but rather stems from a design that directly executes input values received on the server side as OS commands. Therefore, even if buttons are hidden in the UI, or even if CakePHP's CSRF/FormProtection (SecurityComponent) ensures that only legitimate POST requests are accepted, an attack is possible as long as a request containing a valid token is processed within an administrator session.
Vulnerability Information
| Item | Details |
|---|---|
| CWE | CWE-78: Improper Neutralization of Special Elements used in an OS Command |
| Impact | Remote Code Execution (RCE) |
| Severity | Critical |
| Attack Requirements | Administrator privileges required |
| Reproducibility | Reproducible (confirmed multiple times) |
| Test Environment | baserCMS 5.2.2 (Docker / development environment) |
Affected Areas
- Controller
PluginsController::get_core_update()
- Service
PluginsService::getCoreUpdate()
- Affected Endpoint
/baser/admin/baser-core/plugins/get_core_update
Technical Details
Vulnerable Code Flow
PluginsController::get_core_update()
↓ Retrieves php parameter from POST data
PluginsService::getCoreUpdate($targetVersion, $php, $force)
↓ Concatenates $php into command string without validation or escaping
exec($command)
Relevant Code (Excerpt)
PluginsController.php
$service->getCoreUpdate(
$request->getData('targetVersion') ?? '',
$request->getData('php') ?? 'php',
$request->getData('force'),
);
PluginsService.php
$command = $php . ' ' . ROOT . DS . 'bin' . DS . 'cake.php composer ' .
$targetVersion . ' --php ' . $php . ' --dir ' . TMP . 'update';
exec($command, $out, $code);
The $php parameter is user input, and none of the following countermeasures are in place:
- Restriction via allowlist
- Validation via regular expression
- Escaping via
escapeshellarg()or similar
Attack Scenario
- The attacker logs in as a CMS administrator
- Sends a POST request to the core update functionality in the admin panel
- Specifies a string containing OS commands in the
phpparameter exec()is executed on the server side, running the arbitrary OS command
Example Attack Input (Conceptual)
php=php;id>/tmp/rce_test;#
Verification Results (PoC)
Execution Result
$ docker exec bc-php cat /tmp/rce_test
uid=1000(www-data) gid=1000(www-data) groups=1000(www-data)
The above confirms that OS commands can be executed with www-data privileges.
Additional Notes
- Reproducible through the legitimate flow in the admin panel (browser)
- Succeeds even with CSRF/FormProtection tokens included in a legitimate request
- Failure cases (400/403) have also been investigated and differentiated
- Confirmed reproducible via resending HTTP requests with tools such as curl (resending the same request containing valid tokens)
Primary Recommendation
- Do not accept the PHP executable path from user input
- Fix the PHP executable on the server side using the
PHP_BINARYconstant
$php = escapeshellarg(PHP_BINARY);
Supplementary Fix Recommendations
- Apply
escapeshellarg()escaping to other command-line arguments (version number, directory, etc.) as well - If possible, consider using execution methods that do not involve shell interpretation (array format, Process class, etc.)
Alternative (Not Recommended)
- Allowlist validation for the PHP executable path
- Combined use of regex validation and
escapeshellarg()
However, from the perspective of reducing the attack surface, a design that eliminates user input entirely is recommended.
Additional Notes
- This issue is independent of UI display controls (showing/hiding buttons)
- As long as the endpoint exists, an attack is possible if a request containing valid tokens is processed
- This is a problem stemming from the design-level handling of input, and cannot be prevented by CSRF or UI controls alone
Conclusion
Due to a design issue in baserCMS's core update functionality where user input is passed to exec() without validation, Remote Code Execution (RCE) is achievable with administrator privileges. This vulnerability can be fixed through input validation and design review, and prompt remediation is recommended.
This advisory was translated from Japanese to English using GitHub Copilot.
Impact
If this vulnerability is exploited, the following becomes possible:
- Retrieval of server information
- Reading/writing arbitrary files
- Retrieval of application configuration information (DB credentials, etc.)
- OS-level operations beyond application permission boundaries
Although administrator privileges are required, this is a design issue where the impact extends from the application layer to the OS layer, and the impact is considered significant.
Untrusted input reaches a shell command, allowing arbitrary commands to run on the host. Typical impact: code execution in the application's environment.
CVE-2026-21861 has a CVSS score of 9.1 (Critical). The vector is network-reachable, high privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (5.2.3); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2026-21861? CVE-2026-21861 is a critical-severity OS command injection vulnerability in baserproject/basercms (composer), affecting versions <= 5.2.2. It is fixed in 5.2.3. Untrusted input reaches a shell command, allowing arbitrary commands to run on the host.
- How severe is CVE-2026-21861? CVE-2026-21861 has a CVSS score of 9.1 (Critical). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of baserproject/basercms are affected by CVE-2026-21861? baserproject/basercms (composer) versions <= 5.2.2 is affected.
- Is there a fix for CVE-2026-21861? Yes. CVE-2026-21861 is fixed in 5.2.3. Upgrade to this version or later.
- Is CVE-2026-21861 exploitable, and should I be worried? Whether CVE-2026-21861 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-21861 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-21861? Upgrade
baserproject/basercmsto 5.2.3 or later.