CVE-2026-21861: baserCMS: OS Command Injection Leading to Remote Code Execution (RCE)

Published Mar 31, 2026
·
Updated

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::getcoreupdate() - Service - PluginsService::getCoreUpdate() - Affected Endpoint - /baser/admin/baser-core/plugins/getcoreupdate

---

Technical Details

Vulnerable Code Flow

text PluginsController::getcoreupdate() ↓ 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

php $service->getCoreUpdate( $request->getData('targetVersion') ?? '', $request->getData('php') ?? 'php', $request->getData('force'), );

PluginsService.php

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

1. The attacker logs in as a CMS administrator 2. Sends a POST request to the core update functionality in the admin panel 3. Specifies a string containing OS commands in the php parameter 4. exec() is executed on the server side, running the arbitrary OS command

Example Attack Input (Conceptual)

text php=php;id>/tmp/rcetest;#

---

Verification Results (PoC)

Execution Result

bash $ docker exec bc-php cat /tmp/rcetest 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)

---

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.

---

Recommended Fix

Primary Recommendation

- Do not accept the PHP executable path from user input - Fix the PHP executable on the server side using the PHPBINARY constant

php $php = escapeshellarg(PHPBINARY);

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.

Other sources

baserCMS is a website development framework. Prior to version 5.2.3, baserCMS contains an OS command injection vulnerability in the core update functionality. An authenticated administrator can execute arbitrary OS commands on the server due to improper handling of user-controlled input that is directly passed to exec() without sufficient validation or escaping. This issue has been patched in version 5.2.3.

— MITRE

Affected Software

3 affected componentsFixes available
baserCMS BaserCMS<5.2.3
composer/baserproject/basercms<=5.2.2
5.2.3
baserCMS BaserCMS<5.2.3

Event History

Mar 31, 2026
CVE Published
via MITRE·12:43 AM
Data Sourced
via MITRE·12:43 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·01:16 AM
DescriptionSeverityWeaknessAffected Software
Advisory Published
via GitHub·10:27 PM
Data Sourced
via GitHub·10:27 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-21861?

CVE-2026-21861 is classified as a critical severity vulnerability due to its potential for remote code execution.

2

How do I fix CVE-2026-21861?

To fix CVE-2026-21861, update baserCMS to version 5.2.3 or later.

3

Who is affected by CVE-2026-21861?

CVE-2026-21861 affects baserCMS versions prior to 5.2.3 when used by authenticated administrators.

4

What type of vulnerability is CVE-2026-21861?

CVE-2026-21861 is an OS command injection vulnerability that can lead to remote code execution.

5

What can an attacker do with CVE-2026-21861?

An attacker exploiting CVE-2026-21861 can execute arbitrary OS commands on the server when having administrative access.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203