cve.bz

CVE-2021-4034 (PwnKit) Red Hat Polkit Out-of-Bounds Read and Write Vulnerability

7.8 highKEVExploitEPSS 95%Fix available

Known as PwnKit

High (7.8) in Red Hat Polkit. In CISA KEV since 2022-06-27, with known ransomware use. EPSS 95% estimated probability of exploitation activity in the next 30 days.

On this page
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.

Severity

CVSS 3.1

7.8 high
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
EPSS
95% (unchanged from 95% a week ago; 95% 30 days ago) estimated probability of exploitation activity in the next 30 days; 100th percentile. Scored 2026-11-21. A forecast for this CVE across the internet, not for your own systems.
CISA KEV
listed 2022-06-27, due 2022-07-18, known ransomware use
CISA's assessment (SSVC)
Exploitation: active · Automatable: no · Technical impact: total, assessed 2022-06-27. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWEs
CWE-125 Out-of-bounds Read
CWE-787 Out-of-bounds Write
Published
Modified
NVD analysis
Analyzed
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2021-4034 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2021-4034?via=ask-ai-copy and https://cve.bz/cve/CVE-2021-4034?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2021-4034 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the NVD's CPE matches.

ProductAffected
polkit_project:polkitbefore 121
redhat:enterprise_linux_server_update_services_for_sap_solutions7.6
redhat:enterprise_linux_server_update_services_for_sap_solutions7.7
redhat:enterprise_linux8.0
redhat:enterprise_linux_desktop7.0
redhat:enterprise_linux_eus8.2
redhat:enterprise_linux_for_ibm_z_systems7.0
redhat:enterprise_linux_for_ibm_z_systems8.0
redhat:enterprise_linux_for_ibm_z_systems_eus8.2
redhat:enterprise_linux_for_ibm_z_systems_eus8.4
redhat:enterprise_linux_for_power_big_endian7.0
redhat:enterprise_linux_for_power_little_endian7.0
redhat:enterprise_linux_for_power_little_endian8.0
redhat:enterprise_linux_for_power_little_endian_eus8.1
redhat:enterprise_linux_for_power_little_endian_eus8.2
redhat:enterprise_linux_for_power_little_endian_eus8.4
redhat:enterprise_linux_for_scientific_computing7.0
redhat:enterprise_linux_server6.0
redhat:enterprise_linux_server7.0
redhat:enterprise_linux_server_aus7.3
redhat:enterprise_linux_server_aus7.4
redhat:enterprise_linux_server_aus7.6
redhat:enterprise_linux_server_aus7.7
redhat:enterprise_linux_server_aus8.2
redhat:enterprise_linux_server_aus8.4
redhat:enterprise_linux_server_eus8.4
redhat:enterprise_linux_server_tus7.6
redhat:enterprise_linux_server_tus7.7
redhat:enterprise_linux_server_tus8.2
redhat:enterprise_linux_server_tus8.4
redhat:enterprise_linux_server_update_services_for_sap_solutions8.1
redhat:enterprise_linux_server_update_services_for_sap_solutions8.2
redhat:enterprise_linux_server_update_services_for_sap_solutions8.4
redhat:enterprise_linux_workstation7.0
canonical:ubuntu_linux14.04
canonical:ubuntu_linux16.04
canonical:ubuntu_linux18.04
canonical:ubuntu_linux20.04
canonical:ubuntu_linux21.10
suse:enterprise_storage7.0
suse:linux_enterprise_high_performance_computing15.0:sp2
suse:manager_proxy4.1
suse:manager_server4.1
suse:linux_enterprise_desktop15:sp2
suse:linux_enterprise_server15:sp2
suse:linux_enterprise_workstation_extension12:sp5
oracle:http_server12.2.1.3.0
oracle:http_server12.2.1.4.0
oracle:zfs_storage_appliance_kit8.8
siemens:sinumerik_edgebefore 3.3.0
siemens:scalance_lpe9403_firmwarebefore 2.0
starwindsoftware:command_center1.0:update3_build5871
starwindsoftware:starwind_virtual_sanv8:build14338

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian9policykit-10.105-18+deb9u2DLA-2899-1
Debian10policykit-10.105-25+deb10u1DSA-5059-1
Debian11policykit-10.105-31+deb11u1DSA-5059-1
Debian12, 13, 14policykit-10.105-31.1DEBIAN-CVE-2021-4034
Ubuntu18.04:LTSpolicykit-10.105-20ubuntu0.18.04.6UBUNTU-CVE-2021-4034 USN-5252-1
Ubuntu20.04:LTSpolicykit-10.105-26ubuntu1.2UBUNTU-CVE-2021-4034 USN-5252-1
Ubuntu22.04:LTSpolicykit-10.105-31ubuntu1UBUNTU-CVE-2021-4034
UbuntuPro:14.04:LTSpolicykit-10.105-4ubuntu3.14.04.6+esm1UBUNTU-CVE-2021-4034 USN-5252-2
UbuntuPro:16.04:LTSpolicykit-10.105-14.1ubuntu0.5+esm1UBUNTU-CVE-2021-4034 USN-5252-2
Red Hatenterprise_linux:7::client, enterprise_linux:7::server, enterprise_linux:7::workstationpolkit, polkit-docs, polkit-devel and 1 more0:0.112-26.el7_9.1RHSA-2022:0274
Red Hatenterprise_linux:7::computenodepolkit-docs, polkit-devel, polkit-debuginfo0:0.112-26.el7_9.1RHSA-2022:0274
Red Hatenterprise_linux:7::hypervisorredhat-virtualization-host, redhat-virtualization-host-image-update0:4.3.21-20220126.0.el7_9RHSA-2022:0443
Red Hatenterprise_linux:8::baseospolkit, polkit-docs, polkit-libs and 4 more0:0.115-13.el8_5.1RHSA-2022:0267
Red Hatrhel_aus:7.3::serverpolkit, polkit-docs, polkit-devel and 1 more0:0.112-12.el7_3.1RHSA-2022:0270
Red Hatrhel_aus:7.4::serverpolkit, polkit-docs, polkit-devel and 1 more0:0.112-12.el7_4.2RHSA-2022:0272
Red Hatrhel_aus:7.6::server, rhel_e4s:7.6::server, rhel_tus:7.6::serverpolkit, polkit-docs, polkit-devel and 1 more0:0.112-18.el7_6.3RHSA-2022:0271
Red Hatrhel_aus:7.7::server, rhel_e4s:7.7::server, rhel_tus:7.7::serverpolkit, polkit-docs, polkit-devel and 1 more0:0.112-22.el7_7.2RHSA-2022:0273
Red Hatrhel_e4s:8.1::baseospolkit, polkit-docs, polkit-libs and 4 more0:0.115-9.el8_1.2RHSA-2022:0268
Red Hatrhel_els:6polkit, polkit-docs, polkit-devel and 2 more0:0.96-11.el6_10.2RHSA-2022:0269
Red Hatrhel_eus:8.2::baseospolkit, polkit-docs, polkit-libs and 4 more0:0.115-11.el8_2.2RHSA-2022:0265
Red Hatrhel_eus:8.4::baseospolkit, polkit-docs, polkit-libs and 4 more0:0.115-11.el8_4.2RHSA-2022:0266
1 more for Red Hat in the JSON and on Red Hat's page.
SUSEEnterprise Storage 6, Linux Enterprise High Performance Computing 15 SP1-ESPOS, Linux Enterprise High Performance Computing 15 SP1-LTSS and 7 morepolkit0.114-3.15.1SUSE-SU-2022:0191-1
SUSEEnterprise Storage 7, Linux Enterprise High Performance Computing 15 SP2-ESPOS, Linux Enterprise High Performance Computing 15 SP2-LTSS and 9 morepolkit0.116-3.6.1SUSE-SU-2022:0190-1
SUSEHPE Helion OpenStack 8, Linux Enterprise Server 12 SP2-BCL, Linux Enterprise Server 12 SP3-BCL and 12 morepolkit0.113-5.24.1SUSE-SU-2022:0189-1
openSUSELeap 15.3polkit0.116-3.6.1openSUSE-SU-2022:0190-1
openSUSETumbleweedpolkit0.120-2.1openSUSE-SU-2024:11780-1
AlmaLinux8polkit, polkit-docs, polkit-libs and 1 more0.115-13.el8_5.2ALSA-2022:0267
Rocky Linux8polkit0:0.115-13.el8_5.1RLSA-2022:0267
Alpinev3.15polkit0.119-r8ALPINE-CVE-2021-4034
Alpinev3.16, v3.17, v3.18 and 6 morepolkit0.120-r2ALPINE-CVE-2021-4034
Azure Linux2polkit0.119-2AZL-8335

