CVE-2026-31876
Stored XSS in Notesnook Editor via Unsafe Twitter Embed URLs
Publication date: 2026-03-11
Last updated on: 2026-03-17
Assigner: GitHub, Inc.
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| streetwriters | notesnook_desktop | to 3.3.9 (exc) |
| streetwriters | notesnook_mobile | to 3.3.15 (exc) |
| streetwriters | notesnook_mobile | to 3.3.15 (exc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-79 | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
[{'type': 'paragraph', 'content': "CVE-2026-31876 is a Stored Cross-Site Scripting (XSS) vulnerability in the Notesnook note-taking app's editor embed component. It occurs when rendering Twitter/X embed URLs because the tweetToEmbed() function directly inserts user-supplied URLs into an HTML string without proper escaping. This string is then assigned to the srcdoc attribute of an iframe, allowing malicious code to be executed if a specially crafted URL is used."}, {'type': 'paragraph', 'content': "The vulnerability arises from unsafe string interpolation of the URL, which can bypass hostname checks and inject malicious markup into the iframe. This can lead to arbitrary script execution in the victim's browser when they open a note containing the malicious embed."}, {'type': 'paragraph', 'content': "The issue was fixed by changing the code to safely encode the URL using a temporary anchor element's href property and using its outerHTML, preventing injection of malicious markup."}] [2, 1]
How can this vulnerability impact me? :
This vulnerability can allow an attacker to execute arbitrary scripts in your browser when you open a note containing a maliciously crafted Twitter/X embed URL. This can lead to unauthorized actions such as stealing sensitive information, session hijacking, or other malicious activities within the context of the Notesnook app.
The attack requires the victim to open or render the malicious note, and it exploits weaknesses in iframe sandboxing and lack of proper Content Security Policy (CSP) in some environments.
Because the vulnerability has a moderate severity with a CVSS score of 5.4, it represents a significant risk especially in environments where sensitive data is handled or where users might be tricked into opening malicious notes.
How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:
I don't know
How can this vulnerability be detected on my network or system? Can you suggest some commands?
[{'type': 'paragraph', 'content': 'This vulnerability can be detected by identifying if your Notesnook installation is running a version prior to 3.3.9 on Web/Desktop or prior to 3.3.15 on Android/iOS, as these versions contain the vulnerable code.'}, {'type': 'paragraph', 'content': 'Additionally, detection can involve searching for notes containing suspicious or specially crafted Twitter/X embed URLs that attempt to inject malicious markup, such as URLs containing payloads like: https://twitter.com/"><img src=x onerror="alert(document.domain)" /><a x=".'}, {'type': 'paragraph', 'content': 'Since the vulnerability involves the unsafe interpolation of user-supplied URLs into iframe srcdoc attributes, monitoring or scanning notes for such embedded URLs or iframe srcdoc attributes with unescaped user input can help detect exploitation attempts.'}, {'type': 'paragraph', 'content': 'Specific commands are not provided in the resources, but you might consider using grep or similar tools to search your Notesnook data storage for suspicious embed URLs or iframe srcdoc attributes containing unescaped user input.'}] [2]
What immediate steps should I take to mitigate this vulnerability?
The immediate step to mitigate this vulnerability is to upgrade your Notesnook application to version 3.3.9 or later on Web/Desktop, or 3.3.15 or later on Android/iOS, where the vulnerability has been fixed.
The fix involves proper escaping and sanitization of Twitter embed URLs in the editor component, preventing unsafe string interpolation and thus blocking the XSS attack vector.
If upgrading immediately is not possible, consider restricting or disabling the use of Twitter/X embed URLs in notes, and ensure that your deployment has a properly configured Content Security Policy (CSP) to limit script execution from untrusted sources.