Webview 漏洞修复
发现了一个漏洞,该漏洞允许在某些禁用 Node.js 集成的 Electron 应用中重新启用 Node.js 集成。该漏洞已被分配 CVE 标识符 CVE-2018-1000136。
🌐 A vulnerability has been discovered which allows Node.js integration to be re-enabled in some Electron applications that disable it. This vulnerability has been assigned the CVE identifier CVE-2018-1000136.
受影响的应用
🌐 Affected Applications
如果以下所有情况都成立,则应用会受到影响:
🌐 An application is affected if all of the following are true:
- 可在 Electron 1.7、1.8 或 2.0.0-beta 版本上运行
- 允许执行任意远程代码
- 禁用 Node.js 集成
- 在其 webPreferences 中未明确声明
webviewTag: false - 未启用
nativeWindowOption选项 - 不会拦截
new-window事件,并且在不使用提供的 options 标签的情况下手动覆盖event.newGuest
虽然这似乎只存在于少数 Electron 应用中,但我们建议所有应用升级以防万一。
🌐 Although this appears to be a minority of Electron applicatons, we encourage all applications to be upgraded as a precaution.
缓解措施
🌐 Mitigation
此漏洞已在今天发布的 1.7.13、1.8.4 和 2.0.0-beta.5 版本中修复。
🌐 This vulnerability is fixed in today's 1.7.13, 1.8.4, and 2.0.0-beta.5 releases.
无法升级应用 Electron 版本的开发者可以使用以下代码缓解此漏洞:
🌐 Developers who are unable to upgrade their application's Electron version can mitigate the vulnerability with the following code:
app.on('web-contents-created', (event, win) => {
win.on(
'new-window',
(event, newURL, frameName, disposition, options, additionalFeatures) => {
if (!options.webPreferences) options.webPreferences = {};
options.webPreferences.nodeIntegration = false;
options.webPreferences.nodeIntegrationInWorker = false;
options.webPreferences.webviewTag = false;
delete options.webPreferences.preload;
},
);
});
// and *IF* you don't use WebViews at all,
// you might also want
app.on('web-contents-created', (event, win) => {
win.on('will-attach-webview', (event, webPreferences, params) => {
event.preventDefault();
});
});
更多信息
🌐 Further Information
这个漏洞是由 Trustwave SpiderLabs 的 Brendan Scarvell 发现并负责任地报告给 Electron 项目的。
🌐 This vulnerability was found and reported responsibly to the Electron project by Brendan Scarvell of Trustwave SpiderLabs.
要了解有关保持 Electron 应用安全的最佳实践的更多信息,请参阅我们的 安全教程。
🌐 To learn more about best practices for keeping your Electron apps secure, see our security tutorial.
如果你希望报告 Electron 中的漏洞,请提交 [GitHub 安全咨询]。
🌐 Please file a GitHub Security Advisory if you wish to report a vulnerability in Electron.
请加入我们的email list以接收有关版本发布和安全更新的通知。
🌐 Please join our email list to receive updates about releases and security updates.