🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

Windows binaries trigger a UAC elevation prompt because the file name contains update #10539

Done
awhite0030/updatecli
#46

Description

@zchcc

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Image

Running updatecli build artifacts on Windows (both the official release updatecli.exe and a local
make build output dist/updatecli_windows_amd64_v1/updatecli.exe) triggers a UAC elevation prompt,
or fails outright when launched non-interactively:

The requested operation requires elevation.   (Win32 error 740 = ERROR_ELEVATION_REQUIRED)

This is unrelated to updatecli's own code. Windows Installer Detection classifies executables
whose file name contains the keywords install, setup or update as installers and forces them to
start elevated. updatecli binaries embed no application manifest (hence no
requestedExecutionLevel), so the heuristic applies — and the update in updatecli matches a
keyword.

Expected Behavior

A plain CLI tool that does not declare requestedExecutionLevel=requireAdministrator should not ask
for administrator rights when launched from Explorer or a shell. Installer detection is only supposed
to kick in for candidates without a requestedExecutionLevel; updatecli is being misclassified as an
installer, and the correct fix is to declare asInvoker explicitly so the heuristic is bypassed.

Steps To Reproduce

Option 1 (official artifact, fastest): double-click updatecli.exe in Explorer, or run
.\updatecli.exe version in PowerShell / Windows Terminal.

