Skip to content
XSS Write-up Intermediate

(CVE-2023-2317) Typora DOM-Based Cross-site Scripting leading to Remote Code Execution

Typora's updater page contained a DOM-based cross-site scripting flaw, so a crafted markdown file could run arbitrary JavaScript in the context of the main window. Because the app runs with elevated privileges, this could lead to remote code execution on the user's machine.

starlabs.sg

Published on starlabs.sg

Typora is a popular cross-platform markdown editor that allows users to create and edit markdown files with a real-time preview feature. It supports various formatting options such as headings, bold, italics, and more.

The author, on starlabs.sg

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 updater page inserted attacker-controlled markdown content into the page without proper sanitisation, allowing script to execute in the main window context.

Impact

An attacker could run arbitrary JavaScript in the main window and, because the app runs with elevated privileges, potentially achieve remote code execution on the victim's machine.

What the attacker needed

Victim opens a malicious markdown file; or pastes text from a malicious page; Typora before 1.6.7 on Windows or Linux

How it was found

  1. Open a malicious markdown file in Typora, or copy text from a malicious webpage and paste it into Typora.
  2. The crafted content is loaded through the typora://app/typemark/updater/update.html path in a tag.
  3. Arbitrary JavaScript runs in the context of the Typora 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.

Typora is a markdown editor. A flaw meant that text inside a markdown file could be treated as code by the app's own built-in page, so opening a malicious file could let an attacker run their own instructions on your computer. This is called cross-site scripting, where a program runs input it should have treated as plain text.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.