CVE-2018-1000534 (published 2018-06-26T16:29Z)

Joplin version prior to 1.0.90 contains a XSS evolving into code execution due to enabled nodeIntegration for that particular BrowserWindow instance where XSS was identified from vulnerability in Note content field - information on the fix can be found here https://github.com/laurent22/joplin/commit/494e235e18659574f836f84fcf9f4d4fcdcfcf89 that can result in executing unauthorized code within the rights in which the application is running. This attack appear to be exploitable via Victim synchronizing notes from the cloud services or other note-keeping services which contain malicious code. This vulnerability appears to have been fixed in 1.0.90 and later.

Severity: MEDIUM
CVSS v2 base score: 4.3 (AV:N/AC:M/Au:N/C:N/I:P/A:N)
CVSS v3 base score: 6.1, MEDIUM (CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N)

Weakness information:
cwe_id: CWE-79
cwe_name: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
description: 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.
extended_description: 
            Cross-site scripting (XSS) vulnerabilities occur when:
            
               Untrusted data enters a web application, typically from a web request.
               The web application dynamically generates a web page that contains this untrusted data.
               During page generation, the application does not prevent the data from containing content that is executable by a web browser, such as JavaScript, HTML tags, HTML attributes, mouse events, Flash, ActiveX, etc.
               A victim visits the generated web page through a web browser, which contains malicious script that was injected using the untrusted data.
               Since the script comes from a web page that was sent by the web server, the victim's web browser executes the malicious script in the context of the web server's domain.
               This effectively violates the intention of the web browser's same-origin policy, which states that scripts in one domain should not be able to access resources or run code in a different domain.
            
            There are three main kinds of XSS:
            
               
                  Type 1: Reflected XSS (or Non-Persistent) - 
         			The server reads data directly from the HTTP request and reflects it back in the HTTP response. Reflected XSS exploits occur when an attacker causes a victim to supply dangerous content to a vulnerable web application, which is then reflected back to the victim and executed by the web browser. The most common mechanism for delivering malicious content is to include it as a parameter in a URL that is posted publicly or e-mailed directly to the victim. URLs constructed in this manner constitute the core of many phishing schemes, whereby an attacker convinces a victim to visit a URL that refers to a vulnerable site. After the site reflects the attacker's content back to the victim, the content is executed by the victim's browser.
               
                  Type 2: Stored XSS (or Persistent) - 
               The application stores dangerous data in a database, message forum, visitor log, or other trusted data store. At a later time, the dangerous data is subsequently read back into the application and included in dynamic content. From an attacker's perspective, the optimal place to inject malicious content is in an area that is displayed to either many users or particularly interesting users. Interesting users typically have elevated privileges in the application or interact with sensitive data that is valuable to the attacker. If one of these users executes malicious content, the attacker may be able to perform privileged operations on behalf of the user or gain access to sensitive data belonging to the user. For example, the attacker might inject XSS into a log message, which might not be handled properly when an administrator views the logs.
            
               
                  Type 0: DOM-Based XSS - 
               In DOM-based XSS, the client performs the injection of XSS into the page; in the other types, the server performs the injection. DOM-based XSS generally involves server-controlled, trusted script that is sent to the client, such as Javascript that performs sanity checks on a form before the user submits it. If the server-supplied script processes user-supplied data and then injects it back into the web page (such as with dynamic HTML), then DOM-based XSS is possible.
            
            
            Once the malicious script is injected, the attacker can perform a variety of malicious activities. The attacker could transfer private information, such as cookies that may include session information, from the victim's machine to the attacker. The attacker could send malicious requests to a web site on behalf of the victim, which could be especially dangerous to the site if the victim has administrator privileges to manage that site. Phishing attacks could be used to emulate trusted web sites and trick the victim into entering a password, allowing the attacker to compromise the victim's account on that web site. Finally, the script could exploit a vulnerability in the web browser itself possibly taking over the victim's machine, sometimes referred to as "drive-by hacking."
            In many cases, the attack can be launched without the victim even being aware of it. Even with careful users, attackers frequently use a variety of methods to encode the malicious portion of the attack, such as URL encoding or Unicode, so the request looks less suspicious.
         
         

Fix information:
repo_url: https://github.com/laurent22/joplin
commit_details: repo_url: https://github.com/laurent22/joplin
author: Laurent Cozic
author_date: 2018-05-09 16:59:33+01:00
msg: Electron: Resolves #500: Fixed XSS security vulnerability
repository: repo_url: https://github.com/laurent22/joplin
repo_name: laurent22/joplin
description: Joplin - the secure note taking and to-do app with synchronisation capabilities for Windows, macOS, Linux, Android and iOS.
repo_language: TypeScript
owner: laurent22
file_changes: filename: README.md
change_type: ModificationType.MODIFY
diff: @@ -253,6 +253,10 @@ Checkboxes can be added like so:
 
 The checkboxes can then be ticked in the mobile and desktop applications.
 
+## HTML support
+
+Only the `<br>` tag is supported - it can be used to force a new line, which is convenient to insert new lines inside table cells. For security reasons, other HTML tags are not supported.
+
 # Donations
 
 Donations to Joplin support the development of the project. Developing quality applications mostly takes time, but there are also some expenses, such as digital certificates to sign the applications, app store fees, hosting, etc. Most of all, your donation will make it possible to keep up the current development standard.

programming_language: Markdown
filename: MdToHtml.js
change_type: ModificationType.MODIFY
diff: @@ -389,7 +389,7 @@ class MdToHtml {
 		const md = new MarkdownIt({
 			breaks: true,
 			linkify: true,
-			html: true,
+			html: false, // For security, HTML tags are not supported - https://github.com/laurent22/joplin/issues/500
 		});
 
 		// This is currently used only so that the $expression$ and $$\nexpression\n$$ blocks are translated
@@ -435,6 +435,9 @@ class MdToHtml {
 			}
 		}
 
+		// Support <br> tag to allow newlines inside table cells
+		renderedBody = renderedBody.replace(/&lt;br&gt;/gi, '<br>');
+
 		// https://necolas.github.io/normalize.css/
 		const normalizeCss = `
 			html{line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}

programming_language: JavaScript
filename: index.html
change_type: ModificationType.MODIFY
diff: @@ -454,6 +454,8 @@ $$
 - [ ] Rice
 - [ ] Eggs
 </code></pre><p>The checkboxes can then be ticked in the mobile and desktop applications.</p>
+<h2 id="html-support">HTML support</h2>
+<p>Only the <code>&lt;br&gt;</code> tag is supported - it can be used to force a new line, which is convenient to insert new lines inside table cells. For security reasons, other HTML tags are not supported.</p>
 <h1 id="donations">Donations</h1>
 <p>Donations to Joplin support the development of the project. Developing quality applications mostly takes time, but there are also some expenses, such as digital certificates to sign the applications, app store fees, hosting, etc. Most of all, your donation will make it possible to keep up the current development standard.</p>
 <p>Please see the <a href="https://joplin.cozic.net/donate/">donation page</a> for information on how to support the development of Joplin.</p>
@@ -499,14 +501,14 @@ $$
 <td><img src="https://joplin.cozic.net/images/flags/country-4x3/hr.png" alt=""></td>
 <td>Croatian</td>
 <td><a href="https://github.com/laurent22/joplin/blob/master/CliClient/locales/hr_HR.po">hr_HR</a></td>
-<td>Hrvoje Mandić <a href="&#109;&#x61;&#x69;&#x6c;&#x74;&#x6f;&#x3a;&#116;&#x72;&#98;&#117;&#104;&#x6f;&#109;&#64;&#110;&#x65;&#116;&#x2e;&#104;&#114;">&#116;&#x72;&#98;&#117;&#104;&#x6f;&#109;&#64;&#110;&#x65;&#116;&#x2e;&#104;&#114;</a></td>
+<td>Hrvoje Mandić <a href="&#109;&#x61;&#105;&#x6c;&#116;&#x6f;&#x3a;&#116;&#x72;&#x62;&#x75;&#x68;&#111;&#x6d;&#x40;&#x6e;&#x65;&#116;&#46;&#x68;&#x72;">&#116;&#x72;&#x62;&#x75;&#x68;&#111;&#x6d;&#x40;&#x6e;&#x65;&#116;&#46;&#x68;&#x72;</a></td>
 <td>61%</td>
 </tr>
 <tr>
 <td><img src="https://joplin.cozic.net/images/flags/country-4x3/cz.png" alt=""></td>
 <td>Czech</td>
 <td><a href="https://github.com/laurent22/joplin/blob/master/CliClient/locales/cs_CZ.po">cs_CZ</a></td>
-<td>Lukas Helebrandt <a href="&#109;&#x61;&#x69;&#x6c;&#x74;&#x6f;&#x3a;&#108;&#x75;&#x6b;&#97;&#x73;&#x40;&#x61;&#x69;&#121;&#97;&#46;&#x63;&#x7a;">&#108;&#x75;&#x6b;&#97;&#x73;&#x40;&#x61;&#x69;&#121;&#97;&#46;&#x63;&#x7a;</a></td>
+<td>Lukas Helebrandt <a href="&#x6d;&#x61;&#105;&#108;&#116;&#x6f;&#x3a;&#108;&#117;&#x6b;&#x61;&#115;&#64;&#97;&#x69;&#121;&#97;&#46;&#99;&#122;">&#108;&#117;&#x6b;&#x61;&#115;&#64;&#97;&#x69;&#121;&#97;&#46;&#99;&#122;</a></td>
 <td>95%</td>
 </tr>
 <tr>
@@ -520,7 +522,7 @@ $$
 <td><img src="https://joplin.cozic.net/images/flags/country-4x3/de.png" alt=""></td>
 <td>Deutsch</td>
 <td><a href="https://github.com/laurent22/joplin/blob/master/CliClient/locales/de_DE.po">de_DE</a></td>
-<td>Philipp Zumstein <a href="&#x6d;&#97;&#x69;&#108;&#x74;&#x6f;&#x3a;&#122;&#x75;&#x70;&#104;&#105;&#108;&#105;&#x70;&#64;&#103;&#109;&#97;&#x69;&#x6c;&#46;&#x63;&#111;&#x6d;">&#122;&#x75;&#x70;&#104;&#105;&#108;&#105;&#x70;&#64;&#103;&#109;&#97;&#x69;&#x6c;&#46;&#x63;&#111;&#x6d;</a></td>
+<td>Philipp Zumstein <a href="&#x6d;&#x61;&#105;&#108;&#x74;&#x6f;&#58;&#122;&#117;&#x70;&#104;&#x69;&#108;&#x69;&#x70;&#64;&#x67;&#109;&#x61;&#x69;&#x6c;&#x2e;&#x63;&#x6f;&#x6d;">&#122;&#117;&#x70;&#104;&#x69;&#108;&#x69;&#x70;&#64;&#x67;&#109;&#x61;&#x69;&#x6c;&#x2e;&#x63;&#x6f;&#x6d;</a></td>
 <td>98%</td>
 </tr>
 <tr>
@@ -534,7 +536,7 @@ $$
 <td><img src="https://joplin.cozic.net/images/flags/country-4x3/es.png" alt=""></td>
 <td>Español</td>
 <td><a href="https://github.com/laurent22/joplin/blob/master/CliClient/locales/es_ES.po">es_ES</a></td>
-<td>Fernando Martín <a href="&#x6d;&#x61;&#x69;&#x6c;&#x74;&#x6f;&#x3a;&#102;&#64;&#x6d;&#114;&#116;&#x6e;&#x2e;&#101;&#115;">&#102;&#64;&#x6d;&#114;&#116;&#x6e;&#x2e;&#101;&#115;</a></td>
+<td>Fernando Martín <a href="&#x6d;&#97;&#105;&#x6c;&#116;&#111;&#58;&#102;&#64;&#109;&#x72;&#116;&#110;&#46;&#x65;&#x73;">&#102;&#64;&#109;&#x72;&#116;&#110;&#46;&#x65;&#x73;</a></td>
 <td>99%</td>
 </tr>
 <tr>
@@ -548,7 +550,7 @@ $$
 <td><img src="https://joplin.cozic.net/images/flags/country-4x3/es.png" alt=""></td>
 <td>Galician</td>
 <td><a href="https://github.com/laurent22/joplin/blob/master/CliClient/locales/gl_ES.po">gl_ES</a></td>
-<td>Marcos Lans <a href="&#x6d;&#97;&#x69;&#108;&#116;&#111;&#58;&#x6d;&#97;&#114;&#99;&#111;&#x73;&#108;&#x61;&#110;&#x73;&#103;&#97;&#x72;&#122;&#97;&#64;&#x67;&#x6d;&#x61;&#x69;&#108;&#46;&#x63;&#111;&#109;">&#x6d;&#97;&#114;&#99;&#111;&#x73;&#108;&#x61;&#110;&#x73;&#103;&#97;&#x72;&#122;&#97;&#64;&#x67;&#x6d;&#x61;&#x69;&#108;&#46;&#x63;&#111;&#109;</a></td>
+<td>Marcos Lans <a href="&#x6d;&#x61;&#x69;&#x6c;&#116;&#111;&#x3a;&#109;&#x61;&#114;&#x63;&#x6f;&#115;&#x6c;&#97;&#110;&#115;&#103;&#97;&#x72;&#122;&#x61;&#x40;&#103;&#109;&#97;&#105;&#x6c;&#46;&#x63;&#x6f;&#x6d;">&#109;&#x61;&#114;&#x63;&#x6f;&#115;&#x6c;&#97;&#110;&#115;&#103;&#97;&#x72;&#122;&#x61;&#x40;&#103;&#109;&#97;&#105;&#x6c;&#46;&#x63;&#x6f;&#x6d;</a></td>
 <td>95%</td>
 </tr>
 <tr>
@@ -569,14 +571,14 @@ $$
 <td><img src="https://joplin.cozic.net/images/flags/country-4x3/br.png" alt=""></td>
 <td>Português (Brasil)</td>
 <td><a href="https://github.com/laurent22/joplin/blob/master/CliClient/locales/pt_BR.po">pt_BR</a></td>
-<td>Renato Nunes Bastos <a href="&#x6d;&#x61;&#105;&#108;&#116;&#111;&#58;&#x72;&#x6e;&#x62;&#97;&#x73;&#116;&#x6f;&#x73;&#x40;&#x67;&#109;&#97;&#x69;&#108;&#46;&#x63;&#x6f;&#109;">&#x72;&#x6e;&#x62;&#97;&#x73;&#116;&#x6f;&#x73;&#x40;&#x67;&#109;&#97;&#x69;&#108;&#46;&#x63;&#x6f;&#109;</a></td>
+<td>Renato Nunes Bastos <a href="&#x6d;&#97;&#105;&#108;&#x74;&#111;&#x3a;&#x72;&#110;&#x62;&#x61;&#115;&#x74;&#111;&#x73;&#x40;&#x67;&#109;&#x61;&#105;&#108;&#46;&#99;&#111;&#109;">&#x72;&#110;&#x62;&#x61;&#115;&#x74;&#111;&#x73;&#x40;&#x67;&#109;&#x61;&#105;&#108;&#46;&#99;&#111;&#109;</a></td>
 <td>97%</td>
 </tr>
 <tr>
 <td><img src="https://joplin.cozic.net/images/flags/country-4x3/ru.png" alt=""></td>
 <td>Русский</td>
 <td><a href="https://github.com/laurent22/joplin/blob/master/CliClient/locales/ru_RU.po">ru_RU</a></td>
-<td>Artyom Karlov <a href="&#x6d;&#x61;&#x69;&#x6c;&#x74;&#111;&#x3a;&#97;&#114;&#116;&#x79;&#x6f;&#x6d;&#x2e;&#x6b;&#97;&#x72;&#x6c;&#x6f;&#x76;&#64;&#x67;&#x6d;&#97;&#105;&#x6c;&#x2e;&#x63;&#111;&#109;">&#97;&#114;&#116;&#x79;&#x6f;&#x6d;&#x2e;&#x6b;&#97;&#x72;&#x6c;&#x6f;&#x76;&#64;&#x67;&#x6d;&#97;&#105;&#x6c;&#x2e;&#x63;&#111;&#109;</a></td>
+<td>Artyom Karlov <a href="&#x6d;&#97;&#x69;&#108;&#x74;&#x6f;&#x3a;&#97;&#x72;&#116;&#121;&#111;&#109;&#x2e;&#107;&#97;&#114;&#x6c;&#x6f;&#x76;&#x40;&#x67;&#109;&#97;&#x69;&#108;&#x2e;&#x63;&#x6f;&#109;">&#97;&#x72;&#116;&#121;&#111;&#109;&#x2e;&#107;&#97;&#114;&#x6c;&#x6f;&#x76;&#x40;&#x67;&#109;&#97;&#x69;&#108;&#x2e;&#x63;&#x6f;&#109;</a></td>
 <td>94%</td>
 </tr>
 <tr>

programming_language: HTML