Remote Code Execution on Element Desktop Application using Node Integration in Sub Frames Bypass - CVE-2022-23597
Element Desktop embedded a self-hosted Jitsi conference server in an iframe, and because the app used an old Electron version, a renderer exploit could flip the nodeIntegrationInSubFrames preference so that iframe preloads gained access to the exposed IPC bridge. From there an attacker could call the userDownloadOpen IPC handler with an arbitrary path and launch a local executable, achieving remote code execution.
– by s1r1us and TheGrandPew
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the app relied on an outdated Electron build whose renderer-side check for nodeIntegrationInSubFrames could be altered by a renderer exploit, combined with an IPC handler that opened any path supplied by the renderer.
Impact
An attacker who gets a victim to open a crafted link could run arbitrary local programs on the victim's machine, though the exploit depends on a separate renderer vulnerability and a working V8 exploit.
What the attacker needed
Victim opens a crafted element:// link; attacker-controlled conference server; working V8 renderer exploit; old Electron version
How it was found
- Load the jitsi.html page with a conferenceDomain pointing at an attacker-controlled host to get script execution inside the iframe.
- Use a V8 renderer exploit to locate the Blink WebPreferences and set the nodeIntegrationInSubFrames flag.
- Create a same-origin iframe whose srcdoc calls the exposed electron.send bridge.
- Send the userDownloadOpen IPC message with a path to a local executable so the app launches it.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Element is a chat app built with Electron, which is a framework that lets web pages run inside a desktop program. The app let a web page load another website inside a frame, and a flaw in the Electron version meant code in that frame could reach a privileged function that opens files. The attacker used that function to start a program on the victim's computer.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.