Skip to content

Windows uninstaller runs from %TEMP%, which other accounts may write #1530

Open

Description

@AnthonyRonning

The Windows uninstaller still runs from %TEMP%, so when TEMP is a folder other accounts can write (such as C:\Temp), another local user could replace it before it starts.

Cause

Apps & Features runs "<install root>\uninstall.exe". Every NSIS uninstaller first copies itself to %TEMP%\~nsu<N>.tmp\Un.exe and runs that copy with _?=<install root>, so it can delete its own file (NSIS Main.c, the ~nsu%X.tmp loop). NSIS locks that folder down only when the uninstaller is elevated (UserIsAdminGrpMember). Ours runs as the user, so the folder inherits TEMP's permissions. No uninstaller script runs before the copy starts, so the .nsi cannot change this.

Scope

Possible fix

Register an uninstall command that starts somewhere private, for example maple-agent.exe --uninstall. That command would copy uninstall.exe into a protected per-run folder under %LOCALAPPDATA%\Maple Work Installer Staging, check its signature, and run it with _?=<install root>. This keeps the existing native checks, and the uninstaller can still delete the installed copy.

How to test

Use the QA VM windows-11:

  • Set TEMP=C:\Temp and grant Users:Modify on it.
  • Uninstall from Apps & Features while a watcher lists C:\Temp\~nsu*. Today Un.exe appears there.
  • Confirm uninstall still removes the root and shortcuts.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions