Skip to content

Fixed CVE-2023-2318 DOM-based XSS in MarkText bug - #3621

Closed
Teloshav wants to merge 1 commit into
marktext:developfrom
Teloshav:hotfix-v0.17.1
Closed

Teloshav wants to merge 1 commit into
marktext:developfrom
Teloshav:hotfix-v0.17.1

Conversation

@Teloshav

@Teloshav Teloshav commented May 7, 2023 •

Copy link
Copy Markdown
Q A
Bug fix? yes
New feature? no
Breaking changes? no
Deprecations? no
New tests added? not needed
Fixed tickets Fixes #3618
License MIT

Description

In ticket #3618 there was a DOM-based XSS which allowed "arbitrary JavaScript code to run in the context of MarkText main window." (quoted from @chromium1337, the author of ticket #3618), I also updated caniuse-lite while getting the build to work, not exactly sure what that does; but there you go! 😁

Edit: Seems like my fix won't allow for link pasting now that I've just tried it. I'll have to see what is happening with that.

@Teloshav

Copy link
Copy Markdown
Author

Edit: Seems like my fix won't allow for link pasting now that I've just tried it. I'll have to see what is happening with that.

} else {
const span = document.createElement('span')
span.innerHTML = text
span.innerHTML = sanitize(title, PREVIEW_DOMPURIFY_CONFIG, true)

@Limatucano Limatucano Jun 13, 2023 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question: shouldn't the text where the title is? for example sanitize(text, PREVIEW_DOMPURIFY_CONFIG, true)?

@Jocs

Jocs commented May 11, 2026

Copy link
Copy Markdown
Member

@Teloshav pls resolve the conflicts

@Jocs

Jocs commented May 15, 2026

Copy link
Copy Markdown
Member

This project recently merged a large refactor (electron-vite migration, PR #4001) that upgraded dependencies and fixed several issues.

Please review this PR and let us know if it is still needed, or if the changes have already been addressed upstream.

Note: This PR currently has merge conflicts with the develop branch. If you decide to continue with this PR, please rebase or merge the latest develop branch to resolve the conflicts before it can be reviewed.

@Jocs

Jocs commented May 20, 2026

Copy link
Copy Markdown
Member

Thank you for the contribution and for reporting CVE-2023-2318. After review, this change is no longer needed: pasted HTML is already sanitized via DOMPurify in src/muya/lib/contentState/pasteCtrl.js (sanitize(rawHtml, PREVIEW_DOMPURIFY_CONFIG, false) and related calls). In addition, the project has migrated from yarn to pnpm, so the yarn.lock changes no longer apply.

Closing for now to keep the PR queue tidy. If you find a sanitization gap on the current develop branch, please feel free to open a new security report or PR — we'd be happy to review it.

@Jocs Jocs closed this May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security Issue: DOM-Based XSS leading to RCE

3 participants