SECURITY ADVISORY / 01

CVE-2026-41651 Exploit & Vulnerability Analysis

Complete CVE-2026-41651 security advisory with proof of concept (PoC), exploit details, and patch analysis for packagekit.

packagekit products NVD ↗
Exploit PoC Vulnerability Patch Analysis

1. Vulnerability Background

What is this vulnerability?

  • CVE-2026-41651 is a local privilege escalation in PackageKit, a D-Bus based package management abstraction used by many Linux distributions.
  • The issue is a TOCTOU race on transaction metadata: an unprivileged user can corrupt transaction authorization flags after PackageKit has authorized a package install, but before the transaction is executed.

Why is it critical/important?

  • PackageKit is a privileged system service that mediates package installation and removal.
  • Exploitation allows arbitrary RPM installation as root, including execution of RPM scriptlets, from an unprivileged account.
  • This bypasses local authentication controls and leads directly to root compromise on affected hosts.

What systems/versions are affected?

  • PackageKit versions from 1.0.2 through 1.3.4 are affected.
  • The fix is included in PackageKit 1.3.5.
  • RPM-based distributions using PackageKit as the frontend and package backend are the primary impacted platforms.

2. Technical Details

Root cause analysis

  • The root cause lies in src/pk-transaction.c.
  • InstallFiles() unconditionally writes user-supplied flags into transaction->cached_transaction_flags even if the transaction has already transitioned into an authorized or running state.
  • pk_transaction_set_state() rejects backward transitions silently. If a second call attempts to move the transaction from RUNNING back to WAITING_FOR_AUTH, the state change is discarded, but the corrupted flags written by InstallFiles() remain.
  • The scheduler then reads cached_transaction_flags at dispatch time (lines 2273–2277), not at authorization time, meaning the backend can receive attacker-controlled flags later in the transaction lifecycle.

Attack vector and exploitation conditions

  • The attacker needs local access to the PackageKit D-Bus API.
  • The exploit requires a race between the authorization phase and execution phase of a transaction.
  • The attacker triggers a legitimate transaction and then issues a second call that overwrites cached transaction flags before the system dispatches the backend.
  • Because the state machine suppresses the invalid backward transition, the transaction continues running with corrupted flags rather than failing.

Security implications

  • The attacker can force PackageKit to install arbitrary RPM packages as root.
  • RPM scriptlets execute with root privileges, making it trivial to escalate to a full root shell or persist malicious code.
  • The attack bypasses normal PackageKit authentication and policy controls.
  • This is a direct local privilege escalation vulnerability, affecting any host where PackageKit runs and local user accounts exist.

3. Patch Analysis

What code changes were made?

  • The patch is applied in PackageKit 1.3.5 and is referenced by commit 76cfb675fb31acc3ad5595d4380bfff56d2a8697.
  • The relevant fixes are in the transaction handling logic, specifically the code paths around InstallFiles(), pk_transaction_set_state(), and scheduler dispatch.

How do these changes fix the vulnerability?

  • InstallFiles() is hardened so it no longer overwrites transaction->cached_transaction_flags once a transaction is already authorized or running.
  • The transaction state machine is tightened so illegal backward transitions cannot be discarded silently; invalid transitions now fail cleanly instead of allowing a corrupted transaction to continue.
  • The scheduler is adjusted to use the authorized transaction flags as of the authorization moment, rather than reading potentially tampered flags at dispatch time.

Security improvements introduced

  • The patch removes the race condition in transaction flag handling.
  • It enforces stronger consistency between transaction state and authorization metadata.
  • It reduces the attack surface of PackageKit’s asynchronous transaction model by preventing late-stage flag tampering.

4. Proof of Concept (PoC) Guide

Prerequisites for exploitation

  • Local unprivileged account on a system running PackageKit 1.0.2–1.3.4.
  • A distribution using PackageKit with the RPM backend.
  • Access to PackageKit D-Bus methods or tools that can drive PackageKit transactions.

Step-by-step exploitation approach

  1. Create a PackageKit transaction that requires authorization for package installation.
  2. Allow the transaction to reach the state where authorization has been granted but execution has not yet completed.
  3. Issue a second InstallFiles()-style call (or equivalent API request) that supplies attacker-controlled transaction flags.
  4. Because InstallFiles() unconditionally overwrites cached flags, the transaction now carries attacker-controlled flags.
  5. Wait for the scheduler to dispatch the transaction; it reads cached_transaction_flags at execution time and uses the corrupted flags.
  6. The backend proceeds to install the attacker-chosen RPM as root.

Expected behavior vs exploited behavior

  • Expected behavior: PackageKit should preserve the flags authorized during the initial transaction setup and reject any unauthorized modification after that point.
  • Exploited behavior: PackageKit accepts the second call, corrupts the cached transaction flags, silently ignores the invalid state regression, and executes the transaction with attacker-supplied privileges.

How to verify the vulnerability exists

  • Attempt to perform an unauthorized install via PackageKit on a vulnerable version; if successful, the vulnerability exists.
  • A practical test is to use a benign RPM with a root-owned scriptlet that writes to /root or a system directory. If the unprivileged user can cause the package to install and the scriptlet executes, the vulnerability is confirmed.
  • Verify with rpm -qp --scripts <package> and check system logs for PackageKit transaction records.
  • On patched systems, the second flag overwrite should be rejected or the transaction should fail cleanly.

5. Recommendations

Mitigation strategies

  • Upgrade PackageKit to version 1.3.5 or later immediately.
  • If patching is not immediately possible, restrict local access to PackageKit’s D-Bus interface and disable PackageKit if it is not needed.
  • Use SELinux/AppArmor policies to limit which users and processes can interact with package management services.

Detection methods

  • Audit PackageKit D-Bus traffic and transaction method calls for unusual repeated state transitions.
  • Monitor package installation logs for installs initiated by unexpected local accounts.
  • Use system auditing to detect unauthorized access to /usr/libexec/packagekitd or similar PackageKit daemon activity.

Best practices to prevent similar issues

  • Avoid mutable cached authorization state in asynchronous workflows.
  • Do not allow state machine transitions to fail silently; invalid transitions should return explicit errors and abort the operation.
  • Read authorization flags at the time of authorization and bind them immutably to the transaction, rather than re-reading them at execution time.
  • Review transaction-oriented code for TOCTOU vulnerabilities, especially when unprivileged input can influence privileged service state.

Frequently asked questions about CVE-2026-41651

What is CVE-2026-41651?

CVE-2026-41651 is a security vulnerability identified in packagekit. This security advisory provides detailed technical analysis of the vulnerability, exploit methodology, affected versions, and complete remediation guidance.

Is there a PoC (proof of concept) for CVE-2026-41651?

Yes. This writeup includes proof-of-concept details and a technical exploit breakdown for CVE-2026-41651. Review the analysis sections above for the PoC walkthrough and code examples.

How does CVE-2026-41651 get exploited?

The technical analysis section explains the vulnerability mechanics, attack vectors, and exploitation methodology affecting packagekit. PatchLeaks publishes this information for defensive and educational purposes.

What products and versions are affected by CVE-2026-41651?

CVE-2026-41651 affects packagekit. Check the affected-versions section of this advisory for specific version ranges, vulnerable configurations, and compatibility information.

How do I fix or patch CVE-2026-41651?

The patch analysis section provides guidance on updating to patched versions, applying workarounds, and implementing compensating controls for packagekit.

What is the CVSS score for CVE-2026-41651?

The severity rating and CVSS scoring for CVE-2026-41651 affecting packagekit is documented in the vulnerability details section. Refer to the NVD entry for the current authoritative score.