Skip to content
RCE Write-up Intermediate

One Electron to Rule Them All

The Chromium and Electron frameworks accept command-line switches such as --gpu-launcher and --utility-cmd-prefix that let an attacker run arbitrary programs. An attacker who can control the command line of an Electron-based application could execute any binary, potentially bypassing defences and gaining initial access.

Uriel Kosayev Follow

Published on medium.com

{{media:0}}

Uriel Kosayev, on medium.com

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

Electron is an open-source framework for building cross-platform desktop applications with web technologies. It combines the Chromium rendering engine, the same engine that powers Google Chrome, with the Node.js runtime, which gives applications native capabilities. Chromium itself is the foundation for several browsers, including Google Chrome, Microsoft Edge and Opera, and it is also part of the code base of applications such as Discord, Visual Studio Code, Postman and Notion.

The subject of this write-up is proxy execution: making a trusted, signed binary run an arbitrary executable on the attacker's behalf. The authors, Uriel Kosayev (@MalFuzzer), Hai Vaknin (@VakninHai), Tamir Yehuda (@Tamirye94) and Matan Bahar (@Bl4ckShad3), describe how a GitHub commit led them to a proxy execution capability in a wide range of binaries, which could let an attacker execute any binary, bypass defences and potentially gain initial access as part of weaponised malware in red team operations.

Uriel Kosayev
Uriel Kosayev From the original on medium.com

Setup

The starting point was a commit by security researcher mr.d0x to the LoLBAS project, which highlighted potential bypasses of security mechanisms and pointed specifically at Teams and MSEdge. The authors wanted to understand why the attack works on both of those applications, so they examined the binaries themselves.

The tools used in the analysis were:

  • Detect-it-Easy, to check how the binaries are detected.
  • Total PE, written by Pavel Yosifovich (@zodiacon), to validate the section names inside the executables.
  • A simple Python script, written by the authors, to check for existing arguments in the previously referenced file and to recursively enumerate all executables in a pristine Windows environment for potentially vulnerable Electron-based executables.
  • A Sysmon rule, written by the authors, for detection.

No accounts, roles or specific application versions are described beyond the binaries named in the text.

Finding it

The authors began with two applications that both support the command-line arguments --disable-gpu-sandbox and --gpu-launcher: msedge.exe and Teams.exe. Their first step was to check for strings referencing the Electron framework inside both binaries, then to check references in the disassembled code.

They then validated that --disable-gpu-sandbox and --gpu-launcher are part of the Chromium project, alongside more than 250 other arguments, as shown in a screenshot of the Chromium content_switches.cc file. The file is linked in the report at content/public/common/content_switches.cc in the Chromium repository.

Using Detect-it-Easy on both msedge.exe and Teams.exe, they found that both are detected as executables using the Electron package. The signature logic behind that detection is: if both the CPADinfo and .00cfg sections exist, the Electron framework is present. The authors note that this kind of signature can raise a false positive and will not always be accurate, so that has to be taken into account. They confirmed that both executables are compiled with both sections using Total PE.

Further investigation turned up additional arguments that allow code execution:

  • chrome.exe --disable-gpu-sandbox --gpu-launcher="calc.exe"
  • chrome.exe --utility-cmd-prefix="calc.exe"
  • chrome.exe --no-sandbox --browser-subprocess-path="C:\Windows\System32\calc.exe
  • chrome.exe --no-sandbox --renderer-cmd-prefix="calc.exe"

The authors then checked whether the attack path is possible on other operating systems and found that it can be exploited on Windows, macOS and Linux.

They also asked ChatGPT about the scope of vulnerable applications, and wrote the Python script described above. On a fresh Windows machine, the files that can be used for proxy execution were:

  • C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe
  • C:\Program Files (x86)\Microsoft\Edge\Application\114.0.1823.43\msedgewebview2.exe

Exploitation

Step 1: Run an arbitrary command through Chrome on Windows

"C:\Program Files\Google\Chrome\Application\chrome.exe" --disable-gpu-sandbox --gpu-launcher="C:\Windows\system32\cmd.exe /c calc.exe

Chrome is launched with the GPU sandbox disabled and with --gpu-launcher set to a command line.

Step 2: Run an arbitrary command through Chrome on macOS

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-gpu-sandbox --gpu-launcher="/bin/bash -c whoami"

The same two switches are used on macOS, with /bin/bash -c whoami as the launcher, which runs whoami through bash.

Step 3: Run an arbitrary command through Chrome on Linux

google-chrome --utility-cmd-prefix="/bin/bash -c whoami"

On Linux the authors used --utility-cmd-prefix instead of the GPU launcher switches, again running whoami through bash.

