CVE-2021-4034

7.8 HIGH

📋 TL;DR

CVE-2021-4034 (PwnKit) is a local privilege escalation vulnerability in polkit's pkexec utility that allows unprivileged local users to gain root privileges by exploiting improper argument handling. This affects all Linux systems with polkit installed, which is present by default on most modern Linux distributions. The vulnerability is particularly dangerous because it's easy to exploit and requires no user interaction.

💻 Affected Systems

Products:
  • polkit
  • pkexec
Versions: All versions from initial release up to and including polkit 0.120
Operating Systems: Linux distributions including RHEL, CentOS, Ubuntu, Debian, SUSE, Fedora, and others
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerable if polkit is installed, which is default on most modern Linux distributions. Some minimal/containerized installations may not have polkit.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise where any local user (including low-privileged service accounts) can gain root privileges and execute arbitrary code with full system control.

🟠

Likely Case

Local privilege escalation leading to administrative access, data theft, persistence establishment, and lateral movement within the environment.

🟢

If Mitigated

Limited impact if proper access controls, least privilege principles, and monitoring are in place to detect privilege escalation attempts.

🌐 Internet-Facing: LOW - This is a local privilege escalation vulnerability requiring local access to the system.
🏢 Internal Only: HIGH - Any compromised low-privileged account or service within the internal network can escalate to root, making this extremely dangerous for internal systems.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: CONFIRMED
Unauthenticated Exploit: ✅ No
Complexity: LOW

Multiple public proof-of-concept exploits are available. Exploitation requires local access but no authentication beyond having a user account. The exploit is simple and reliable.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: polkit 0.121 and later

Vendor Advisory: https://access.redhat.com/security/vulnerabilities/RHSB-2022-001

Restart Required: No

Instructions:

1. Update polkit package using your distribution's package manager. 2. For RHEL/CentOS: 'yum update polkit'. 3. For Ubuntu/Debian: 'apt update && apt upgrade polkit'. 4. Verify the update installed polkit version 0.121 or higher.

🔧 Temporary Workarounds

Remove SUID bit from pkexec

linux

Removes the setuid permission from pkexec, preventing privilege escalation but breaking legitimate pkexec functionality

chmod 0755 /usr/bin/pkexec

Temporary mitigation via chmod 0

linux

Completely disables pkexec by removing execute permissions

chmod 0 /usr/bin/pkexec

🧯 If You Can't Patch

  • Implement strict access controls and limit local user accounts
  • Monitor for privilege escalation attempts and pkexec usage in logs

🔍 How to Verify

Check if Vulnerable:

Check polkit version: 'pkexec --version' or 'rpm -q polkit' or 'dpkg -l policykit-1'. If version is 0.120 or earlier, system is vulnerable.

Check Version:

pkexec --version 2>/dev/null || rpm -q polkit 2>/dev/null || dpkg -l policykit-1 2>/dev/null | grep ^ii

Verify Fix Applied:

Verify polkit version is 0.121 or higher: 'pkexec --version' should show 0.121+. Test with known exploit PoC to confirm failure.

📡 Detection & Monitoring

Log Indicators:

  • Unusual pkexec invocations
  • Failed privilege escalation attempts
  • Process execution with unexpected parent-child relationships

Network Indicators:

  • None - this is a local privilege escalation

SIEM Query:

process.name:"pkexec" AND user.name!="root" AND process.parent.name NOT IN ("sudo", "su", "systemd", "login")

🔗 References

📤 Share & Export