# Electron contextIsolation RCE via Electron internal code {{#include ../../../banners/hacktricks-training.md}} ## Voorbeeld 1 Voorbeeld van [https://speakerdeck.com/masatokinugawa/electron-abusing-the-lack-of-context-isolation-curecon-en?slide=41](https://speakerdeck.com/masatokinugawa/electron-abusing-the-lack-of-context-isolation-curecon-en?slide=41) "exit" gebeurtenis luisteraar word altyd deur die interne kode gestel wanneer die bladsy laai begin. Hierdie gebeurtenis word net voor navigasie uitgegee: ```javascript process.on("exit", function () { for (let p in cachedArchives) { if (!hasProp.call(cachedArchives, p)) continue cachedArchives[p].destroy() } }) ``` {{#ref}} https://github.com/electron/electron/blob/664c184fcb98bb5b4b6b569553e7f7339d3ba4c5/lib/common/asar.js#L30-L36 {{#endref}} ![](<../../../images/image (1070).png>) https://github.com/nodejs/node/blob/8a44289089a08b7b19fa3c4651b5f1f5d1edd71b/bin/events.js#L156-L231 -- Bestaan nie meer nie Dan gaan dit hierheen: ![](<../../../images/image (793).png>) Waar "self" Node se proses objek is: ![](<../../../images/image (700).png>) Die proses objek het 'n verwysing na die "require" funksie: ``` process.mainModule.require ``` Aangesien die handler.call die proses objek gaan ontvang, kan ons dit oorskryf om arbitrêre kode uit te voer: ```html ``` ## Voorbeeld 2 Kry **require object van prototipe besoedeling**. Van [https://www.youtube.com/watch?v=Tzo8ucHA5xw\&list=PLH15HpR5qRsVKcKwvIl-AzGfRqKyx--zq\&index=81](https://www.youtube.com/watch?v=Tzo8ucHA5xw&list=PLH15HpR5qRsVKcKwvIl-AzGfRqKyx--zq&index=81) Besoedeling:
Eksploiteer:
{{#include ../../../banners/hacktricks-training.md}}