From the distributions' data via OSV.dev: the Debian Security Tracker; Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0; Red Hat Security Data © Red Hat, Inc., CC BY 4.0; SUSE security data, CC BY 4.0; AlmaLinux's OSV database, MIT; Rocky Linux's errata, BSD-3-Clause; the Alpine secdb, CC BY-SA 4.0; Microsoft's Azure Linux vulnerability data, MIT. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Ubuntu · Red Hat · SUSE · openSUSE · Alpine.

Red Hat

Red Hat rates this Important.

Red Hat's mitigation

For customers who cannot update immediately and doesn't have Secure Boot feature enabled, the issue can be mitigated by executing the following steps:

1) Install required systemtap packages and dependencies as per - pointed by https://access.redhat.com/solutions/5441

2) Install polkit debug info:

~~~

debuginfo-install polkit

~~~

3) Create the following systemtap script, and name it pkexec-block.stp:

~~~

probe process("/usr/bin/pkexec").function("main") {

if (cmdline_arg(1) == "")

raise(9);

}

~~~

4) Load the systemtap module into the running kernel:

~~~

stap -g -F -m stap_pkexec_block pkexec_block.stp

~~~

5) Ensure the module is loaded:

~~~

lsmod | grep -i stap_pkexec_block

stap_pkexec_block 434176 0

