Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-41651-Python — Python proof-of-concept exploit for CVE-2026-41651, a TOCTOU local privilege escalation in PackageKit allowing unprivileged users to install packages as root. Includes check mode, custom payload support, and SUID bash dropper. | Kitploit
Tools/GitHubGitHub/mawussid/cve-2026-41651-python
Privilege EscalationVulnerability AnalysisExploitationPenetration TestingLearning & EducationPayload Development
GitHubmawussid/cve-2026-41651-python

CVE-2026-41651-Python

Python proof-of-concept exploit for CVE-2026-41651, a TOCTOU local privilege escalation in PackageKit allowing unprivileged users to install packages as root. Includes check mode, custom payload support, and SUID bash dropper.

Share
View Repository
1376 months agoNot yet reviewed

Pack2TheRoot: CVE-2026-41651 (Python)

Python PoC of the PackageKit TOCTOU Local Privilege Escalation exploit. Any local unprivileged user can install arbitrary packages as root with no authentication.

FieldValue
CVECVE-2026-41651
ComponentPackageKit daemon (packagekitd)
Affected versions1.0.2 – 1.3.4
Fixed in1.3.5
ImpactLocal Privilege Escalation → root

Disclaimer

This tool is provided for educational and authorized security research purposes only.


Requirements

Vulnerable OS: Any Linux distribution running PackageKit >= 1.0.2 <= 1.3.4.

PoC limitation: the built-in package builder only produces .deb files, so the script requires a Debian/Ubuntu host to run as-is. On RPM-based systems, supply a custom postinst payload via --payload-script and ensure dpkg/dpkg-dev is available, or adapt the builder.

Python: 3.6+

System packages (Debian/Ubuntu):

sudo apt install python3-dbus python3-gi gir1.2-glib-2.0

Note on dependencies: python3-dbus and python3-gi are not Python stdlib, but they are almost always already present on any machine running a graphical desktop environment (GNOME, KDE, XFCE, etc.), because these environments depend on them directly. On a standard Ubuntu Desktop install both libraries are available without any manual installation. On a minimal server without a GUI they may be absent, so in that case the apt install above requires sudo, which contradicts the LPE context. In practice, any machine running PackageKit with a desktop session will already have these dependencies satisfied.

gir1.2-glib-2.0 provides the GObject Introspection typelib files for GLib. python3-gi is the Python binding engine, but it needs these typelib files to know how to talk to GLib specifically. Without this package, from gi.repository import GLib fails even if python3-gi is installed. Both are pulled in automatically by any GNOME-based desktop.

Note on the stdlib-only attempt: A previous version of this PoC attempted to remove these dependencies entirely by replacing the D-Bus calls with gdbus/dbus-send subprocesses, then by speaking the D-Bus wire protocol directly over the Unix socket. Both approaches failed to reliably trigger the TOCTOU race: spawning external processes introduces enough latency between the two InstallFiles calls that PackageKit processes Step 1 before Step 2 arrives, breaking the race. The dbus-python binding sends both calls fire-and-forget on the same already-open socket with no fork overhead, which is what makes the timing work. The stdlib-only version has been reverted for this reason.

Verify PackageKit version (without the poc):

pkcon --version 2>/dev/null || dpkg -l packagekit | grep ^ii

Usage

usage: cve-2026-41651.py [-h] [--check] [--exec CMD]
                         [--payload-script FILE] [--suid-path PATH]
                         [--no-cleanup] [--timeout N] [--quiet]
FlagDescription
--checkQuery PackageKit version and report vulnerability, then exit
--exec CMDRun a single command as root instead of opening an interactive shell
--payload-script FILEUse a custom postinst script instead of the built-in SUID bash dropper
--suid-path PATHWhere to drop the SUID bash (default: /tmp/.suid_bash)
--no-cleanupKeep the SUID bash after the shell exits
--timeout NSeconds to poll for the SUID bash (default: 120)
--quietSuppress progress output (for scripting)

Examples:

# Check if the target is vulnerable (no exploit)
python3 cve-2026-41651.py --check

# Full exploit → interactive root shell
python3 cve-2026-41651.py

# Run a single command as root
python3 cve-2026-41651.py --exec "id"

# Custom payload (implant, SSH key injection…)
python3 cve-2026-41651.py --payload-script /tmp/hook.sh

# Keep the SUID bash after exit, custom path
python3 cve-2026-41651.py --suid-path /tmp/.mybash --no-cleanup

# Scriptable / fast mode
python3 cve-2026-41651.py --timeout 60 --quiet

Expected output:

═══════════════════════════════════════════════════
 CVE-2026-41651 / PackageKit TOCTOU LPE
═══════════════════════════════════════════════════
[*] Building packages (pure Python)...
[+] dummy   : /tmp/.pk-dummy-1337.deb
[+] payload : /tmp/.pk-payload-1337.deb
[*] Transaction : /1_acdcacbe
[*] Step 1 : InstallFiles(SIMULATE=0x4, dummy) [async]
[*] Step 2 : InstallFiles(NONE=0x0, payload) [async]
[*] Waiting for dispatch (30 s max)...
[!] PK error 48: Failed to obtain authentication.
[*] Finished (exit=2, 10 ms)
[*] Polling for payload (120 s max)...

[+] SUCCESS: SUID bash at t+200ms
uid=1001(victim) gid=1001(victim) euid=0(root) groups=1001(victim)

Credits

Based on the original C PoC by Vozec. This is a Python rewrite for portability. All credit for the exploit technique goes to the original author.

Python rewrite developed with the assistance of Claude (Anthropic).

Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    989
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    576
  • 3

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    354
  • 4

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    339
  • 5

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    323
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    315

Explore all tools

Browse our collection of tools

View all tools →