# CVE-2022-46165: Cross-site Scripting (XSS) in Web GUI in syncthing

> Attackers can execute arbitrary scripts in the Syncthing web interface via malicious file names, potentially altering settings or adding devices.

- **Severity:** Medium 4.6 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:N`)
- **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:** 6 Jun 2023
- **Updated:** 13 Feb 2025
- **Also known as:** BIT-syncthing-2022-46165, DEBIAN-CVE-2022-46165, GHSA-9rp6-23gf-4c3h, UBUNTU-CVE-2022-46165, openSUSE-SU-2023:0126-1, openSUSE-SU-2024:12984-1

## What is CVE-2022-46165?

CVE-2022-46165 is a medium-severity cross-site scripting vulnerability in syncthing, published on 6 Jun 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

Syncthing is an open source, continuous file synchronization program. In versions prior to 1.23.5 a compromised instance with shared folders could sync malicious files which contain arbitrary HTML and JavaScript in the name. If the owner of another device looks over the shared folder settings and moves the mouse over the latest sync, a script could be executed to change settings for shared folders or add devices automatically. Additionally adding a new device with a malicious name could embed HTML or JavaScript inside parts of the page. As a result the webUI may be subject to a stored cross site scripting attack. This issue has been addressed in version 1.23.5. Users are advised to upgrade. Users unable to upgrade should avoid sharing folders with untrusted users.

Weakness: CWE-79 (Improper Neutralization of Input During Web Page Generation)

## Which versions are affected by CVE-2022-46165?

3 open source packages ship an affected version, including github.com/syncthing/syncthing and syncthing. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/syncthing/syncthing` | Go | All versions | 1.23.5 |
| `github.com/syncthing/syncthing` | Go | All versions | 1.23.5 |
| `syncthing` | Bitnami | All versions | 1.23.5 |
| `syncthing` | SUSE:Package Hub 15 SP5 | All versions | 1.23.5-bp155.2.3.1 |
| `syncthing` | openSUSE:Leap 15.5 | All versions | 1.23.5-bp155.2.3.1 |
| `syncthing` | openSUSE:Tumbleweed | All versions | 1.23.5-1.1 |

Products: Syncthing Syncthing.

## How do I fix CVE-2022-46165?

Upgrade github.com/syncthing/syncthing to 1.23.5 or later.

## Is CVE-2022-46165 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-46165 exists.

## Other vulnerabilities in syncthing

- [CVE-2021-21404](https://insights.sbomify.com/CVE-2021-21404/): Crash due to malformed relay protocol message (high 7.5)
- [CVE-2017-1000420](https://insights.sbomify.com/CVE-2017-1000420/): Syncthing vulnerable to symlink traversal and arbitrary file overwrite (high 7.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-46165 and fix it if it is affected.

What it is: CVE-2022-46165 is a medium-severity cross-site scripting vulnerability in syncthing, published on 6 Jun 2023. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-46165 exists.

Affected packages and fixed versions:
- github.com/syncthing/syncthing (Go): affected all versions; fixed in 1.23.5
- github.com/syncthing/syncthing (Go): affected all versions; fixed in 1.23.5
- syncthing (Bitnami): affected all versions; fixed in 1.23.5

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/CVE-2022-46165/ (Markdown: https://insights.sbomify.com/CVE-2022-46165/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2022-46165
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2022-46165
- OSV: https://osv.dev/vulnerability/CVE-2022-46165

---
From sbomify Insights: https://insights.sbomify.com/CVE-2022-46165/
Summaries are generated and may contain mistakes; the official description above is the record.
