Summary
PackageKit fails to enforce polkit authorization for transactions marked as simulations when the dnf5 backend handles repository removal. Because the handler performs the real uninstall instead of a dry run, an unprivileged local user may remove installed packages without the intended authorization.
Affected context
The issue occurs on systems that use PackageKit together with its dnf5 backend. It requires a transaction to reach the repository-removal handler with the SIMULATE flag set, while the handler incorrectly proceeds with the actual package operation and the expected polkit authorization check is skipped.
Exploit preconditions
- Attack surface: Local PackageKit transaction interface - Required access: An unprivileged local account able to submit PackageKit
transactions
- Trigger point: A repository-removal transaction marked as a simulation - Why exploitation is possible: The dnf5 RepoRemove handler treats the
transaction as executable regardless of the SIMULATE flag, bypassing the
authorization contract and performing the real operation
Why this happens
The underlying bug is an authorization-state handling error in the dnf5 backend. A conditional intended to permit repository removal only during simulation or to reject unauthorized execution is logically constructed so that the RepoRemove role always satisfies the guard. This causes a dry-run request to be treated as a real transaction and maps to CWE-863, Missing Authorization, because a privileged package-management action proceeds without the required authorization decision.
Potential impact
- An unprivileged local user may remove installed packages
- Required software components could become unavailable
- System functionality or service availability could be disrupted
- Security tooling or protective packages could be removed
- Package-management policy boundaries could be weakened
General mitigation guidance
Mitigation generally focuses on preserving authorization invariants across all transaction modes. Backends should enforce polkit authorization before any state-changing operation, distinguish simulation from execution through explicit and independently validated transaction states, and use secure-by-default handling for privileged package actions. Input trust can be reduced by deriving execution mode from validated internal state rather than relying solely on caller-supplied flags. Package-management services should also run with the minimum practical privileges and apply policy controls that limit which local users may request destructive operations.
How teams detect issues like this
Detection can include static analysis for authorization checks that depend on tautological or role-specific boolean conditions, and code review of every backend path that converts a dry-run request into a state-changing action. Dynamic tests should verify that simulated transactions never modify package state and that authorization is evaluated consistently across transaction roles. Policy enforcement can require explicit authorization coverage for destructive PackageKit operations, while automated review tools may help identify mismatches between transaction flags and privileged effects.

