Skip to content

Broaden elevated process limitations - #6634

Open
JohnMcPMS wants to merge 10 commits into
microsoft:masterfrom
JohnMcPMS:portable-lock
Open

JohnMcPMS wants to merge 10 commits into
microsoft:masterfrom
JohnMcPMS:portable-lock

Conversation

@JohnMcPMS

@JohnMcPMS JohnMcPMS commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

📖 Description

Standardizes and broadens the blocks in place to prevent elevated processes from acting on data writable at a lower integrity level. The goal of this change is to prevent the potential for EoP attacks via system artifacts for packages.

I am hoping to follow it up reasonably soon with another change to allow these scenarios to function once again, but safely by running the intended action at a lower integrity level.

🔍 Validation

Tests are added, but mostly to ensure the security aspects. This will certainly cause failures in some scenarios that previously worked, but that is unavoidable without the much more complex change mentioned earlier.

Microsoft Reviewers: Open in CodeFlow

@JohnMcPMS
JohnMcPMS requested a review from a team as a code owner October 29, 2026 17:39
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical issues remain: elevated installs can consume attacker-controlled SQLite state, and forced reinstalls can fail then delete untouched installation data during rollback.

2 open issues
What changed in this PR

This PR broadens WinGet’s elevated-process restrictions to prevent package operations from using data writable without administrator privileges. It also separates fresh portable installations from operations that load existing installation state.

Changes:

  • Centralizes elevation checks across uninstall, repair, uninstall-previous, portable upgrades, and font operations.
  • Refactors portable installation state and SQLite cleanup, and derives dependency upgrade status independently.
  • Adds regression tests, consistent error messages, and release notes.
File Description
src/​Microsoft.Management.Deployment/​Converters.h Maps elevation rejection to an install error.
src/​AppInstallerSharedLib/​SQLiteStorageBase.cpp Adds database deletion and shared-memory sidecar handling.
src/​AppInstallerSharedLib/​Public/​winget/​SQLiteStorageBase.h Declares database cleanup API.
src/​AppInstallerSharedLib/​Errors.cpp Updates elevation error guidance.
src/​AppInstallerCommonCore/​Public/​winget/​ManifestCommon.h Declares installer-data classification helper.
src/​AppInstallerCommonCore/​Manifest/​ManifestCommon.cpp Classifies user-scope installer data by type.
src/​AppInstallerCLITests/​WorkflowBase.cpp Tests shared elevation guards.
src/​AppInstallerCLITests/​UpdateFlow.cpp Makes portable update tests independent of host elevation.
src/​AppInstallerCLITests/​UninstallFlow.cpp Expands user-scope uninstall protection tests.
src/​AppInstallerCLITests/​SQLiteWrapper.cpp Tests database and sidecar cleanup.
src/​AppInstallerCLITests/​RepairFlow.cpp Tests rejection before repair preparation.
src/​AppInstallerCLITests/​PortableInstaller.cpp Tests fresh, upgrade, and rollback state handling.
src/​AppInstallerCLITests/​InstallFlow.cpp Tests elevation rules for installation paths.
src/​AppInstallerCLITests/​InstallDependenciesFlow.cpp Tests dependency-specific upgrade state.
src/​AppInstallerCLITests/​AppInstallerCLITests.vcxproj.filters Groups the new workflow tests.
src/​AppInstallerCLITests/​AppInstallerCLITests.vcxproj Includes the new workflow tests in builds.
src/​AppInstallerCLIPackage/​Shared/​Strings/​en-us/​winget.resw Consolidates localized elevation errors and translation context.
src/​AppInstallerCLICore/​Workflows/​WorkflowBase.h Documents shared elevation guard contracts.
src/​AppInstallerCLICore/​Workflows/​WorkflowBase.cpp Implements shared elevation guards.
src/​AppInstallerCLICore/​Workflows/​UninstallFlow.cpp Applies centralized checks before uninstall preparation.
src/​AppInstallerCLICore/​Workflows/​ShellExecuteInstallerHandler.h Corrects repair workflow documentation.
src/​AppInstallerCLICore/​Workflows/​ShellExecuteInstallerHandler.cpp Removes the repair guard moved earlier in the workflow.
src/​AppInstallerCLICore/​Workflows/​RepairFlow.cpp Checks elevation before preparing repairs.
src/​AppInstallerCLICore/​Workflows/​PortableFlow.h Updates portable workflow contracts.
src/​AppInstallerCLICore/​Workflows/​PortableFlow.cpp Resolves installed scope and guards portable updates.
src/​AppInstallerCLICore/​Workflows/​InstallFlow.cpp Checks uninstall-previous and font installation support.
src/​AppInstallerCLICore/​Workflows/​FontFlow.h Declares and documents font elevation checks.
src/​AppInstallerCLICore/​Workflows/​FontFlow.cpp Guards font installation and removal by scope.
src/​AppInstallerCLICore/​Workflows/​DependenciesFlow.h Clarifies dependency context outputs and operation selection.
src/​AppInstallerCLICore/​Workflows/​DependenciesFlow.cpp Sets upgrade flags from each dependency’s installed state.
src/​AppInstallerCLICore/​Resources.h Replaces operation-specific elevation resource identifiers.
src/​AppInstallerCLICore/​PortableInstaller.h Makes operation type explicit and adjusts cleanup state.
src/​AppInstallerCLICore/​PortableInstaller.cpp Separates fresh installation from existing-state handling.
doc/​release-notes/​1.31/​user-scope-elevation-guards.md Documents restrictions and dependency fixes.

Review effort: Balanced

@github-actions

This comment was marked as outdated.

@JohnMcPMS

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants