CWE-94
Allowed-with-ReviewImproper Control of Generation of Code ('Code Injection')
Abstraction: Base · Status: Draft
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
8283 vulnerabilities reference this CWE, most recent first.
GHSA-HF43-47Q4-FHQ5
Vulnerability from github – Published: 2024-04-10 17:16 – Updated: 2024-04-10 22:01Impact
The HTML escaping of escaping tool that is used in XWiki doesn't escape {, which, when used in certain places, allows XWiki syntax injection and thereby remote code execution.
To reproduce in an XWiki installation, open <xwiki-host>/xwiki/bin/view/Panels/PanelLayoutUpdate?place=%7B%7B%2Fhtml%7D%7D%7B%7Basync%20async%3Dfalse%7D%7D%7B%7Bvelocity%7D%7D%23evaluate(%24request.eval)%7B%7B%2Fvelocity%7D%7D%7B%7B%2Fasync%7D%7D&eval=Hello%20from%20URL%20Parameter!%20I%20got%20programming%3A%20%24services.security.authorization.hasAccess(%27programming%27) where <xwiki-host> is the URL of your XWiki installation. If this displays You are not admin on this place Hello from URL Parameter! I got programming: true, the installation is vulnerable.
Patches
The vulnerability has been fixed on XWiki 14.10.19, 15.5.5, and 15.9 RC1.
Workarounds
Apart from upgrading, there is no generic workaround. However, replacing $escapetool.html by $escapetool.xml in XWiki documents fixes the vulnerability. In a standard XWiki installation, we're only aware of the document Panels.PanelLayoutUpdate that exposes this vulnerability, patching this document is thus a workaround. Any extension could expose this vulnerability and might thus require patching, too.
References
- https://github.com/xwiki/xwiki-commons/commit/b94142e2a66ec32e89eacab67c3da8d91f5ef93a
- https://jira.xwiki.org/browse/XCOMMONS-2828
- https://jira.xwiki.org/browse/XWIKI-21438
{
"affected": [
{
"package": {
"ecosystem": "Maven",
"name": "org.xwiki.commons:xwiki-commons-velocity"
},
"ranges": [
{
"events": [
{
"introduced": "3.0.1"
},
{
"fixed": "14.10.19"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Maven",
"name": "org.xwiki.commons:xwiki-commons-velocity"
},
"ranges": [
{
"events": [
{
"introduced": "15.0-rc-1"
},
{
"fixed": "15.5.4"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Maven",
"name": "org.xwiki.commons:xwiki-commons-velocity"
},
"ranges": [
{
"events": [
{
"introduced": "15.6-rc-1"
},
{
"fixed": "15.9-rc-1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2024-31996"
],
"database_specific": {
"cwe_ids": [
"CWE-94",
"CWE-95"
],
"github_reviewed": true,
"github_reviewed_at": "2024-04-10T17:16:37Z",
"nvd_published_at": "2024-04-10T21:15:07Z",
"severity": "CRITICAL"
},
"details": "### Impact\nThe HTML escaping of escaping tool that is used in XWiki doesn\u0027t escape `{`, which, when used in certain places, allows XWiki syntax injection and thereby remote code execution.\n\nTo reproduce in an XWiki installation, open `\u003cxwiki-host\u003e/xwiki/bin/view/Panels/PanelLayoutUpdate?place=%7B%7B%2Fhtml%7D%7D%7B%7Basync%20async%3Dfalse%7D%7D%7B%7Bvelocity%7D%7D%23evaluate(%24request.eval)%7B%7B%2Fvelocity%7D%7D%7B%7B%2Fasync%7D%7D\u0026eval=Hello%20from%20URL%20Parameter!%20I%20got%20programming%3A%20%24services.security.authorization.hasAccess(%27programming%27)` where `\u003cxwiki-host\u003e` is the URL of your XWiki installation. If this displays `You are not admin on this place Hello from URL Parameter! I got programming: true`, the installation is vulnerable.\n\n### Patches\nThe vulnerability has been fixed on XWiki 14.10.19, 15.5.5, and 15.9 RC1.\n\n### Workarounds\nApart from upgrading, there is no generic workaround. However, replacing `$escapetool.html` by `$escapetool.xml` in XWiki documents fixes the vulnerability. In a standard XWiki installation, we\u0027re only aware of the document `Panels.PanelLayoutUpdate` that exposes this vulnerability, patching this document is thus a workaround. Any extension could expose this vulnerability and might thus require patching, too.\n\n### References\n- https://github.com/xwiki/xwiki-commons/commit/b94142e2a66ec32e89eacab67c3da8d91f5ef93a\n- https://jira.xwiki.org/browse/XCOMMONS-2828\n- https://jira.xwiki.org/browse/XWIKI-21438",
"id": "GHSA-hf43-47q4-fhq5",
"modified": "2024-04-10T22:01:56Z",
"published": "2024-04-10T17:16:37Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/xwiki/xwiki-commons/security/advisories/GHSA-hf43-47q4-fhq5"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-31996"
},
{
"type": "WEB",
"url": "https://github.com/xwiki/xwiki-commons/commit/b0805160ec7b01ee12417e79cb384e60ae4817aa"
},
{
"type": "WEB",
"url": "https://github.com/xwiki/xwiki-commons/commit/b94142e2a66ec32e89eacab67c3da8d91f5ef93a"
},
{
"type": "WEB",
"url": "https://github.com/xwiki/xwiki-commons/commit/ed7ff515a2436a1c6dcbd0c6ca0c41e434d58915"
},
{
"type": "PACKAGE",
"url": "https://github.com/xwiki/xwiki-commons"
},
{
"type": "WEB",
"url": "https://jira.xwiki.org/browse/XCOMMONS-2828"
},
{
"type": "WEB",
"url": "https://jira.xwiki.org/browse/XWIKI-21438"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "XWiki Commons missing escaping of `{` in Velocity escapetool allows remote code execution"
}
GHSA-HF4V-6G3H-XVV3
Vulnerability from github – Published: 2022-05-02 00:02 – Updated: 2024-02-15 21:31The Hash-based Message Authentication Code (HMAC) provider in Java on Apple Mac OS X 10.4.11, 10.5.4, and 10.5.5 uses an uninitialized variable, which allows remote attackers to execute arbitrary code via a crafted applet, related to an "error checking issue."
{
"affected": [],
"aliases": [
"CVE-2008-3637"
],
"database_specific": {
"cwe_ids": [
"CWE-665",
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2008-09-26T16:21:00Z",
"severity": "HIGH"
},
"details": "The Hash-based Message Authentication Code (HMAC) provider in Java on Apple Mac OS X 10.4.11, 10.5.4, and 10.5.5 uses an uninitialized variable, which allows remote attackers to execute arbitrary code via a crafted applet, related to an \"error checking issue.\"",
"id": "GHSA-hf4v-6g3h-xvv3",
"modified": "2024-02-15T21:31:23Z",
"published": "2022-05-02T00:02:10Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2008-3637"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/45396"
},
{
"type": "WEB",
"url": "http://lists.apple.com/archives/security-announce//2008/Sep/msg00007.html"
},
{
"type": "WEB",
"url": "http://lists.apple.com/archives/security-announce//2008/Sep/msg00008.html"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/32018"
},
{
"type": "WEB",
"url": "http://support.apple.com/kb/HT3178"
},
{
"type": "WEB",
"url": "http://support.apple.com/kb/HT3179"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/31379"
},
{
"type": "WEB",
"url": "http://www.securitytracker.com/id?1020943"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-HF64-2G6G-CXVV
Vulnerability from github – Published: 2026-01-28 18:30 – Updated: 2026-01-29 18:31An issue in Amidaware Inc Tactical RMM v1.3.1 and before allows a remote attacker to execute arbitrary code via the /api/tacticalrmm/apiv3/views.py component
{
"affected": [],
"aliases": [
"CVE-2025-69517"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-01-28T16:16:15Z",
"severity": "CRITICAL"
},
"details": "An issue in Amidaware Inc Tactical RMM v1.3.1 and before allows a remote attacker to execute arbitrary code via the /api/tacticalrmm/apiv3/views.py component",
"id": "GHSA-hf64-2g6g-cxvv",
"modified": "2026-01-29T18:31:42Z",
"published": "2026-01-28T18:30:47Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-69517"
},
{
"type": "WEB",
"url": "https://gist.github.com/NtGabrielGomes/fdabcd9e85d841c5490739686e0f8b72"
},
{
"type": "WEB",
"url": "https://github.com/amidaware/tacticalrmm"
},
{
"type": "WEB",
"url": "https://www.amidaware.com"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-HF6F-JQ25-8GQ9
Vulnerability from github – Published: 2022-02-15 01:57 – Updated: 2023-09-15 18:13Gitea before 1.5.4 allows remote code execution because it does not properly validate session IDs. This is related to session ID handling in the go-macaron/session code for Macaron.
{
"affected": [
{
"package": {
"ecosystem": "Go",
"name": "code.gitea.io/gitea"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.5.2"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2018-18926"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2021-05-12T18:25:03Z",
"nvd_published_at": null,
"severity": "CRITICAL"
},
"details": "Gitea before 1.5.4 allows remote code execution because it does not properly validate session IDs. This is related to session ID handling in the go-macaron/session code for Macaron.",
"id": "GHSA-hf6f-jq25-8gq9",
"modified": "2023-09-15T18:13:45Z",
"published": "2022-02-15T01:57:18Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2018-18926"
},
{
"type": "WEB",
"url": "https://github.com/go-gitea/gitea/issues/5140"
},
{
"type": "WEB",
"url": "https://github.com/go-gitea/gitea/pull/5177"
},
{
"type": "WEB",
"url": "https://github.com/go-gitea/gitea/commit/aeb5655c25053bdcd7eee94ea37df88468374162"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "Gitea Remote Code Execution (RCE)"
}
GHSA-HF6P-499M-7H88
Vulnerability from github – Published: 2023-03-08 03:30 – Updated: 2023-03-15 15:30The webutils in Proofpoint Enterprise Protection (PPS/POD) contain a vulnerability that allows an authenticated user to execute remote code through 'eval injection'. This affects all versions 8.20.0 and below.
{
"affected": [],
"aliases": [
"CVE-2023-0089"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-03-08T01:15:00Z",
"severity": "HIGH"
},
"details": "The webutils in Proofpoint Enterprise Protection (PPS/POD) contain a vulnerability that allows an authenticated user to execute remote code through \u0027eval injection\u0027. This affects all versions 8.20.0 and below.",
"id": "GHSA-hf6p-499m-7h88",
"modified": "2023-03-15T15:30:24Z",
"published": "2023-03-08T03:30:16Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-0089"
},
{
"type": "WEB",
"url": "https://www.proofpoint.com/security/security-advisories/pfpt-sa-2023-0001"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-HF8H-PGG7-5C27
Vulnerability from github – Published: 2022-05-05 02:48 – Updated: 2025-03-31 12:30settings/personal.php in ownCloud 4.5.x before 4.5.6 allows remote authenticated users to execute arbitrary PHP code via crafted mount point settings.
{
"affected": [],
"aliases": [
"CVE-2013-0204"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2014-06-04T14:55:00Z",
"severity": "MODERATE"
},
"details": "settings/personal.php in ownCloud 4.5.x before 4.5.6 allows remote authenticated users to execute arbitrary PHP code via crafted mount point settings.",
"id": "GHSA-hf8h-pgg7-5c27",
"modified": "2025-03-31T12:30:38Z",
"published": "2022-05-05T02:48:33Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2013-0204"
},
{
"type": "WEB",
"url": "http://owncloud.org/about/security/advisories/oC-SA-2013-002"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-HF8Q-JFJ5-C238
Vulnerability from github – Published: 2024-10-25 18:30 – Updated: 2024-10-25 21:31SQL injection vulnerability in Hanzhou Haobo network management system 1.0 allows a remote attacker to execute arbitrary code via a crafted script.
{
"affected": [],
"aliases": [
"CVE-2024-48204"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-10-25T16:15:09Z",
"severity": "CRITICAL"
},
"details": "SQL injection vulnerability in Hanzhou Haobo network management system 1.0 allows a remote attacker to execute arbitrary code via a crafted script.",
"id": "GHSA-hf8q-jfj5-c238",
"modified": "2024-10-25T21:31:27Z",
"published": "2024-10-25T18:30:49Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-48204"
},
{
"type": "WEB",
"url": "https://gist.github.com/NasYangh/161618e4552ca40ad1ac25b4d673bfcf"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-HF8V-3VX8-MR3V
Vulnerability from github – Published: 2024-12-06 00:31 – Updated: 2024-12-06 21:30Buffer Overflow vulnerability in Open Robotics Robotic Operating System 2 (ROS2) navigation2- ROS2-humble and navigation 2-humble allows a local attacker to execute arbitrary code via a crafted script.
{
"affected": [],
"aliases": [
"CVE-2024-30963"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-12-05T23:15:05Z",
"severity": "HIGH"
},
"details": "Buffer Overflow vulnerability in Open Robotics Robotic Operating System 2 (ROS2) navigation2- ROS2-humble and navigation 2-humble allows a local attacker to execute arbitrary code via a crafted script.",
"id": "GHSA-hf8v-3vx8-mr3v",
"modified": "2024-12-06T21:30:38Z",
"published": "2024-12-06T00:31:47Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-30963"
},
{
"type": "WEB",
"url": "https://github.com/ros-planning/navigation2/issues/4157"
},
{
"type": "WEB",
"url": "https://github.com/GoesM/ROS-CVE-CNVDs"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-HF9F-HPV8-5R38
Vulnerability from github – Published: 2023-07-11 18:31 – Updated: 2024-04-04 05:58Microsoft SharePoint Remote Code Execution Vulnerability
{
"affected": [],
"aliases": [
"CVE-2023-33157"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-07-11T18:15:14Z",
"severity": "HIGH"
},
"details": "Microsoft SharePoint Remote Code Execution Vulnerability",
"id": "GHSA-hf9f-hpv8-5r38",
"modified": "2024-04-04T05:58:03Z",
"published": "2023-07-11T18:31:25Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-33157"
},
{
"type": "WEB",
"url": "https://msrc.microsoft.com/update-guide/vulnerability/CVE-2023-33157"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-HFF8-HJWV-J9Q7
Vulnerability from github – Published: 2024-11-14 17:38 – Updated: 2025-01-30 18:05Summary
There is a vulnerability in Joplin-desktop that leads to remote code execution (RCE) when a user clicks on an <a> link within untrusted notes. The issue arises due to insufficient sanitization of <a> tag attributes introduced by the Mermaid. This vulnerability allows the execution of untrusted HTML content within the Electron window, which has full access to Node.js APIs, enabling arbitrary shell command execution.
Details
In the markdown preview iframe, Joplin only opens <a> links internally within the same Electron window if they contain the data-from-md attribute. While Joplin successfully sanitizes the data-from-md attribute in user-embedded <a> links from the .md file to prevent the execution of untrusted HTML content, it fails to sanitize the data-from-md attributes of <a> tags introduced by Mermaid (e.g., the code snippet shown below). Since Mermaid allows the rendering of certain scriptless HTML elements, an attacker can embed <a>tags with data-from-md attributes, which will then be opened internally in the same Electron window.
Additionally, Joplin opens the window with nodeIntegration set to true and contextIsolation set to false, resulting in any scripts running in the opened window having full access to Node.js APIs. Furthermore, the markdown preview iframe shares the same origin (i.e.,local file system) as its parent and lacks the sandbox attribute, allowing scripts running in the iframe to call Node.js APIs through window.parent. As a result, an attacker can execute arbitrary code using Node.js APIs by exploiting HTML files stored on the local file system, which share the same origin as the parent.
Relevant code references:
- Payload to inject
<a>withdata-from-mdattribute:
```mermaid
flowchart TD
A[<a href="https://attacker.com" data-from-md>hello</a>]
```
- Handling link navigation in the markdown preview iframe
https://github.com/laurent22/joplin/blob/e6c09da639adeb76f12e4477cc8442c49c0ced0c/packages/lib/renderers/webviewLib.js#L93-L116
- Window configuration of
Joplinwindow
https://github.com/laurent22/joplin/blob/e6c09da639adeb76f12e4477cc8442c49c0ced0c/packages/app-desktop/ElectronAppWrapper.ts#L141-L155
PoC
Considering the user has downloaded the following shared files from the internet (Note: the threat model aligns with existing published security issues: GHSA-2h88-m32f-qh5m and GHSA-g8qx-5vcm-3x59, where the malicious HTML file is available locally):
poc.md
```mermaid
flowchart TD
A[<a href="/../../../../../../../../../../../../../../../path/to/poc2.html" data-from-md>hello</a>]
```
poc2.html
<html>
<body>
<script>
if (typeof window.parent.require !== 'undefined') {
const { exec } = window.parent.require('child_process');
exec('ls -al', (err, stdout, stderr) => {
if (err) {
document.body.innerText = `Error: ${err.message}`;
return;
}
if (stderr) {
document.body.innerText = `Stderr: ${stderr}`;
return;
}
document.body.innerText = stdout;
});
} else {
document.body.innerText = 'Require is not available in this environment.';
}
</script>
</body>
</html>
Then, open the poc.md with Joplin and click on the hello link. The code embedded in the poc2.html will be executed.
Impact
This vulnerability can lead to Remote Code Execution (RCE) when users open and interact with untrusted notes, while malicious HTML files are available locally.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "joplin"
},
"ranges": [
{
"events": [
{
"introduced": "3.0.0"
},
{
"fixed": "3.1.0"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"3.0.0"
]
}
],
"aliases": [
"CVE-2024-49362"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2024-11-14T17:38:14Z",
"nvd_published_at": "2024-11-14T18:15:19Z",
"severity": "HIGH"
},
"details": "### Summary\n\nThere is a vulnerability in `Joplin-desktop` that leads to remote code execution (RCE) when a user clicks on an `\u003ca\u003e` link within untrusted notes. The issue arises due to insufficient sanitization of `\u003ca\u003e` tag attributes introduced by the `Mermaid`. This vulnerability allows the execution of untrusted HTML content within the Electron window, which has full access to Node.js APIs, enabling arbitrary shell command execution.\n\n### Details\n\nIn the markdown preview iframe, `Joplin` only opens `\u003ca\u003e` links internally within the same Electron window if they contain the `data-from-md` attribute. While Joplin successfully sanitizes the `data-from-md` attribute in user-embedded `\u003ca\u003e` links from the `.md` file to prevent the execution of untrusted HTML content, it fails to sanitize the `data-from-md` attributes of `\u003ca\u003e` tags introduced by `Mermaid` (e.g., the code snippet shown below). Since `Mermaid` allows the rendering of certain scriptless HTML elements, an attacker can embed `\u003ca\u003e `tags with `data-from-md` attributes, which will then be opened internally in the same Electron window.\n\nAdditionally, `Joplin` opens the window with `nodeIntegration` set to `true` and `contextIsolation` set to `false`, resulting in any scripts running in the opened window having full access to Node.js APIs. Furthermore, the markdown preview iframe shares the same origin (i.e.,local file system) as its parent and lacks the `sandbox` attribute, allowing scripts running in the iframe to call Node.js APIs through `window.parent`. As a result, an attacker can execute arbitrary code using Node.js APIs by exploiting HTML files stored on the local file system, which share the same origin as the parent.\n\n\n**Relevant code references:**\n\n+ Payload to inject `\u003ca\u003e` with `data-from-md` attribute:\n\n````markdown\n```mermaid\nflowchart TD\n A[\u003ca href=\"https://attacker.com\" data-from-md\u003ehello\u003c/a\u003e]\n```\n````\n\n+ Handling link navigation in the markdown preview iframe\n\nhttps://github.com/laurent22/joplin/blob/e6c09da639adeb76f12e4477cc8442c49c0ced0c/packages/lib/renderers/webviewLib.js#L93-L116\n\n+ Window configuration of `Joplin` window\n\nhttps://github.com/laurent22/joplin/blob/e6c09da639adeb76f12e4477cc8442c49c0ced0c/packages/app-desktop/ElectronAppWrapper.ts#L141-L155\n\n### PoC\n\nConsidering the user has downloaded the following shared files from the internet (Note: the threat model aligns with existing published security issues: [GHSA-2h88-m32f-qh5m](https://github.com/laurent22/joplin/security/advisories/GHSA-2h88-m32f-qh5m) and [GHSA-g8qx-5vcm-3x59](https://github.com/laurent22/joplin/security/advisories/GHSA-g8qx-5vcm-3x59), where the malicious HTML file is available locally):\n\n+ `poc.md`\n````markdown\n```mermaid\nflowchart TD\n A[\u003ca href=\"/../../../../../../../../../../../../../../../path/to/poc2.html\" data-from-md\u003ehello\u003c/a\u003e]\n```\n````\n\n+ `poc2.html`\n```\n\u003chtml\u003e\n \u003cbody\u003e\n \u003cscript\u003e\n if (typeof window.parent.require !== \u0027undefined\u0027) {\n const { exec } = window.parent.require(\u0027child_process\u0027);\n exec(\u0027ls -al\u0027, (err, stdout, stderr) =\u003e {\n if (err) {\n document.body.innerText = `Error: ${err.message}`;\n return;\n }\n if (stderr) {\n document.body.innerText = `Stderr: ${stderr}`;\n return;\n }\n document.body.innerText = stdout;\n });\n } else {\n document.body.innerText = \u0027Require is not available in this environment.\u0027;\n }\n \u003c/script\u003e\n \u003c/body\u003e\n\u003c/html\u003e\n```\n\nThen, open the `poc.md` with `Joplin` and click on the `hello` link. The code embedded in the `poc2.html` will be executed.\n\n\n\n### Impact\n\nThis vulnerability can lead to Remote Code Execution (RCE) when users open and interact with untrusted notes, while malicious HTML files are available locally.",
"id": "GHSA-hff8-hjwv-j9q7",
"modified": "2025-01-30T18:05:55Z",
"published": "2024-11-14T17:38:14Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/laurent22/joplin/security/advisories/GHSA-hff8-hjwv-j9q7"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-49362"
},
{
"type": "PACKAGE",
"url": "https://github.com/laurent22/joplin"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:L",
"type": "CVSS_V3"
}
],
"summary": "Remote Code Execution on click of \u003ca\u003e Link in markdown preview"
}
Mitigation
Strategy: Refactoring
Refactor your program so that you do not have to dynamically generate code.
Mitigation
- Run your code in a "jail" or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict which code can be executed by your product.
- Examples include the Unix chroot jail and AppArmor. In general, managed code may provide some protection.
- This may not be a feasible solution, and it only limits the impact to the operating system; the rest of your application may still be subject to compromise.
- Be careful to avoid CWE-243 and other weaknesses related to jails.
Mitigation MIT-5
Strategy: Input Validation
- Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does.
- When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue."
- Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.
- To reduce the likelihood of code injection, use stringent allowlists that limit which constructs are allowed. If you are dynamically constructing code that invokes a function, then verifying that the input is alphanumeric might be insufficient. An attacker might still be able to reference a dangerous function that you did not intend to allow, such as system(), exec(), or exit().
Mitigation
Use dynamic tools and techniques that interact with the product using large test suites with many diverse inputs, such as fuzz testing (fuzzing), robustness testing, and fault injection. The product's operation may slow down, but it should not become unstable, crash, or generate incorrect results.
Mitigation MIT-32
Strategy: Compilation or Build Hardening
Run the code in an environment that performs automatic taint propagation and prevents any command execution that uses tainted variables, such as Perl's "-T" switch. This will force the program to perform validation steps that remove the taint, although you must be careful to correctly validate your inputs so that you do not accidentally mark dangerous inputs as untainted (see CWE-183 and CWE-184).
Mitigation MIT-32
Strategy: Environment Hardening
Run the code in an environment that performs automatic taint propagation and prevents any command execution that uses tainted variables, such as Perl's "-T" switch. This will force the program to perform validation steps that remove the taint, although you must be careful to correctly validate your inputs so that you do not accidentally mark dangerous inputs as untainted (see CWE-183 and CWE-184).
Mitigation
For Python programs, it is frequently encouraged to use the ast.literal_eval() function instead of eval, since it is intentionally designed to avoid executing code. However, an adversary could still cause excessive memory or stack consumption via deeply nested structures [REF-1372], so the python documentation discourages use of ast.literal_eval() on untrusted data [REF-1373].
CAPEC-242: Code Injection
An adversary exploits a weakness in input validation on the target to inject new code into that which is currently executing. This differs from code inclusion in that code inclusion involves the addition or replacement of a reference to a code file, which is subsequently loaded by the target and used as part of the code of some application.
CAPEC-35: Leverage Executable Code in Non-Executable Files
An attack of this type exploits a system's trust in configuration and resource files. When the executable loads the resource (such as an image file or configuration file) the attacker has modified the file to either execute malicious code directly or manipulate the target process (e.g. application server) to execute based on the malicious configuration parameters. Since systems are increasingly interrelated mashing up resources from local and remote sources the possibility of this attack occurring is high.
CAPEC-77: Manipulating User-Controlled Variables
This attack targets user controlled variables (DEBUG=1, PHP Globals, and So Forth). An adversary can override variables leveraging user-supplied, untrusted query variables directly used on the application server without any data sanitization. In extreme cases, the adversary can change variables controlling the business logic of the application. For instance, in languages like PHP, a number of poorly set default configurations may allow the user to override variables.