/

CVE-2026-114622

Severity:

HIGH RISK

(7.2)

Path Traversal (CWE-22) in baserCMS Theme File Plugin

CVE-2026-114622

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22, CWE-180

Impact:

Arbitrary File Write and Remote Code Execution

Severity:

HIGH RISK

(7.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A path traversal vulnerability in baserCMS's optional BcThemeFile plugin allows an authenticated administrator to write files outside the intended theme directory. When percent-encoded traversal is decoded after path validation, an attacker may place PHP files in writable web-accessible locations and execute them.

A path traversal vulnerability in baserCMS's optional BcThemeFile plugin allows an authenticated administrator to write files outside the intended theme directory. When percent-encoded traversal is decoded after path validation, an attacker may place PHP files in writable web-accessible locations and execute them.

Affected context

The issue occurs in baserCMS deployments where the optional BcThemeFile plugin is enabled and its Admin API processes theme-file paths. The vulnerable flow validates a raw path, then decodes it before writing, allowing encoded traversal to bypass containment checks. The Admin web form is not affected in the same way because FormProtection covers the fullpath value.

The issue occurs in baserCMS deployments where the optional BcThemeFile plugin is enabled and its Admin API processes theme-file paths. The vulnerable flow validates a raw path, then decodes it before writing, allowing encoded traversal to bypass containment checks. The Admin web form is not affected in the same way because FormProtection covers the fullpath value.

Exploit preconditions

  • Attack surface: The authenticated Admin API provided by the optional BcThemeFile plugin
  • Required access: A valid administrator session with permission to use the theme-file functionality
  • Request conditions: A same-origin Origin header is required for the relevant request flow
  • Trigger point: Theme file update processing in ThemeFileForm::_execute()
  • Why exploitation is possible: Path containment is checked before rawurldecode() transforms an encoded traversal sequence into directory traversal
  • Deployment condition: The target must have writable locations outside the intended theme directory, such as a webroot
  • Attack surface: The authenticated Admin API provided by the optional BcThemeFile plugin
  • Required access: A valid administrator session with permission to use the theme-file functionality
  • Request conditions: A same-origin Origin header is required for the relevant request flow
  • Trigger point: Theme file update processing in ThemeFileForm::_execute()
  • Why exploitation is possible: Path containment is checked before rawurldecode() transforms an encoded traversal sequence into directory traversal
  • Deployment condition: The target must have writable locations outside the intended theme directory, such as a webroot

Why this happens

The underlying bug is a check-before-decode ordering flaw. ThemeFilesService::update() and getFullpath() validate a raw path and use normalization that resolves only literal dot segments, while ThemeFileForm::_execute() later applies rawurldecode() before writing the file. Encoded traversal therefore remains hidden during validation but becomes active at the write sink. This maps primarily to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, with CWE-180: Incorrect Behavior Order describing the unsafe transformation sequence. A similar ordering pattern is identified in the copy path, although that path was not dynamically verified.

The underlying bug is a check-before-decode ordering flaw. ThemeFilesService::update() and getFullpath() validate a raw path and use normalization that resolves only literal dot segments, while ThemeFileForm::_execute() later applies rawurldecode() before writing the file. Encoded traversal therefore remains hidden during validation but becomes active at the write sink. This maps primarily to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, with CWE-180: Incorrect Behavior Order describing the unsafe transformation sequence. A similar ordering pattern is identified in the copy path, although that path was not dynamically verified.

Potential impact

  • An attacker may write PHP or other executable files outside the intended theme directory.
  • Web-accessible file placement could enable remote code execution under the application's runtime identity.
  • The application may be modified, defaced, or used to distribute malicious content.
  • Sensitive data accessible to the application account could be exposed or altered.
  • A compromised application process could facilitate further compromise, depending on its privileges and environment.
  • An attacker may write PHP or other executable files outside the intended theme directory.
  • Web-accessible file placement could enable remote code execution under the application's runtime identity.
  • The application may be modified, defaced, or used to distribute malicious content.
  • Sensitive data accessible to the application account could be exposed or altered.
  • A compromised application process could facilitate further compromise, depending on its privileges and environment.

General mitigation guidance

Mitigation focuses on enforcing directory containment after every decoding and normalization step, immediately before file access.

Common defensive patterns include:

  • Decode and canonicalize path input before validation rather than validating an earlier representation.
  • Reject encoded separators, traversal components, null bytes, and ambiguous path forms unless they are explicitly required.
  • Resolve the final target path and verify that it remains beneath the approved theme directory.
  • Prefer opaque file identifiers or allowlisted relative filenames over user-controlled filesystem paths.
  • Apply the same validation model consistently to update, read, copy, and delete operations.
  • Restrict theme-file write permissions and prevent writable webroots from serving newly created executable files where practical.
  • Run the application with least privilege and separate content-editing capabilities from operating-system-level permissions.
  • Preserve request-integrity protections for administrative interfaces, while treating them as complementary controls rather than path validation.

Mitigation focuses on enforcing directory containment after every decoding and normalization step, immediately before file access.

Common defensive patterns include:

  • Decode and canonicalize path input before validation rather than validating an earlier representation.
  • Reject encoded separators, traversal components, null bytes, and ambiguous path forms unless they are explicitly required.
  • Resolve the final target path and verify that it remains beneath the approved theme directory.
  • Prefer opaque file identifiers or allowlisted relative filenames over user-controlled filesystem paths.
  • Apply the same validation model consistently to update, read, copy, and delete operations.
  • Restrict theme-file write permissions and prevent writable webroots from serving newly created executable files where practical.
  • Run the application with least privilege and separate content-editing capabilities from operating-system-level permissions.
  • Preserve request-integrity protections for administrative interfaces, while treating them as complementary controls rather than path validation.

How teams detect issues like this

Detection can combine source review, automated analysis, and runtime monitoring:

  • Search for path validation or containment checks that occur before URL decoding, Unicode normalization, archive extraction, or other input transformations.
  • Review filesystem APIs receiving values that have passed through rawurldecode(), URL decoding, or equivalent routines.
  • Flag concatenation of request-controlled paths with trusted directories without final canonical containment checks.
  • Test administrative file-management endpoints with encoded traversal representations in controlled security assessments.
  • Monitor webroot and other application directories for unexpected PHP files or modifications by the application service account.
  • Enforce code-review policies requiring canonicalization and allowlist checks at the final file-operation boundary.
  • Use static-analysis and software-composition or application-security testing tools that identify path traversal and unsafe path normalization patterns.

Detection can combine source review, automated analysis, and runtime monitoring:

  • Search for path validation or containment checks that occur before URL decoding, Unicode normalization, archive extraction, or other input transformations.
  • Review filesystem APIs receiving values that have passed through rawurldecode(), URL decoding, or equivalent routines.
  • Flag concatenation of request-controlled paths with trusted directories without final canonical containment checks.
  • Test administrative file-management endpoints with encoded traversal representations in controlled security assessments.
  • Monitor webroot and other application directories for unexpected PHP files or modifications by the application service account.
  • Enforce code-review policies requiring canonicalization and allowlist checks at the final file-operation boundary.
  • Use static-analysis and software-composition or application-security testing tools that identify path traversal and unsafe path normalization patterns.

Sources

SourceLink
github.comgithub.com/baserproject/basercms/commit/53ecf177dfb10eb1fb89c4b42d313983329aa162
github.comgithub.com/baserproject/basercms/releases/tag/5.3.2
github.comgithub.com/baserproject/basercms/releases/tag/5.4.2
github.comgithub.com/baserproject/basercms/security/advisories/GHSA-q7g3-qwrc-mp89

Frequently asked

questions

It can be exploitable through the baserCMS administrative interface when the optional BcThemeFile plugin is enabled and the attacker has the required administrator session. The request flow also depends on a same-origin Origin header.

Not necessarily. Session-authenticated requests can still reach the affected functionality, so that setting should not be treated as the sole mitigation.

Decode and canonicalize the path before checking containment, then validate the final resolved path immediately before the file operation. Prefer allowlisted filenames or opaque identifiers where possible.

Apply identical validation to every file operation, test encoded and double-encoded path forms, restrict application write privileges, and monitor writable web-accessible directories for unexpected executable files.

It can be exploitable through the baserCMS administrative interface when the optional BcThemeFile plugin is enabled and the attacker has the required administrator session. The request flow also depends on a same-origin Origin header.

Not necessarily. Session-authenticated requests can still reach the affected functionality, so that setting should not be treated as the sole mitigation.

Decode and canonicalize the path before checking containment, then validate the final resolved path immediately before the file operation. Prefer allowlisted filenames or opaque identifiers where possible.

Apply identical validation to every file operation, test encoded and double-encoded path forms, restrict application write privileges, and monitor writable web-accessible directories for unexpected executable files.

Find out what's already
exploitable in your codebase.