Electron contextIsolation RCE via IPC
Last updated
Last updated
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
If the preload script exposes an IPC endpoint from the main.js file, the renderer process will be able to access it and if vulnerable, a RCE might be possible.
Most of these examples were taken from here https://www.youtube.com/watch?v=xILfQGkLXQo. Check the video for further information.
Example from https://speakerdeck.com/masatokinugawa/how-i-hacked-microsoft-teams-and-got-150000-dollars-in-pwn2own?slide=21 (you have the full example of how MS Teams was abusing from XSS to RCE in those slides, this is just a very basic example):
Check how the main.js
listens on getUpdate
and will download and execute any URL passed.
Check also how preload.js
exposes any IPC event from main.
Exploit:
If the preload script exposes directly to the renderer a way to call shell.openExternal
its possible to obtains RCE
Is the preload script exposes ways to completely communicate with the main process, an XSS will be able to send any event. The impact of this depends on what the main process exposes in terms of IPC.
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)