Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
PwnKit (CVE-2021-4034) is a memory corruption flaw in the polkit pkexec utility that gave any local user instant root on virtually every Linux distribution for twelve years.

What Is PwnKit?
PwnKit is the name given to CVE-2021-4034, a local privilege escalation vulnerability in pkexec, a setuid-root helper that ships as part of the polkit package on practically every Linux distribution. The Qualys Research Team disclosed it on 25 January 2022, with a working exploit that produced a root shell on default installations of Ubuntu, Debian, Fedora, and CentOS. The flaw had been present since pkexec was first written in May 2009.
Polkit, formerly PolicyKit, decides which users may perform which privileged actions. pkexec is its command-line front end, roughly analogous to sudo: it runs a program as another user, subject to policy. It is installed setuid root, meaning it executes with root privileges regardless of who invokes it, which is exactly what makes a bug in it so valuable.
The flaw lives in how pkexec reads its arguments. C programs receive an argument count, argc, and an array of argument strings, argv. The function iterated through argv starting at index 1 to find the command to run, on the reasonable assumption that index 0 holds the program name and argc is at least 1.
That assumption can be violated. The execve system call permits a program to be started with an entirely empty argument array, so argc is zero and argv[0] is NULL. The loop then read past the end of argv—and immediately after argv in memory sits envp, the environment array. pkexec therefore read an environment variable and treated it as a command-line argument, then wrote a value back out of bounds into that environment.
Because the attacker controls the environment entirely, they control what is written and where. The published exploit used this to reintroduce an environment variable that pkexec would otherwise have stripped—GCONV_PATH, which tells the GNU C Library where to find character set conversion modules. Pointing it at an attacker-supplied shared object caused that library to be loaded into the still-root process.
Three properties made PwnKit unusually serious:
pkexec was installed.It entered the CISA Known Exploited Vulnerabilities catalogue, and has been used by cryptomining operators and ransomware affiliates as a standard escalation step after gaining a low-privileged shell.
Install your distribution’s patched polkit package. Every maintained distribution shipped one on or shortly after the disclosure date, including backports for long-term support releases.
If patching must wait, removing the setuid bit—chmod 0755 /usr/bin/pkexec—blocks exploitation immediately. The command then fails for unprivileged users, which may break desktop tools that use it to prompt for authentication but is harmless on most servers. Verify the result rather than assuming it, since package updates can restore the permission.
Container images need the same treatment. A patched host does not help if the vulnerable binary is inside the image your workloads run, and pkexec is present in many base images that do not need it at all. Removing the polkit package from server and container images is a sound hardening step in its own right.
PwnKit sits alongside Looney Tunables, Baron Samedit in sudo, and Dirty Pipe—old, privileged, widely installed code that had received far less review than its position warranted. The structural defence is to reduce the number of setuid binaries you carry. Audit them with find / -perm -4000 -type f, remove what nobody uses, and prefer Linux capabilities where the distribution supports them. Running containers with no-new-privileges set prevents setuid escalation inside them entirely.
At Privia Security, our Infrastructure Security Testing Services include local escalation testing from an unprivileged foothold, which is how these findings surface before someone else uses them.
No. It requires the ability to execute a program on the system as an unprivileged local user, so it is an escalation rather than an entry point. That still makes it dangerous, because attackers obtain unprivileged shells routinely through web application flaws, compromised credentials, or container breakouts, and PwnKit converts such access into full root with a single reliable step.
On servers, generally yes. Running chmod 0755 on /usr/bin/pkexec stops exploitation immediately and most server workloads never invoke it. Desktop systems may see authentication prompts stop working for some graphical tools. Treat it as a temporary measure, apply the patched polkit package as soon as practical, and re-check the permission afterwards since updates can restore it.
The code reads naturally and the mistake only manifests in a condition most developers never consider: a process started with an empty argument array. Static analysis tools of the period did not flag it, and the function had been reviewed by people reasoning about normal invocations. It is a good example of how security-critical code benefits from adversarial review rather than ordinary code review.
Yes. Container images carry their own copy of polkit, so a patched host does not protect a workload running a vulnerable image. Rebuild images against updated base layers, and consider removing polkit from server images where nothing uses it. Setting no-new-privileges on container runtimes also blocks setuid-based escalation regardless of which binary contains the flaw.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.