GitHub Advisoryadvisory · RubyGems
GHSA-cp65-5m9r-vc2c Camaleon CMS vulnerable to arbitrary path traversal (GHSL-2024-183)
HIGH
Official page ↗
- Aliases
- CVE-2024-46987
- Ecosystem
- RubyGems
- Packages
- camaleon_cms
- Severity
- High
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
- Weaknesses
- CWE-200, CWE-22
- Reviewed
- 2024-09-18
Affected packages
• RubyGems camaleon_cms: < 2.8.1 → fixed in 2.8.1
Description
A path traversal vulnerability accessible via MediaController's download_private_file method allows authenticated users to download any file on the web server Camaleon CMS is running on (depending on the file permissions).
In the download_private_file method:
```ruby
def download_private_file
cama_uploader.enable_private_mode!
file = cama_uploader.fetch_file("private/#{params[:file]}")
send_file file, disposition: 'inline'
end
```
The file parameter is passed to the fetch_file method of the CamaleonCmsLocalUploader class (when files are uploaded locally):
```ruby
def fetch_file(file_name)
raise ActionController::RoutingError, 'File not found' unless file_exists?(file_name)
file_name
end
```
If the file exists it's passed back to the download_private_file method where the file is sent to the user via send_file.
Proof of concept
An authenticated user can download the /etc/passwd file by visiting an URL such as:
https:///admin/media/download_private_file?file=../../../../../../etc/passwd
Impact
This issue may lead to Information Disclosure.
Remediation
Normalize 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
Related
Alias · CVE (1)
- CVE-2024-46987 Camaleon CMS is a dynamic and advanced content management system based on Ruby on Rails. vulnerability
References
- https://github.com/owen2345/camaleon-cms/security/advisories/GHSA-cp65-5m9r-vc2c web
- https://nvd.nist.gov/vuln/detail/CVE-2024-46987 advisory
- https://github.com/owen2345/camaleon-cms/commit/071b1b09d6d61ab02a5960b1ccafd9d9c2155a3e web
- https://codeql.github.com/codeql-query-help/ruby/rb-path-injection web
- https://github.com/owen2345/camaleon-cms package
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/camaleon_cms/CVE-2024-46987.yml web
- https://owasp.org/www-community/attacks/Path_Traversal web
- https://securitylab.github.com/advisories/GHSL-2024-182_GHSL-2024-186_Camaleon_CMS advisory
- https://www.reddit.com/r/rails/comments/1exwtdm/camaleon_cms_281_has_been_released web