GitHub Advisoryadvisory · Go

GHSA-9rp6-23gf-4c3h syncthing vulnerable to Cross-site Scripting (XSS) in Web GUI

MEDIUM Published 2023-06-06 Modified 2023-06-06 Official page ↗
Aliases
CVE-2022-46165
Ecosystem
Go
Packages
github.com/syncthing/syncthing
Severity
Moderate
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:N
Weaknesses
CWE-79
Reviewed
2023-06-06

Affected packages

• Go github.com/syncthing/syncthing: < 1.23.5 → fixed in 1.23.5

Description

Impact 1. 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. 2. Adding a new device with a malicious name could embed HTML or JavaScript inside parts of the page. 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 `````` and sync it to the other instance. • Move your mouse over the latest change to trigger the tooltip. Web browser source ```html @ 2022-11-30 16:58:43" aria-describedby="tooltip409527"> " ng-if="!folderStats[folder.id].lastFile.deleted" class="ng-scope">Updated "&gt;&lt;img src=a onerror=alert(123)&gt; \"&gt; @ 2022-11-30 16:58:43 ``` Corresponding code in the project File ````gui/default/index.html````: ```html &nbsp;Latest Change Updated {%file%} Deleted {%file%} ``` File ````gui/default/syncthing/core/tooltipDirective.js````: ```javascript 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"'>Headlinealert(1)```. • 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 ```html Headlinealert(1) " ng-bind-html="sharesFolder(folder)" class="ng-binding" aria-describedby="tooltip348410">fedora 1"'&gt;Headline fedora 1"'&gt;Headline alert(1) ``` Corresponding code in the project File ````gui/default/index.html````: ```html &nbsp;Shared With (1' + ('The remote device has not accepted sharing this folder.' | translate) + ')' : ''}} {{folderHasPausedDevices(folder) ? '(2' + ('The remote device has paused this folder.' | translate) + ')' : ''}}" ng-bind-html="sharesFolder(folder)"> ``` File ````gui/default/syncthing/core/tooltipDirective.js````: ```javascript 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"

Related

Alias · CVE (1)

  • CVE-2022-46165 Syncthing is an open source, continuous file synchronization program. vulnerability

Weakness · CWE (1)

  • CWE-79 Improper Neutralization of Input During Web Page Generation weakness

References