Option 2 (measurable, proves the file name is the only variable): keep the exact same bytes and only
rename the file, then launch it through CreateProcess (Go's os/exec, C's CreateProcessW,
PowerShell's Start-Process are all equivalent):

cd <extracted-directory>
Copy-Item .\updatecli.exe .\mytool.exe
Copy-Item .\updatecli.exe .\myupdater.exe
Copy-Item .\updatecli.exe .\updatecli_check.exe
Get-FileHash .\updatecli.exe, .\mytool.exe, .\myupdater.exe, .\updatecli_check.exe   # all hashes identical

Then execute each of them (e.g. .\mytool.exe version).

Option 3 (minimal repro, detached from updatecli):

go build -o plain.exe .        # main.go: func main() { fmt.Println("hello") }
copy plain.exe updateprobe.exe # same bytes, only the file name changes

Run plain.exe and updateprobe.exe.


Actual behavior

File name (identical bytes) Keyword hit Result
updatecli.exe update ❌ errno 740 ERROR_ELEVATION_REQUIRED
updatecli_check.exe update ❌ errno 740
myupdater.exe update ❌ errno 740
setup_x.exe (earlier run, same bytes) setup ❌ errno 740
mytool.exe none ✅ runs fine
updcli_check.exe none ✅ runs fine

Minimal repro (Go hello world, 2.5 MB):

./hello/plain.exe        -> OK
./hello/updateprobe.exe  -> errno=740 (The requested operation requires elevation.)

Interactively: double-clicking in Explorer shows the "Do you want to allow this app to make changes
to your device?" consent dialog; running .\updatecli.exe version from PowerShell fails with
This command cannot be run due to the error: The requested operation requires elevation.
Both paths surface the same ERROR_ELEVATION_REQUIRED returned by the AppInfo service at
CreateProcess time.

Environment

| Item | Value |
| --- | --- |
| OS | Windows 11 Enterprise LTSC 2024, `10.0.26100` |
| Session | Interactive, non-elevated administrator (Admin Approval Mode, UAC on) |
| updatecli | v0.121.0, asset `updatecli_Windows_x86_64.zip` |
| Asset SHA-256 | `e1dfc533b49398e9c813098804619e483b802ee790fc460b435380dc560ef916` (zip) |
| `updatecli.exe` SHA-256 | `ea63c838a2c8bc77f069f8e5b4f4db7200672d6c745aa086496c3dfbf68b8891` |
| Binary | 139,365,888 bytes, PE32+ / `IMAGE_FILE_MACHINE_AMD64`, Subsystem 3 (Console), `CGO_ENABLED=0` |
| Go (for the minimal repro) | `go1.27.1 windows/amd64` |
| Relevant policy | `EnableInstallerDetection = 1`, `EnableLUA = 1`, `ConsentPromptBehaviorAdmin = 5`, `ValidateAdminCodeSignatures = 0` (`HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System`) |

Pipeline Graph

OpenTelemetry Trace

No response

Anything else?

Root cause

  1. Windows Installer Detection (implemented by the AppInfo service, governed by the
    User Account Control: Detect application installations and prompt for elevation policy, enabled
    by default) inspects an executable before process creation. The checked attributes include: file
    name keywords (install, setup, update); version-resource fields (Vendor, Company Name,
    Product Name, File Description, Original Filename, Internal Name, Export Name); the embedded
    side-by-side manifest; specific StringTable entries; resource data; and targeted byte sequences.
  2. The same documentation states the override: when the embedded manifest contains a
    requestedExecutionLevel, Installer Detection is bypassed
    ("When the requestedExecutionLevel is
    present in the embedded application manifest, it overrides Installer Detection.").
  3. This repository does not satisfy the override condition:
    • updatecli.exe has no .rsrc section; the strings requestedExecutionLevel, trustInfo and
      VS_VERSION_INFO are absent from the binary (the Go linker emits neither a manifest nor version
      resources by default);
    • the repo contains no .syso, .rc or .manifest file, and .goreleaser.yml has no windows:
      metadata section.
  4. The only matching check is therefore the file name: updatecli contains update → classified
    as an installer/updater → CreateProcess returns ERROR_ELEVATION_REQUIRED (740) → ShellExecute
    takes the elevation path and shows the UAC prompt.
  5. It fires regardless of architecture: the Vista-era documentation claims "Installer Detection only
    applies to: 1. 32 bit executables", yet on Windows 11 26100 the heuristic demonstrably fires for
    PE32+ amd64 binaries, so that statement is outdated and "we are 64-bit" is not an exemption.

Proposed fix

Embed an application manifest that declares asInvoker (verified: the same updateprobe.exe file
name returns errno 740 without the manifest and runs normally with it):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>

Integration:

  1. Add winres/manifest.xml (or a go-winres winres.json resource description);

  2. Generate resource objects, relying on Go's per-suffix inclusion so non-Windows builds are
    unaffected:

    rsrc -manifest winres/manifest.xml -arch amd64 -o rsrc_windows_amd64.syso
    rsrc -manifest winres/manifest.xml -arch arm64 -o rsrc_windows_arm64.syso
  3. Invoke it from .goreleaser.yml's before.hooks (same pattern as the existing
    scripts/completions.sh and scripts/manpages.sh), or simply commit the .syso files;

  4. Optional: also add version resources. Make sure fields such as FileDescription do not contain
    install / setup / update — the current description A declarative update policy engine.
    contains update, which is a separate heuristic attribute (harmless once the manifest is present,
    but not worth betting on).


Workaround

Rename the binary so it does not contain the keywords (verified: mytool.exe and updcli_check.exe
run fine). Downside: it diverges from the documented binary name and shell completions, so it is not
a long-term fix. On managed machines, disabling User Account Control: Detect application installations and prompt for elevation via secpol.msc / Group Policy also works, but that lowers
the security baseline and is not recommended.


Related reports and prior art

  • No existing report in this repository. As of 2026-09-17, searching issues (open and closed),
    pull requests and discussions of updatecli/updatecli for UAC, elevation, administrator,
    privilege, installer detection, requires admin, asInvoker, syso, manifest.xml and
    requestedExecutionLevel returns nothing related to this behaviour.

  • The same root cause has been reported in other projects:

  • Microsoft documentation:

  • Measured keyword matrix (same 2.5 MB hello-world binary, only the file name changes, Windows 11
    26100 amd64):

    Triggers elevation (740) Does not trigger
    update.exe, updater.exe, install.exe, installcli.exe, setup.exe, setupcli.exe, uninstall.exe patch.exe, upgrade.exe, version.exe, deploy.exe, mytool.exe, updcli.exe, hello.exe

    Note: patch and upgrade do not trigger on this build of Windows, even though they are often
    listed next to the documented keywords; uninstall does, because it contains install.


Appendix: verification harness

The following Go program launches the given executables via os/exec (i.e. CreateProcess) and
prints the Windows error code. It reproduces the table above without popping UAC (you only get the
740 error code; double-click in Explorer to see the prompt itself).

package main

import (
	"errors"
	"fmt"
	"os"
	"os/exec"
	"syscall"
)

func main() {
	for _, p := range os.Args[1:] {
		err := exec.Command(p, "version").Run()
		switch {
		case err == nil:
			fmt.Printf("%-24s -> OK\n", p)
		default:
			var errno syscall.Errno
			if errors.As(err, &errno) {
				fmt.Printf("%-24s -> errno=%d (%v)\n", p, uintptr(errno), errno)
			} else {
				fmt.Printf("%-24s -> %v\n", p, err)
			}
		}
	}
}
$ go run runprobe.go ./updatecli.exe ./mytool.exe ./myupdater.exe ./updcli_check.exe
./updatecli.exe          -> errno=740 (The requested operation requires elevation.)
./mytool.exe             -> OK
./myupdater.exe          -> errno=740 (The requested operation requires elevation.)
./updcli_check.exe       -> OK

Activity

  1. added
    bug
    on Sep 17, 2026
  2. olblak commented on Sep 23, 2026

    @olblak
    Member

    Thanks for the detailed issue, I didn't know we could avoid this situation without a code sign certificate

  3. mvanhorn commented on Nov 28, 2026

    @mvanhorn
    Contributor

    The executable had no manifest declaring its requested execution level. With installer detection enabled, Windows could treat the word update in the executable name as a reason to require elevation.

    The Windows amd64 and arm64 builds now embed a manifest declaring asInvoker, so updatecli inherits the caller’s privileges. The architecture-specific resource objects are checked in and can be regenerated with go generate.

    #11547

  4. moved this from Todo to Done in updateclion Dec 1, 2026
  5. added a commit that references this issue on Dec 2, 2026
    46cb851
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions