Vulnerability record · CVE-2021-4034 · published 28 January 2022
CVE-2021-4034: polkit pkexec argument handling flaw allows local root escalation
Polkit Project · Polkit
pkexec, the setuid polkit utility for running commands as privileged users, mishandles the calling parameter count and ends up treating environment variables as commands. This out-of-bounds read and write lets a local unprivileged user induce pkexec to execute arbitrary code. Because pkexec is setuid and widely shipped across major Linux distributions, any local foothold can be turned into administrative rights.
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.
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Automated analysis
critical priorityA locally exploitable setuid flaw giving root, with public exploit code, KEV listing and ransomware association, and an EPSS probability above 0.94.
What it is
pkexec, the setuid polkit utility for running commands as privileged users, mishandles the calling parameter count and ends up treating environment variables as commands. This out-of-bounds read and write lets a local unprivileged user induce pkexec to execute arbitrary code. Because pkexec is setuid and widely shipped across major Linux distributions, any local foothold can be turned into administrative rights.
Impact
An attacker with an unprivileged local account gains administrative (root) rights on the target machine. That enables full control of the host, including credential access, persistence and lateral movement.
Attack surface
Reached locally by executing the setuid pkexec binary with crafted environment variables; no network access, no authentication and no user interaction are required beyond the ability to run a process as an unprivileged user. The CVSS vector AV:L/AC:L/PR:L/UI:N confirms local, low-complexity, low-privilege, no-interaction exploitation.
Exploitation
Listed in CISA KEV with a due date of 2022-07-18 and flagged for known ransomware campaign use, and EPSS is 0.94921 (99.856th percentile). Multiple references are tagged Exploit, including the Qualys PwnKit writeup and Packet Storm entries, so public exploit code exists.
What to do
- Apply vendor patches for polkit/pkexec (for example the upstream freedesktop commit and Red Hat, Oracle, SUSE, Siemens and StarWind advisories) as the first action.
- If patching cannot be done immediately, remove the setuid bit from pkexec or restrict its execution to trusted users, per vendor mitigation guidance.
- Inventory all Linux hosts and images for the affected pkexec binary and track them to a patched state.
- Limit and monitor local interactive access, since exploitation requires only an unprivileged local account.
- Re-check container and appliance images that bundle polkit, as they may carry the vulnerable binary.
Detection
- Alert on execution of pkexec by non-root users, especially with unusual or empty environment variables.
- Monitor process trees where pkexec spawns unexpected child processes or shells.
- Watch for privilege changes to uid 0 originating from pkexec outside normal administrative workflows.
- Hunt for known PwnKit exploit artifacts and command patterns referenced in public exploit writeups.
This assessment is produced automatically and is not human-reviewed. Verify against the vendor advisory before acting on it.
Exploitation in the wild
CISA added CVE-2021-4034 to the Known Exploited Vulnerabilities catalog on 27 June 2022 as "Red Hat Polkit Out-of-Bounds Read and Write Vulnerability". CISA reports known use in ransomware campaigns. Required action: Apply updates per vendor instructions. Federal deadline 18 July 2022.
Affected products
30 vulnerable configurations from NVD's CPE data, grouped by vendor and product.
References
Track CVE-2021-4034 inside VULONE
Watch it alongside the ransomware crews, C2 infrastructure and forum chatter that reference it, query it through the API and pull it into your SIEM over TAXII.
Related vulnerabilities
Same products first, then exploited flaws of the same weakness class.
Source: NIST National Vulnerability Database (record CVE-2021-4034), CISA KEV, FIRST EPSS (scores of 2026-09-24). This page is refreshed as NVD updates the record.