# Electron contextIsolation RCE über internen Code von Electron
{{#include ../../../banners/hacktricks-training.md}}
## Beispiel 1
Beispiel von [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)
Der "exit"-Ereignis-Listener wird immer durch den internen Code gesetzt, wenn das Laden der Seite gestartet wird. Dieses Ereignis wird kurz vor der Navigation ausgelöst:
```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}}
.png>)
https://github.com/nodejs/node/blob/8a44289089a08b7b19fa3c4651b5f1f5d1edd71b/bin/events.js#L156-L231 -- Existiert nicht mehr
Dann geht es hierhin:
.png>)
Wo "self" das Prozessobjekt von Node ist:
.png>)
Das Prozessobjekt hat eine Referenz zur "require"-Funktion:
```
process.mainModule.require
```
Da der handler.call das Prozessobjekt empfangen wird, können wir es überschreiben, um beliebigen Code auszuführen:
```html
```
## Beispiel 2
Erhalte **require-Objekt aus Prototyp-Pollution**. Von [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)
Leck:
Exploits:
{{#include ../../../banners/hacktricks-training.md}}