# GHSA-8fx8-3rg2-79xw: Camaleon CMS vulnerable to stored XSS through user file upload (GHSL-2024-184)

> Authenticated users can upload malicious SVG or HTML files to execute JavaScript in victim browsers, potentially leading to account takeover or content modification.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 23 Sep 2024

## What is GHSA-8fx8-3rg2-79xw?

GHSA-8fx8-3rg2-79xw is a cross-site scripting vulnerability in camaleon_cms, published on 23 Sep 2024. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.

### Official description

A stored cross-site scripting has been found in the image upload functionality that can be used by normal registered users: It is possible to upload a SVG image containing JavaScript and it's also possible to upload a HTML document when the format parameter is manually changed to [documents][1] or a string of an [unsupported format][2]. If an authenticated user or administrator visits that uploaded image or document malicious JavaScript can be executed on their behalf
(e.g. changing or deleting content inside of the CMS.)

[1]: https://github.com/owen2345/camaleon-cms/blob/feccb96e542319ed608acd3a16fa5d92f13ede67/app/uploaders/camaleon_cms_uploader.rb#L105-L106
[2]: https://github.com/owen2345/camaleon-cms/blob/feccb96e542319ed608acd3a16fa5d92f13ede67/app/uploaders/camaleon_cms_uploader.rb#L110-L111

## Impact

This issue may lead to account takeover due to reflected Cross-site scripting (XSS).

## Remediation

Only allow the upload of safe files such as PNG, TXT and others or serve all "unsafe" files such as SVG and other files with a content-disposition: attachment header, which should prevent browsers from displaying them.

Additionally, a [Content security policy (CSP)][3] can be created that disallows inlined script. (Other parts of the application might need modification to continue functioning.)

[3]: https://web.dev/articles/csp

To prevent the theft of the auth_token it could be marked with HttpOnly. This would however not prevent that actions could be performed as the authenticated user/administrator. Furthermore, it could make sense to use the authentication provided by Ruby on Rails, so that stolen tokens cannot be used anymore after some time.

## Which versions are affected by GHSA-8fx8-3rg2-79xw?

2 open source packages ship an affected version, including camaleon_cms.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `camaleon_cms` | RubyGems | All versions | 2.8.1 |
| `camaleon_cms` | RubyGems | All versions | 2.8.1 |

## How do I fix GHSA-8fx8-3rg2-79xw?

Upgrade camaleon_cms to 2.8.1 or later.

## Is GHSA-8fx8-3rg2-79xw being exploited?

There is no known exploitation of GHSA-8fx8-3rg2-79xw in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-8fx8-3rg2-79xw and fix it if it is affected.

What it is: GHSA-8fx8-3rg2-79xw is a cross-site scripting vulnerability in camaleon_cms, published on 23 Sep 2024. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of GHSA-8fx8-3rg2-79xw in the wild and no public exploit code.

Affected packages and fixed versions:
- camaleon_cms (RubyGems): affected all versions; fixed in 2.8.1
- camaleon_cms (RubyGems): affected all versions; fixed in 2.8.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-8fx8-3rg2-79xw/ (Markdown: https://insights.sbomify.com/GHSA-8fx8-3rg2-79xw/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-8fx8-3rg2-79xw

---
From sbomify Insights: https://insights.sbomify.com/GHSA-8fx8-3rg2-79xw/
Summaries are generated and may contain mistakes; the official description above is the record.
