CVE-2021-4034 Vulnerability
Published: 2/20/2025
Written by: Nadine Rozell
What is CVE-2021-4034 Vulnerability?
CVE-2021-4034 (PwnKit) is a memory corruption vulnerability in Polkit’s pkexec utility. Polkit is an application-level toolkit for controlling system-wide privileges in Unix-like operating systems. pkexec is a SUID-root program that lets an authorized user execute commands as another user, including the all-powerful root user. The vulnerability allows any unprivileged local user to gain full root privileges, effectively giving them the keys to the kingdom.
When was it discovered?
The vulnerability was discovered by researchers at Qualys and disclosed on January 25, 2022. The scary part? The bug had been hiding in plain sight for over 12 years, meaning a massive number of systems were vulnerable from the get-go. Patches were released quickly, but the long exposure time makes this a critical flaw to check for.
Affected Products & Versions
Product | Versions Affected | Fixed Versions / Patches |
Polkit | All versions since 2009 | Patches available for all major Linux distributions (e.g., Ubuntu, Debian, CentOS, Red Hat) |
CVE-2021-4034 technical description
The PwnKit vulnerability is a classic case of improper input handling. The pkexec tool doesn't correctly process the number of command-line arguments it receives. By crafting a specific set of arguments, an attacker can trick pkexec into executing an arbitrary environment variable as a command. Because pkexec is a SUID-root binary, that command runs with root privileges. The exploit is reliable, architecture-independent, and works on default installations of most Linux distributions.
Tactics, Techniques & Procedures (TTPs)
An attacker first needs to gain initial access to a target machine as a low-privileged user. This could be through another exploit, a weak password, or a compromised web application. Once they have that foothold, they run the PwnKit exploit locally. It's a one-shot command. This immediately escalates their privileges to root, allowing them to disable security tools, install persistent backdoors, steal sensitive data, or pivot to other systems on the network.
Indicators of Compromise
Detection can be tricky since a successful exploit looks like a legitimate use of pkexec. However, logs may show pkexec being called with unusual or empty arguments. You might see entries in the system logs stating "The value for the SHELL variable was not found." A good EDR solution can flag the anomalous process execution chain. Running the pkexec --version command can also tell you if you're running a vulnerable version.
Known Proof-of-Concepts & Exploits
Proof-of-concept exploits for PwnKit became public almost immediately after disclosure. They are simple, highly reliable, and widely available. Malicious actors, including ransomware groups and APTs, quickly integrated PwnKit into their toolkits as a go-to method for privilege escalation on Linux systems.
How to detect CVE-2021-4034 Vulnerability?
The most reliable way to detect this vulnerability is to check your installed version of Polkit. You can do this using your distribution's package manager (e.g., apt show polkitd on Debian/Ubuntu, rpm -q polkit on Red Hat/CentOS). Vulnerability scanners like Nessus or Qualys also have specific plugins to detect PwnKit. On the host, you can look for the tell-tale log entries or use a local exploit checker script to test for the flaw.
Impact & risk of CVE-2021-4034 Vulnerability
The impact is severe. Gaining root access is the ultimate goal for an attacker on a single system. It grants them complete control. From there, they can do anything: deploy ransomware, exfiltrate an entire database, or use the compromised machine as a launchpad for further attacks within your network. For any organization running Linux servers, this vulnerability represents a critical risk to data integrity and system availability.
Mitigation & remediation strategies
Patch immediately. This is not a drill. All major Linux distributions have released patched versions of Polkit. Run your system updates (sudo apt update && sudo apt upgrade or sudo yum update). If you absolutely cannot patch a system right away, you can apply a temporary mitigation by removing the SUID bit from the pkexec binary (sudo chmod 0755 /usr/bin/pkexec). This will prevent the exploit from working but may break legitimate applications that rely on pkexec, so patching is always the better option.
CVE-2021-4034 Vulnerability FAQs