The report also refers to a PoC video and to screenshots of proxy execution on Windows, macOS and Linux, but the text does not include the video or the screenshots themselves.

Root cause

The authors reported the problem to Google and directly to the Electron framework team, but those teams did not view it as an issue. The report does not describe any code change or mitigation from either team.

Impact

The authors frame this as a way to bypass defence systems and potentially gain initial access as part of weaponised malware in red team operations. The capability was confirmed on Windows, macOS and Linux, and the binaries identified on a fresh Windows machine were msedge.exe and msedgewebview2.exe under the Edge application directory. The report does not give a severity rating or a bounty.

Detection

The authors created the following Sysmon rule to help incident responders and blue teams detect exploitation attempts:

XML
<RuleGroup name="" groupRelation="or">    <ProcessCreate onmatch="include">        <Image condition="end with">.exe</Image>        <CommandLine condition="contains">--gpu-launcher</CommandLine>        <CommandLine condition="contains">--utility-cmd-prefix</CommandLine>        <CommandLine condition="contains">--browser-subprocess-path</CommandLine>        <CommandLine condition="contains">--renderer-cmd-prefix</CommandLine>    </ProcessCreate></RuleGroup>

The rule matches process creation events where the image ends in .exe and the command line contains one of the four switches. The report says an example alert generated by this configuration is shown, but the alert itself is not included in the text.

The authors also offer detection logic suggestions:

  • Check that all the child processes in the execution chain are signed.
  • Exclude needed and legitimate processes, each organisation with its own list.

Variants to test

  • Run other Electron-based applications with --gpu-launcher, --utility-cmd-prefix, --browser-subprocess-path or --renderer-cmd-prefix set to a benign command. A positive result is the command running as a child of the trusted application.
  • Test the same switches on Windows, macOS and Linux builds of the same application, since the authors found the path works on all three.
  • Check binaries for the CPADinfo and .00cfg sections with Total PE or a similar tool as a quick indicator of Electron usage, keeping in mind the false positive risk the authors describe.
  • Enumerate executables on a clean installation of the target operating system and test each candidate, as the authors did with their Python script.
  • Deploy the Sysmon rule above and confirm that process creation events carrying these switches generate alerts in your environment.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 15 min read.

What happened, in plain words

A group of security researchers found a way to make well-known, trusted programs run other programs for them. The trick is to start a program such as Google Chrome, Microsoft Edge or Microsoft Teams with special extra instructions on its command line, and those instructions tell the program to launch a different program instead of the helper process it would normally launch. Because the program doing the launching is a legitimate, digitally signed application, security tools tend to trust what it does. The researchers call this proxy execution: the trusted program acts as a middleman, or proxy, for whatever the attacker wants to run.

The researchers, Uriel Kosayev (@MalFuzzer), Hai Vaknin (@VakninHai), Tamir Yehuda (@Tamirye94) and Matan Bahar (@Bl4ckShad3), describe how a single GitHub commit led them to this capability in a wide range of binaries. In their framing, it could let an attacker execute any binary, bypass defences and potentially gain initial access as part of weaponised malware in red team operations. They confirmed it works on Windows, macOS and Linux, reported it to Google and to the Electron framework team, and were told it was not considered an issue. They then wrote a detection rule for defenders.

Uriel Kosayev
Uriel Kosayev From the original on medium.com

The background you need first

What Electron and Chromium are

Electron is an open-source framework for building desktop applications with web technologies. Instead of writing a separate program for each operating system, a developer writes something that looks a lot like a website, and Electron wraps it into an app you can install and click. Electron combines two pieces:

  • The Chromium rendering engine, which is the part of a browser that turns HTML, CSS and JavaScript into the page you see. Chromium is the same engine that powers Google Chrome, and it is the foundation for several browsers, including Google Chrome, Microsoft Edge and Opera. It is also part of the code base of applications such as Discord, Visual Studio Code, Postman and Notion.
  • The Node.js runtime, which gives the application native capabilities, meaning it can do things a web page in a browser cannot, such as read files or start other programs on your computer.

A simple comparison: Chromium is the engine and the dashboard of a car, and Node.js is the ability to open the boot and take things out. Electron bolts the two together so the car can both drive and carry cargo.

What proxy execution means

Proxy execution is making a trusted, signed binary run an arbitrary executable on the attacker's behalf. A binary is a compiled program file, the kind of file you double-click to run. Signed means the file carries a digital signature from its publisher, a cryptographic stamp that lets the operating system and security tools check that the file really comes from that publisher and has not been tampered with. Security software often treats signed programs more leniently than unsigned ones, because most signed programs are legitimate. Proxy execution abuses that trust: the signed program is not malicious, but it is tricked into starting something that is.

