CVE DatabaseCVE-2021-4034
한국어 권고문 →
CVE-2021-40347.8/HIGHCISA KEVCWE-787CWE-125CWE-787

Polkit pkexec Local Privilege Escalation (LPE) Vulnerability Analysis and Mitigation Guide (PwnKit, CVE-2021-4034)

⚡ Jump to Patch
Affected Vendors
polkit, redhat, debian, ubuntu, suse
Affected Components
polkit, pkexec
Published Date
2022-01-28
CVSS v3.1
7.8
HIGH
EPSS (30d)
94.9%
FIRST.org
CISA KEV
Exploited

Executive & SecOps Summary

SECOPS ASSESSMENT
Affected Scope

Almost all major Linux distributions (RedHat, Debian, Ubuntu, SUSE, etc.) with the Polkit (formerly PolicyKit) pkexec utility installed.

Impact

A local unprivileged attacker can exploit the vulnerable pkexec binary to bypass authorization policies and gain full root administrative privileges on the target host.

Mitigation

Apply official vendor security patches immediately, or remove the SUID permission (chmod 0755) from the pkexec binary as a temporary workaround.

Affected Products & Version Scope

All Polkit versions since its initial release in May 2009 are vulnerable unless patched.

Remediation & Live Workaround Commands

PATCH & WORKAROUND

1. Official Patch & Version Upgrade Commands

Update the polkit package to the latest version using your distribution's package manager.

bash
# For RedHat / CentOS / Rocky Linux systems
sudo dnf clean all
sudo dnf update polkit -y

# For Debian / Ubuntu systems
sudo apt-get update
sudo apt-get --only-upgrade install polkitd-pkexec -y || sudo apt-get --only-upgrade install policykit-1 -y

2. Temporary Workaround & Hardening Configuration

If patching is not immediately feasible, mitigate the risk by removing the SUID bit from the pkexec executable to prevent unprivileged execution.

bash
# Remove SUID permission from pkexec
sudo chmod 0755 /usr/bin/pkexec

# Verify that the SUID bit has been successfully removed
ls -l /usr/bin/pkexec

3. Log Audit & IoC Verification Commands

Audit system logs for potential exploitation attempts and verify the SUID status of the pkexec binary.

bash
# Search authentication logs for anomalous pkexec execution attempts
sudo grep -E 'pkexec.*local-user-auth' /var/log/secure /var/log/auth.log 2>/dev/null

# Script to check if the system is currently mitigated
if [ -u /usr/bin/pkexec ]; then
  echo '[WARNING] pkexec still has SUID bit set. Action required.';
else
  echo '[OK] pkexec SUID bit is disabled or file is absent.';
fi
Interactive SecOps Remediation Checklist
0/4 (0%)
Recommended Security Control & Mitigation Partner
SentinelOne Singularity AI EDR
Immediately update the polkit package across all Linux assets, or strip the SUID bit from the pkexec binary as an interim mitigation.

Block Kernel Privilege Escalation & Ransomware Payloads Before You Can Reboot

Protect unpatched Windows, Linux, and macOS workloads against in-memory exploitation and lateral movement with autonomous EDR.

100% MITRE ATT&CK Detection · 1-Click Rollback

Technical Root Cause & Exploitation Mechanics

1. Vulnerability Overview & Root Cause

This vulnerability, widely known as 'PwnKit', is an out-of-bounds write/read vulnerability (CWE-787, CWE-125) in Polkit's pkexec utility, a SUID-root program installed by default on most Linux distributions. The root cause lies in the improper handling of command-line arguments (argc) within pkexec. When the utility is executed with an empty argument list (argc = 0), pkexec incorrectly assumes argv is the process name and attempts to read/write beyond the bounds of the array, effectively accessing the environment variables array (envp) instead.

2. Exploitation Mechanics & Attack Scenario

An attacker invokes pkexec using the execve() system call with an empty argv array (argc = 0) and crafts a malicious envp array containing specific environment variables. Because pkexec treats envp as argv, the attacker can manipulate the application's internal state to inject dangerous environment variables, such as GCONV_PATH, which are normally cleared by the dynamic linker for SUID binaries. This allows the attacker to force pkexec to load and execute an arbitrary shared library (.so) with root privileges, resulting in an immediate local root shell.

3. Infrastructure & Business Impact

With a CVSS score of 7.8 (High) and inclusion in the CISA KEV catalog, this vulnerability poses a severe threat to enterprise infrastructure. While it requires local access to be exploited, it is highly sought after by threat actors as a secondary payload. Once an attacker gains initial access via web application exploits (e.g., RCE) or compromised credentials, PwnKit provides a reliable, 100% successful path to full system compromise, potentially leading to data exfiltration, ransomware deployment, or container escape.

Official Vendor Advisories & References

NVD Original English Description

A local privilege escalation vulnerability was found on polkit's pkexec utility. The pkexec application is a setuid tool designed to allow unprivileged users to run commands as privileged users according predefined policies. The current version of pkexec doesn't handle the calling parameters count correctly and ends trying to execute environment variables as commands. An attacker can leverage this by crafting environment variables in such a way it'll induce pkexec to execute arbitrary code. When successfully executed the attack can cause a local privilege escalation given unprivileged users administrative rights on the target machine.

Frequently Asked SecOps Questions (CVE-2021-4034)

FAQ

Q1. How critical is CVE-2021-4034 and is it actively exploited in the wild?

CVE-2021-4034 is rated CVSS 7.8 (HIGH) with a 30-day EPSS exploitation probability of 94.9%. It is listed in the CISA Known Exploited Vulnerabilities (KEV) catalog, requiring immediate emergency remediation.

Q2. Which vendors and products are affected by CVE-2021-4034?

Primary impacted vendors include polkit, redhat, debian, ubuntu, suse across polkit, pkexec. Scope summary: All Polkit versions since its initial release in May 2009 are vulnerable unless patched.

Q3. What temporary mitigations or workarounds exist for CVE-2021-4034 before patching?

[Mitigation] Apply official vendor security patches immediately, or remove the SUID permission (chmod 0755) from the pkexec binary as a temporary workaround. Follow the CLI remediation commands and interactive SecOps checklist on this page to restrict exposure prior to your maintenance window.

SECOPS WORKBENCH INTEGRATION

Generate an Internal Engineering Notice or CISO Report for CVE-2021-4034

Instantly format this advisory into an executive CISO summary or engineering patch ticket.

Generate Report →

🔗 Related Advisories in Similar Stack (polkit)

View Category →
SecOps Advisory Dispatch & RSS Feed

Subscribe to Daily Vulnerability Briefings & KEV Alerts

Concise morning briefings for SecOps, DevSecOps, and SRE teams covering newly exploited CVEs and mitigation priorities.

Slack / Teams / RSS Feed:
PatchKO
CVE-2021-4034 Polkit pkexec Local Privilege Escalation (LPE) Vulnerability Analysis and Mitigation Guide (PwnKit, CVE-2021-4034) (CVSS 7.8) - Patch & Workaround | CVE Pulse