# GHSA-hc5c-r8m5-2gfh: plone.restapi vulnerable to Stored Cross Site Scripting with SVG image in user portrait

> An attacker can execute arbitrary scripts in victim browsers by uploading a malicious SVG as a user portrait, requiring the victim to view the profile.

- **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:** 21 Sep 2023

## What is GHSA-hc5c-r8m5-2gfh?

GHSA-hc5c-r8m5-2gfh is a cross-site scripting vulnerability in plone-restapi, published on 21 Sep 2023. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.

### Official description

### Impact
There is a stored cross site scripting vulnerability for SVG images uploaded in user portraits.

Note that a page that uses an image tag with an SVG image as source is never vulnerable, even when the SVG image contains malicious code. To exploit the vulnerability, an attacker would first need to upload an SVG image as user portrait, and then trick a user into following a link to this portrait.

### Patches
A patch will be released in `plone.restapi` 8.43.3. This version is good for Plone 6.0, and for Plone 5.2 on Python 3.

In `plone.restapi` 7 or earlier there was no `@portrait` endpoint yet, so there is nothing to fix in that version. It is still vulnerable to this attack, and needs a [fix in Zope 4](https://github.com/zopefoundation/Zope/security/advisories/GHSA-wm8q-9975-xh5v). These two vulnerabilities share the same CVE: CVE-2023-42458.

### Workarounds
You could remove the portrait field from the member data schema, and possibly remove all portraits that are already in the database, but this seems a bit drastic.

## Which versions are affected by GHSA-hc5c-r8m5-2gfh?

2 open source packages ship an affected version, including plone-restapi and plone.restapi.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `plone-restapi` | PyPI | From 8.0.0 | 8.43.3 |
| `plone.restapi` | PyPI | From 8.0.0 | 8.43.3 |

## How do I fix GHSA-hc5c-r8m5-2gfh?

Upgrade plone-restapi to 8.43.3 or later.

## Is GHSA-hc5c-r8m5-2gfh being exploited?

There is no known exploitation of GHSA-hc5c-r8m5-2gfh in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-hc5c-r8m5-2gfh and fix it if it is affected.

What it is: GHSA-hc5c-r8m5-2gfh is a cross-site scripting vulnerability in plone-restapi, published on 21 Sep 2023. 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-hc5c-r8m5-2gfh in the wild and no public exploit code.

Affected packages and fixed versions:
- plone-restapi (PyPI): affected from 8.0.0; fixed in 8.43.3
- plone.restapi (PyPI): affected from 8.0.0; fixed in 8.43.3

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-hc5c-r8m5-2gfh/ (Markdown: https://insights.sbomify.com/GHSA-hc5c-r8m5-2gfh/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-hc5c-r8m5-2gfh

---
From sbomify Insights: https://insights.sbomify.com/GHSA-hc5c-r8m5-2gfh/
Summaries are generated and may contain mistakes; the official description above is the record.