What a command line and a switch are

When you start a program, you can give it extra instructions called command-line arguments or switches. You have probably seen this without knowing the name: a shortcut on your desktop has a "Target" field, and anything typed after the program path there is passed to the program at startup. Switches usually begin with two hyphens, like --disable-gpu-sandbox. Programs read them and change their behaviour accordingly. Some switches exist for developers and testing, and they are not meant to be used by ordinary users.

What a sandbox is

A sandbox is a security boundary that limits what a piece of code is allowed to touch. Browsers run parts of themselves in sandboxes so that if a malicious website manages to break into one part, the damage stays contained, like a passenger in a locked compartment of a train rather than loose in the driver's cab. A switch that disables a sandbox removes that boundary.

Where it all started

The starting point was a commit by security researcher mr.d0x to the LoLBAS project. A commit is a saved change in a shared code repository, the kind of thing developers use to track edits to a project; anyone can read the history. LoLBAS stands for Living Off the Land Binaries, Applications and Scripts: a catalogue of legitimate programs already present on a computer that an attacker can misuse instead of bringing their own tools. The commit highlighted potential bypasses of security mechanisms and pointed specifically at Teams and MSEdge.

The authors wanted to understand why the attack works on both of those applications, so they examined the binaries themselves rather than taking the commit at face value. That is a common research habit: when you see one example, you look for the shared cause behind it.

The tools they used

The analysis relied on a small set of tools:

  • Detect-it-Easy, to check how the binaries are detected. This is a program that inspects an executable file and reports what frameworks and compilers it appears to be built with.
  • Total PE, written by Pavel Yosifovich (@zodiacon), to validate the section names inside the executables. A PE file is a Portable Executable, the standard file format for programs on Windows. Every PE file is divided into named sections, which are like chapters in a book: one holds the code, another holds data, and so on. Total PE is a viewer that lists those sections.
  • A simple Python script, written by the authors, to check for existing arguments in the previously referenced file and to recursively enumerate all executables in a pristine Windows environment for potentially vulnerable Electron-based executables. Python is a popular programming language often used for small automation tasks; "recursively enumerate" means walking through every folder and subfolder and listing every program file found.
  • A Sysmon rule, written by the authors, for detection. Sysmon is a free monitoring tool from Microsoft that records detailed events on a Windows machine, including every time a program starts another program.

No accounts, roles or specific application versions are described beyond the binaries named in the text.

Finding it

The authors began with two applications that both support the command-line arguments --disable-gpu-sandbox and --gpu-launcher: msedge.exe and Teams.exe.

Their first step was to check for strings referencing the Electron framework inside both binaries, then to check references in the disassembled code. A string here means readable text embedded in a program file, such as a library name or a message. Disassembly is the process of turning a compiled program back into a human-readable list of low-level instructions, so a researcher can see what the program actually does. The reasoning was: if both programs contain Electron-related text and the same switches, they probably share the same underlying engine, and the same trick should work on both.

They then validated that --disable-gpu-sandbox and --gpu-launcher are part of the Chromium project, alongside more than 250 other arguments, as shown in a screenshot of the Chromium content_switches.cc file. The file is linked in the report at content/public/common/content_switches.cc in the Chromium repository.

Using Detect-it-Easy on both msedge.exe and Teams.exe, they found that both are detected as executables using the Electron package. The signature logic behind that detection is: if both the CPADinfo and .00cfg sections exist, the Electron framework is present. In other words, the tool looks for two particular section names inside the file and treats their presence as a fingerprint. The authors note that this kind of signature can raise a false positive, meaning it can flag a file that is not actually Electron-based, and will not always be accurate, so that has to be taken into account. They confirmed that both executables are compiled with both sections using Total PE.

Further investigation turned up additional arguments that allow code execution:

  • chrome.exe --disable-gpu-sandbox --gpu-launcher="calc.exe"
  • chrome.exe --utility-cmd-prefix="calc.exe"
  • chrome.exe --no-sandbox --browser-subprocess-path="C:\Windows\System32\calc.exe
  • chrome.exe --no-sandbox --renderer-cmd-prefix="calc.exe"

Each line pairs a switch that weakens a boundary (--disable-gpu-sandbox or --no-sandbox) with a switch that names a program to start (--gpu-launcher, --utility-cmd-prefix, --browser-subprocess-path or --renderer-cmd-prefix). calc.exe is the Windows calculator, a harmless program researchers use as a visible proof that code ran.

