# GHSA-hjx6-f647-mvf9: Invenio-Communities has a Cross-Site Scripting (XSS) vulnerability in React components

> Attackers can inject scripts via affiliation fields to steal cookies from users viewing community members, requiring an upgrade to patched versions.

- **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:** 12 Jun 2024

## What is GHSA-hjx6-f647-mvf9?

GHSA-hjx6-f647-mvf9 is a cross-site scripting vulnerability in invenio-communities, published on 12 Jun 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

# Impact

We have identified a Cross-Site Scripting (XSS) vulnerability within certain React components related to community members in the Invenio-Communities module. This vulnerability enables a user to inject a script tag into the Affiliations field during the account registration process. The malicious script is executed when the user creates a new community and is listed as a public member.

The script is triggered whenever any user visits the Members section of any community that includes the compromised user. This can potentially allow the attacker to access personal information, such as cookies, of the visiting user.

# Patches
The problem has been patched in [v7.8.0](https://github.com/inveniosoftware/invenio-communities/releases/tag/v7.8.0). Patches also have been backported in versions [v4.2.2](https://github.com/inveniosoftware/invenio-communities/tree/v4.2.2) and [v2.8.11](https://github.com/inveniosoftware/invenio-communities/tree/v2.8.11).

# Credits

Thanks to [Twitter.com/AliGoodLuck11](https://x.com/AliGoodLuck11)  for reporting the vulnerability with a detailed description on how to reproduce it!

# For more information
If you have any questions or comments about this advisory:

Email us at [info@inveniosoftware.org](mailto:info@inveniosoftware.org)

## Which versions are affected by GHSA-hjx6-f647-mvf9?

6 open source packages ship an affected version, including invenio-communities.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `invenio-communities` | PyPI | All versions | 2.8.11 |
| `invenio-communities` | PyPI | All versions | 2.8.11 |
| `invenio-communities` | PyPI | From 3.0.0 | 4.2.2 |
| `invenio-communities` | PyPI | From 3.0.0 | 4.2.2 |
| `invenio-communities` | PyPI | From 5.0.0 | 7.8.0 |
| `invenio-communities` | PyPI | From 5.0.0 | 7.8.0 |

## How do I fix GHSA-hjx6-f647-mvf9?

Upgrade invenio-communities to a fixed version for your release line: 2.8.11, 4.2.2 or 7.8.0.

## Is GHSA-hjx6-f647-mvf9 being exploited?

There is no known exploitation of GHSA-hjx6-f647-mvf9 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-hjx6-f647-mvf9 and fix it if it is affected.

What it is: GHSA-hjx6-f647-mvf9 is a cross-site scripting vulnerability in invenio-communities, published on 12 Jun 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-hjx6-f647-mvf9 in the wild and no public exploit code.

Affected packages and fixed versions:
- invenio-communities (PyPI): affected all versions; fixed in 2.8.11
- invenio-communities (PyPI): affected all versions; fixed in 2.8.11
- invenio-communities (PyPI): affected from 3.0.0; fixed in 4.2.2
- invenio-communities (PyPI): affected from 3.0.0; fixed in 4.2.2
- invenio-communities (PyPI): affected from 5.0.0; fixed in 7.8.0
- invenio-communities (PyPI): affected from 5.0.0; fixed in 7.8.0

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-hjx6-f647-mvf9/ (Markdown: https://insights.sbomify.com/GHSA-hjx6-f647-mvf9/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-hjx6-f647-mvf9

---
From sbomify Insights: https://insights.sbomify.com/GHSA-hjx6-f647-mvf9/
Summaries are generated and may contain mistakes; the official description above is the record.
