# Electron contextIsolation RCE via Electron internal code {{#include ../../../banners/hacktricks-training.md}} ## Example 1 Example from [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" 이벤트 리스너는 페이지 로딩이 시작될 때 항상 내부 코드에 의해 설정됩니다. 이 이벤트는 탐색 직전에 발생합니다: ```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 -- 더 이상 존재하지 않음 그런 다음 여기로 이동합니다: ![](<../../../images/image (793).png>) 여기서 "self"는 Node의 프로세스 객체입니다: ![](<../../../images/image (700).png>) 프로세스 객체는 "require" 함수에 대한 참조를 가지고 있습니다: ``` process.mainModule.require ``` handler.call이 process 객체를 받을 것이므로, 이를 덮어써서 임의의 코드를 실행할 수 있습니다: ```html ``` ## 예제 2 **프로토타입 오염에서 require 객체 가져오기**. From [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) 누출:
악용:
{{#include ../../../banners/hacktricks-training.md}}