The authors then checked whether the attack path is possible on other operating systems and found that it can be exploited on Windows, macOS and Linux. They also asked ChatGPT about the scope of vulnerable applications, and wrote the Python script described above. On a fresh Windows machine, the files that can be used for proxy execution were:

  • C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe
  • C:\Program Files (x86)\Microsoft\Edge\Application\114.0.1823.43\msedgewebview2.exe

Both are part of Microsoft Edge. The second one, msedgewebview2.exe, is the component that lets other applications display web content inside their own windows.

Exploiting the proxy-execution vulnerability

The authors present the exploitation as three short commands, one per operating system. In each case the goal is the same: start a trusted browser with switches that make it launch a command of the attacker's choosing.

Step 1: Run an arbitrary command through Chrome on Windows

Text
"C:\Program Files\Google\Chrome\Application\chrome.exe" --disable-gpu-sandbox --gpu-launcher="C:\Windows\system32\cmd.exe /c calc.exe

Line by line:

  1. "C:\Program Files\Google\Chrome\Application\chrome.exe" is the full path to the Chrome program, in quotes because the path contains spaces. This is the trusted, signed program that will do the launching.
  2. --disable-gpu-sandbox tells Chrome not to put its GPU process inside a sandbox. The GPU process is the part that handles graphics; the sandbox normally restricts what it can do.
  3. --gpu-launcher="C:\Windows\system32\cmd.exe /c calc.exe tells Chrome which program to start as that GPU process. Instead of the expected internal component, it is given the Windows command interpreter, cmd.exe, with /c calc.exe, which means "run the calculator and then stop".

So Chrome is launched with the GPU sandbox disabled and with --gpu-launcher set to a command line. The launcher value is the program the browser starts for the GPU process, so the supplied command runs instead of the expected GPU process binary. The calculator appearing on screen is the proof.

Step 2: Run an arbitrary command through Chrome on macOS

Text
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-gpu-sandbox --gpu-launcher="/bin/bash -c whoami"

Line by line:

  1. /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome is the path to the Chrome program on a Mac. The backslash before each space is an escape character: it tells the shell that the space is part of the name, not a separator between arguments. On macOS, applications are folders ending in .app, and the actual program lives inside at Contents/MacOS/.
  2. --disable-gpu-sandbox is the same switch as on Windows, turning off the sandbox around the GPU process.
  3. --gpu-launcher="/bin/bash -c whoami" names the program to start instead: /bin/bash, the standard command shell on macOS and Linux, with -c whoami, meaning "run the whoami command". whoami is a tiny program that prints the name of the user account currently running it.

The same two switches are used on macOS, with /bin/bash -c whoami as the launcher, which runs whoami through bash.

Step 3: Run an arbitrary command through Chrome on Linux

Text
google-chrome --utility-cmd-prefix="/bin/bash -c whoami"

Line by line:

  1. google-chrome is the name of the Chrome launcher on Linux. Because it is a plain name rather than a full path, the system looks it up in the list of installed programs.
  2. --utility-cmd-prefix="/bin/bash -c whoami" tells Chrome to put the given command in front of the program it starts for its utility processes. Utility processes are background helpers the browser uses for various jobs. The prefix here is bash running whoami, so that command is executed as part of starting the helper.

On Linux the authors used --utility-cmd-prefix instead of the GPU launcher switches, again running whoami through bash.

The report also refers to a PoC video and to screenshots of proxy execution on Windows, macOS and Linux, but the text does not include the video or the screenshots themselves. A PoC, or proof of concept, is a small demonstration that shows a problem is real without being a full attack tool.

Why it works

A child process is a program started by another program; the starter is the parent.

The authors reported the problem to Google and directly to the Electron framework team, but those teams did not view it as an issue. The report does not describe any code change or mitigation from either team.

What an attacker could do with it

The authors frame this as a way to bypass defence systems and potentially gain initial access as part of weaponised malware in red team operations. Initial access is the first foothold an attacker gets on a target machine. Red team is a group of security professionals who simulate attackers, with permission, to test an organisation's defences. The capability was confirmed on Windows, macOS and Linux, and the binaries identified on a fresh Windows machine were msedge.exe and msedgewebview2.exe under the Edge application directory. The report does not give a severity rating or a bounty.

Detection

The authors created the following Sysmon rule to help incident responders and blue teams detect exploitation attempts. Incident responders are the people who investigate and contain a security incident; blue teams are the defenders, as opposed to the attacking red teams.

