Summary
syncthing vulnerable to Cross-site Scripting (XSS) in Web GUI
Risk
As long as trusted devices are used, the risk is low.
Additionally, the web GUI is not used that often in daily use which reduces the likelihood of exploitation.
Details
1. Field "Latest Change"
- Open the web GUI at http://127.0.0.1:8384/.
- Create/Delete a file named
<img src=a onerror=alert(123)>and sync it to the other instance. - Move your mouse over the latest change to trigger the tooltip.
Web browser source
<span tooltip="" data-original-title="\"><img src=a onerror=alert(123)> @ 2022-11-30 16:58:43"
aria-describedby="tooltip409527">
<!-- ngIf: !folderStats[folder.id].lastFile.deleted --><span translate=""
translate-value-file=""><img src=a onerror=alert(123)>" ng-if="!folderStats[folder.id].lastFile.deleted"
class="ng-scope">Updated "><img src=a onerror=alert(123)></span>
<!-- end ngIf: !folderStats[folder.id].lastFile.deleted -->
<!-- ngIf: folderStats[folder.id].lastFile.deleted -->
</span>
<div class="tooltip fade top in" role="tooltip" id="tooltip409527"
style="top: 446.033px; left: 318.3px; display: block;">
<div class="tooltip-arrow" style="left: 50%;"></div>
<div class="tooltip-inner">\"><img src="a" onerror="alert(123)"> @ 2022-11-30 16:58:43</div>
</div>
Corresponding code in the project
File gui/default/index.html:
<tr ng-if="folder.type != 'sendonly' && folder.type != 'receiveencrypted' && folderStats[folder.id].lastFile && folderStats[folder.id].lastFile.filename">
<th><span class="fas fa-fw fa-exchange-alt"></span> <span translate>Latest Change</span></th>
<td class="text-right">
<span tooltip data-original-title="{{folderStats[folder.id].lastFile.filename}} @ {{folderStats[folder.id].lastFile.at | date:'yyyy-MM-dd HH:mm:ss'}}">
<span translate translate-value-file="{{folderStats[folder.id].lastFile.filename | basename}}" ng-if="!folderStats[folder.id].lastFile.deleted">Updated {%file%}</span>
<span translate translate-value-file="{{folderStats[folder.id].lastFile.filename | basename}}" ng-if="folderStats[folder.id].lastFile.deleted">Deleted {%file%}</span>
</span>
</td>
</tr>
File gui/default/syncthing/core/tooltipDirective.js:
angular.module('syncthing.core')
.directive('tooltip', function () {
return {
restrict: 'A',
link: function (scope, element, attributes) {
$(element).tooltip({
html: 'true'
});
}
};
});
The attribute html should not be set to true or input sanitized.
2. Field "Shared With"
- Open the web GUI at http://127.0.0.1:8384/.
- Create a device with the following name
fedora 1"'><h1>Headline</h1><img src=x><script>alert(1)</script>. - Add the device to another instance and share a folder.
- Move your mouse over the malicious device name to trigger the tooltip.
Web browser source
<span tooltip="" data-original-title="fedora 1"'><h1>Headline</h1><img src=x><script>alert(1)</script> "
ng-bind-html="sharesFolder(folder)" class="ng-binding" aria-describedby="tooltip348410">fedora 1"'><h1>Headline
</h1><img src="x"></span>
<div class="tooltip fade top" role="tooltip" id="tooltip348410" style="top: 0px; left: 0px; display: block;">
<div class="tooltip-arrow" style="left: 50%;"></div>
<div class="tooltip-inner">fedora 1"'><h1>Headline</h1><img src="x">
<script>alert(1)</script>
</div>
</div>
Corresponding code in the project
File gui/default/index.html:
<tr>
<th><span class="fas fa-fw fa-share-alt"></span> <span translate>Shared With</span></th>
<td class="text-right">
<span tooltip data-original-title="{{sharesFolder(folder)}} {{folderHasUnacceptedDevices(folder) ? '<br/>(<sup>1</sup>' + ('The remote device has not accepted sharing this folder.' | translate) + ')' : ''}} {{folderHasPausedDevices(folder) ? '<br/>(<sup>2</sup>' + ('The remote device has paused this folder.' | translate) + ')' : ''}}" ng-bind-html="sharesFolder(folder)"></span>
</td>
</tr>
File gui/default/syncthing/core/tooltipDirective.js:
angular.module('syncthing.core')
.directive('tooltip', function () {
return {
restrict: 'A',
link: function (scope, element, attributes) {
$(element).tooltip({
html: 'true'
});
}
};
});
The attribute html should not be set to true or input sanitized.
HTML Injection in "Edit Folder"
Impact
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.Adding a new device with a malicious name could embed HTML or JavaScript inside parts of the page.
Untrusted input is rendered as active markup in a victim's browser, which can run script in their session. Typical impact: session or credential theft, and actions taken as the user.
CVE-2022-46165 has a CVSS score of 4.6 (Medium). The vector is network-reachable, low privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (1.23.5); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2022-46165? CVE-2022-46165 is a medium-severity cross-site scripting (XSS) vulnerability in github.com/syncthing/syncthing (go), affecting versions < 1.23.5. It is fixed in 1.23.5. Untrusted input is rendered as active markup in a victim's browser, which can run script in their session.
- How severe is CVE-2022-46165? CVE-2022-46165 has a CVSS score of 4.6 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of github.com/syncthing/syncthing are affected by CVE-2022-46165? github.com/syncthing/syncthing (go) versions < 1.23.5 is affected.
- Is there a fix for CVE-2022-46165? Yes. CVE-2022-46165 is fixed in 1.23.5. Upgrade to this version or later.
- Is CVE-2022-46165 exploitable, and should I be worried? Whether CVE-2022-46165 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2022-46165 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2022-46165? Upgrade
github.com/syncthing/syncthingto 1.23.5 or later.