~~~

6) Once polkit package was updated to the version containing the fix, the systemtap generated kernel module can be removed by running:

~~~

rmmod stap_pkexec_block

~~~

This mitigation doesn't work for Secure Boot enabled system as SystemTap would require an external compiling server to be able to sign the generated kernel module

with a key enrolled into the Kernel's keyring.

ProductPackageStateAdvisory
Red Hat Enterprise Linux 6 Extended Lifecycle Supportpolkit-0:0.96-11.el6_10.2Fixed 2022-01-25RHSA-2022:0269
Red Hat Enterprise Linux 7polkit-0:0.112-26.el7_9.1Fixed 2022-01-25RHSA-2022:0274
Red Hat Enterprise Linux 7.3 Advanced Update Supportpolkit-0:0.112-12.el7_3.1Fixed 2022-01-25RHSA-2022:0270
Red Hat Enterprise Linux 7.4 Advanced Update Supportpolkit-0:0.112-12.el7_4.2Fixed 2022-01-25RHSA-2022:0272
Red Hat Enterprise Linux 7.6 Advanced Update Supportpolkit-0:0.112-18.el7_6.3Fixed 2022-01-25RHSA-2022:0271
Red Hat Enterprise Linux 7.6 Telco Extended Update Supportpolkit-0:0.112-18.el7_6.3Fixed 2022-01-25RHSA-2022:0271
Red Hat Enterprise Linux 7.6 Update Services for SAP Solutionspolkit-0:0.112-18.el7_6.3Fixed 2022-01-25RHSA-2022:0271
Red Hat Enterprise Linux 7.7 Advanced Update Supportpolkit-0:0.112-22.el7_7.2Fixed 2022-01-25RHSA-2022:0273
Red Hat Enterprise Linux 7.7 Telco Extended Update Supportpolkit-0:0.112-22.el7_7.2Fixed 2022-01-25RHSA-2022:0273
Red Hat Enterprise Linux 7.7 Update Services for SAP Solutionspolkit-0:0.112-22.el7_7.2Fixed 2022-01-25RHSA-2022:0273
Red Hat Enterprise Linux 8polkit-0:0.115-13.el8_5.1Fixed 2022-01-25RHSA-2022:0267
Red Hat Enterprise Linux 8.1 Update Services for SAP Solutionspolkit-0:0.115-9.el8_1.2Fixed 2022-01-25RHSA-2022:0268
Red Hat Enterprise Linux 8.2 Extended Update Supportpolkit-0:0.115-11.el8_2.2Fixed 2022-01-25RHSA-2022:0265
Red Hat Enterprise Linux 8.4 Extended Update Supportpolkit-0:0.115-11.el8_4.2Fixed 2022-01-25RHSA-2022:0266
Red Hat Virtualization 4 for Red Hat Enterprise Linux 7redhat-virtualization-host-0:4.3.21-20220126.0.el7_9Fixed 2022-02-07RHSA-2022:0443
Red Hat Virtualization 4 for Red Hat Enterprise Linux 8redhat-virtualization-host-0:4.4.10-202202081536_8.5Fixed 2022-02-15RHSA-2022:0540
Red Hat Enterprise Linux 9polkitNot affected

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2021-4034.

