# GHSA-75j2-9gmc-m855: 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 other users' browsers, potentially leading to account takeover.

- **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:** 25 Sep 2024

## What is GHSA-75j2-9gmc-m855?

GHSA-75j2-9gmc-m855 is a cross-site scripting vulnerability in camaleon_cms, published on 25 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-75j2-9gmc-m855?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `camaleon_cms` | RubyGems | From 2.8.0 | 2.8.2 |
| `camaleon_cms` | RubyGems | From 2.8.0 | 2.8.2 |

## How do I fix GHSA-75j2-9gmc-m855?

Upgrade camaleon_cms to 2.8.2 or later.

## Is GHSA-75j2-9gmc-m855 being exploited?

There is no known exploitation of GHSA-75j2-9gmc-m855 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-75j2-9gmc-m855 and fix it if it is affected.

What it is: GHSA-75j2-9gmc-m855 is a cross-site scripting vulnerability in camaleon_cms, published on 25 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-75j2-9gmc-m855 in the wild and no public exploit code.

Affected packages and fixed versions:
- camaleon_cms (RubyGems): affected from 2.8.0; fixed in 2.8.2
- camaleon_cms (RubyGems): affected from 2.8.0; fixed in 2.8.2

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-75j2-9gmc-m855/ (Markdown: https://insights.sbomify.com/GHSA-75j2-9gmc-m855/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-75j2-9gmc-m855

---
From sbomify Insights: https://insights.sbomify.com/GHSA-75j2-9gmc-m855/
Summaries are generated and may contain mistakes; the official description above is the record.
