# GHSA-f36p-42jv-8rh2: Lithium vulnerable to Cross Site Scripting in provided Swagger-UI

> An XSS vulnerability in the bundled Swagger-UI allows attackers to achieve remote code execution and exfiltrate secrets in applications using Lithium with Swagger enabled.

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

## What is GHSA-f36p-42jv-8rh2?

GHSA-f36p-42jv-8rh2 is a cross-site scripting vulnerability in com.wire.bots:lithium, published on 30 Sep 2022. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

### Impact
A  XSS vulnerability in the provided (outdated) Swagger-UI is exploitable in applications using lithium with Swagger-UI enabled.
This allows an attacker gain Remote Code Execution (RCE) and potentially exfiltrate secrets in the context of this swagger session.

### Patches
The used swagger-ui was updated by switching to the latest version of dropwizard-swagger in 8b9b406d608fe482ec0e7adf8705834bca92d7df

### Workarounds
The risk of injected external content can be reduced by setting up a [Content-Security-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy).

### References
* https://www.vidocsecurity.com/blog/hacking-swagger-ui-from-xss-to-account-takeovers/

### Credits
We thank [Mohit Kumar](https://www.linkedin.com/in/mohit-kumar-4ab6b3bb) for reporting this vulnerability!

## Which versions are affected by GHSA-f36p-42jv-8rh2?

4 open source packages ship an affected version, including com.wire.bots:lithium and com.wire:lithium.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `com.wire.bots:lithium` | Maven | All versions | None |
| `com.wire.bots:lithium` | Maven | All versions | None |
| `com.wire:lithium` | Maven | All versions | 3.4.2 |
| `com.wire:lithium` | Maven | All versions | 3.4.2 |

## How do I fix GHSA-f36p-42jv-8rh2?

Upgrade to a fixed version.

## Is GHSA-f36p-42jv-8rh2 being exploited?

There is no known exploitation of GHSA-f36p-42jv-8rh2 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-f36p-42jv-8rh2 and fix it if it is affected.

What it is: GHSA-f36p-42jv-8rh2 is a cross-site scripting vulnerability in com.wire.bots:lithium, published on 30 Sep 2022. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of GHSA-f36p-42jv-8rh2 in the wild and no public exploit code.

Affected packages and fixed versions:
- com.wire.bots:lithium (Maven): affected all versions; no fix listed
- com.wire.bots:lithium (Maven): affected all versions; no fix listed
- com.wire:lithium (Maven): affected all versions; fixed in 3.4.2
- com.wire:lithium (Maven): affected all versions; fixed in 3.4.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-f36p-42jv-8rh2/ (Markdown: https://insights.sbomify.com/GHSA-f36p-42jv-8rh2/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-f36p-42jv-8rh2

---
From sbomify Insights: https://insights.sbomify.com/GHSA-f36p-42jv-8rh2/
Summaries are generated and may contain mistakes; the official description above is the record.
