Skip to content
XSS Disclosed report Intermediate CVE-2023-48302

Self XSS when pasting HTML into Text app with Ctrl+Shift+V

The paste-as-plaintext shortcut in the Text app inserts clipboard content into a DOM element's innerHTML before sanitising it, so HTML in the clipboard is rendered. An attacker who can get a victim to paste attacker-controlled content with that shortcut could inject HTML and potentially run script.

max_nextcloud Follow

Originally disclosed on HackerOne

Medium 4.6 View original
  • Triaged in under an hour
  • Fixed in 35 days
  • Disclosed after 2 months

Summary by the program

Security advisory at https://github.com/nextcloud/security-advisories/security/advisories/GHSA-p7g9-x25m-4h87

The report

Summary:

ctrl-shift-v is meant to paste plaintext as is. However it will paste it into a dom elements innerHtml and can thus be used to inject malicious html.

Steps To Reproduce:

  1. copy "<h1>html</h1>"
  2. use ctrl-shift-v to paste it into a .md file
  3. See the heading getting added.

Supporting Material/References:

https://github.com/nextcloud/text/blob/main/src/extensions/Markdown.js#L97

  • [attachment / reference]

Impact

If you can trick someone into using ctrl-shift-v to paste content you control you can insert html into the page leading to a possible xss attack.

The html will be inserted into the editors schema - but before that happens it's already pasted into the innerHtml of a dom element.

The original report as published on HackerOne, by max_nextcloud. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the paste handler writes clipboard content to a DOM element's innerHTML before the editor's schema sanitises it.

Impact

If a victim is tricked into pasting attacker-controlled content with the shortcut, HTML could be injected into the page, leading to a possible cross-site scripting attack.

What the attacker needed

Victim uses the paste-as-plaintext shortcut; attacker controls clipboard content

How it was found

  1. Copy a snippet of HTML markup to the clipboard.
  2. Use the paste-as-plaintext shortcut to paste it into a markdown file in the Text app.
  3. Observe that the HTML is rendered as an element rather than shown as text.

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 report has not been written yet. The Original tab links to the source.

When you copy text and paste it with a special shortcut meant to keep it as plain text, the app still treats part of it as web page code. That means HTML tags in what you copied get turned into real page elements instead of being shown as text. If an attacker can get you to paste their content this way, they might be able to run code in your browser.

What is XSS?

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

More from Nextcloud

View all

The newest disclosed reports for this program.

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.