XML
<RuleGroup name="" groupRelation="or">    <ProcessCreate onmatch="include">        <Image condition="end with">.exe</Image>        <CommandLine condition="contains">--gpu-launcher</CommandLine>        <CommandLine condition="contains">--utility-cmd-prefix</CommandLine>        <CommandLine condition="contains">--browser-subprocess-path</CommandLine>        <CommandLine condition="contains">--renderer-cmd-prefix</CommandLine>    </ProcessCreate></RuleGroup>

Line by line:

  1. <RuleGroup name="" groupRelation="or"> opens a group of conditions. groupRelation="or" means the group matches if any of its conditions match, not all of them.
  2. <ProcessCreate onmatch="include"> says this rule watches for process creation events, the moment one program starts another, and that matching events should be included in the output.
  3. <Image condition="end with">.exe</Image> checks the image, which is the name of the program being started, and requires it to end with .exe, the usual extension for Windows programs.
  4. <CommandLine condition="contains">--gpu-launcher</CommandLine> checks the command line of the new process for the text --gpu-launcher.
  5. The next three lines do the same for --utility-cmd-prefix, --browser-subprocess-path and --renderer-cmd-prefix, the other switches the authors found useful to an attacker.
  6. </ProcessCreate></RuleGroup> closes the event block and the group.

The rule matches process creation events where the image ends in .exe and the command line contains one of the four switches. The report says an example alert generated by this configuration is shown, but the alert itself is not included in the text.

The authors also offer detection logic suggestions:

  • Check that all the child processes in the execution chain are signed. If a trusted browser suddenly starts an unsigned program, that is worth investigating.
  • Exclude needed and legitimate processes, each organisation with its own list. In other words, tune the rule so that normal business software does not drown the alerts in noise.

Variants to test

If you want to reproduce or extend the research, the authors' findings suggest a few directions:

  • Run other Electron-based applications with --gpu-launcher, --utility-cmd-prefix, --browser-subprocess-path or --renderer-cmd-prefix set to a benign command. A positive result is the command running as a child of the trusted application.
  • Test the same switches on Windows, macOS and Linux builds of the same application, since the authors found the path works on all three.
  • Check binaries for the CPADinfo and .00cfg sections with Total PE or a similar tool as a quick indicator of Electron usage, keeping in mind the false positive risk the authors describe.
  • Enumerate executables on a clean installation of the target operating system and test each candidate, as the authors did with their Python script.
  • Deploy the Sysmon rule above and confirm that process creation events carrying these switches generate alerts in your environment.

Glossary

  • Binary: a compiled program file that the computer can run directly.
  • Blue team: the defenders in a security exercise or organisation, responsible for detecting and responding to attacks.
  • Child process: a program started by another program, the parent.
  • Chromium: the open-source browser engine that powers Google Chrome, Microsoft Edge, Opera and others, and that Electron is built on.
  • Command line: the text used to start a program, including the program path and any extra instructions after it.
  • Command-line argument (switch): an extra instruction passed to a program at startup, usually starting with two hyphens.
  • Commit: a saved change in a shared code repository.
  • CPADinfo / .00cfg: names of sections inside a Windows executable; their presence is used as a fingerprint for the Electron framework.
  • Detect-it-Easy: a tool that inspects an executable and reports what it appears to be built with.
  • Disassembly: turning a compiled program back into a readable list of low-level instructions.
  • Electron: an open-source framework for building desktop applications with web technologies, combining Chromium and Node.js.
  • False positive: an alert or detection that fires on something harmless.
  • GPU process: the part of a browser that handles graphics.
  • Initial access: the first foothold an attacker gains on a target machine.
  • Incident responder: a person who investigates and contains a security incident.
  • LoLBAS: Living Off the Land Binaries, Applications and Scripts, a catalogue of legitimate programs that attackers can misuse.
  • Node.js runtime: software that lets an application do native things, such as reading files or starting programs.
  • PE (Portable Executable): the standard file format for programs on Windows.
  • PoC (proof of concept): a small demonstration showing that a problem is real.
  • Proxy execution: making a trusted, signed program run another program on the attacker's behalf.
  • Python: a popular programming language often used for small automation tasks.
  • Red team: security professionals who simulate attackers, with permission, to test defences.
  • Sandbox: a security boundary that limits what a piece of code is allowed to touch.
  • Section: a named part of a PE file, such as the part holding code or data.
  • Signed: carrying a digital signature from a publisher, used to prove the file's origin and integrity.
  • String: readable text embedded in a program file.
  • Switch: see command-line argument.
  • Sysmon: a free Microsoft tool that records detailed events on a Windows machine, including process creation.
  • Total PE: a tool by Pavel Yosifovich that lists the sections inside a Windows executable.
  • Utility process: a background helper process a browser uses for various jobs.
  • whoami: a small command that prints the name of the user account currently running it.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.