ICS advisories (CISA)

AdvisoryTitlePublishedSectorsAffectedFixed
ICSA-23-075-01Siemens SCALANCE, RUGGEDCOM Third-Party2023-03-14MultipleRUGGEDCOM RM1224 LTE(4G) EU (6GK6108-4AM00-2BA2), RUGGEDCOM RM1224 LTE(4G) NAM (6GK6108-4AM00-2DA2), SCALANCE M804PB (6GK5804-0AP00-2AA2) and 17 morenone listed
ICSA-22-270-02Hitachi Energy APM Edge2022-09-27EnergyLumada APM Edge: Version 3.0, Lumada APM Edge: Version 1.0, Lumada APM Edge: Version 4.0 and 1 morenone listed
ICSA-22-167-16Siemens SCALANCE LPE 4903 and SINUMERIK Edge2022-06-14MultipleSCALANCE LPE9403, SINUMERIK Edgenone listed

From CISA's ICS advisories (CSAF), provided under CISA's notification. Only the facts are shown; each advisory is on CISA's page. Credits.

Public exploits

GitHub PoC

Repositories on GitHub named after this CVE or listed for it by the PoC-in-GitHub index. For those marked Harbor Check: matches CVE, Flawharbor read the code and found it implements this CVE's exploitation technique: read, not run, and its dependencies only checked for warning signs, so a pointer and no guarantee. The rest are unverified: some hold a working proof of concept, some nothing useful, and some malware made to look like one. Read the code before you run any of it. How Harbor Check reads them, and what it found.

  • jayhutajulu1/PwnKit-CVE-2021-4034 Harbor Check: matches CVE 2 stars, C, created
    PoC for PwnKit / CVE-2021-4034 - Pkexec Local Privilege Escalation
  • devianntsec/CVE-2021-4034 Harbor Check: matches CVE 1 star, Python, created
    Advanced Linux Privilege Escalation research on CVE-2021-4034 (PwnKit). Features an optimized exploit with 7 polymorphic payload modes (Int…
  • vukma25/CVE-2021-4034 Harbor Check: matches CVE 0 stars, C, created
    Điều chỉnh, kết hợp mã nguồn khai thác của Ayrx và Berdav
  • eshkoreee/CVE-2021-4034 Harbor Check: matches CVE 0 stars, C, created
    я разобрал уязвимость называемую в простонародии Pwnkit в учебных целях и написал к нему PoC. использовать строго в учебных целях
  • caviartank21/CVE-2021-4034 Harbor Check: matches CVE 0 stars, Python, created
    CVE-2021-4034 (PwnKit) - Python PoC
13 more

Attack patterns (CAPEC)

  • CAPEC-540 Overread Buffers Likelihood: Low · Severity: High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits.

References

Check your stackJSON