(CVE-2023-2318) MarkText DOM-Based Cross-site Scripting leading to Remote Code Execution
MarkText 0.17.1 and earlier contains a DOM-based cross-site scripting flaw in its paste handling code. If a user copies text from a malicious webpage and pastes it into MarkText, arbitrary JavaScript can run in the main window, which the report says can lead to remote code execution.
starlabs.sg
Published on starlabs.sg
MarkText is a free and open-source Markdown editor for Windows, macOS, and Linux. It provides a distraction-free writing environment that supports various Markdown features, such as tables, footnotes, and task lists.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the paste handler in the editor's content state did not sanitise pasted HTML before inserting it into the page, so script content from the clipboard was executed.
What the attacker needed
MarkText 0.17.1 or earlier; victim copies text from a malicious page; victim pastes it into MarkText
How it was found
- Open a malicious webpage that contains text designed to trigger the flaw.
- Copy that text from the webpage.
- Paste the copied text into MarkText 0.17.1.
- The pasted content causes JavaScript to run in the MarkText main window.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
MarkText is a desktop markdown editor. When you copy text from a website and paste it into the editor, the editor is supposed to treat it as plain text. Here it did not, so a malicious website could sneak in a small script that runs inside the editor and then, according to the report, take over the computer.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.