Overview
On January 26, NSFOCUS CERT detected that the Qualys research team publicly disclosed a privilege escalation vulnerability (CVE-2021-4034) found in Polkit’s pkexec, also known as PwnKit. The vulnerability is due to the inability of pkexec to properly process the call parameters, thereby executing the environment variable as a command. An attacker with arbitrary user rights can exploit this vulnerability by modifying the environment variable in the default configuration, thereby gaining root privileges on the affected host. At present, the details and PoC of the vulnerability have been disclosed, and relevant users are requested to take measures to protect them as soon as possible.
Polkit (PolicyKit) is an application-level tool set in Unix-like systems. It implements communication between processes with different priorities by defining and auditing permission rules. pkexec, part of the Polkit open source application framework, enables authorized unprivileged users to execute commands as privileged users according to defined policies.
NSFOCUS has successfully reproduced it immediately:
Reference link: https://www.qualys.com/2022/01/25/cve-2021-4034/pwnkit.txt
Scope of Impact
Affected version
All Polkit versions released from May 2009 to present.
Note: Polkit is pre-installed on CentOS, Ubuntu, Debian, Redhat, Fedora, Gentoo, Mageia and other Linux distributions, and all Linux systems with Polkit are affected.
Unaffected version
CentOS:
- CentOS 6: polkit-0.96-11.el6_10.2
- CentOS 7: polkit-0.112-26.el7_9.1
- CentOS 8.0: polkit-0.115-13.el8_5.1
- CentOS 8.2: polkit-0.115-11.el8_2.2
- CentOS 8.4: polkit-0.115-11.el8_4.2
Ubuntu:
- Ubuntu 14.04 ESM: policykit-1-0.105-4ubuntu3.14.04.6+esm1
- Ubuntu 16.04 ESM: policykit-1-0.105-14.1ubuntu0.5+esm1
- Ubuntu 18.04 LTS: policykit-1-0.105-20ubuntu0.18.04.6
- Ubuntu 20.04 LTS: policykit-1-0.105-26ubuntu1.2
- Ubuntu 21.10: policykit-1-0.105-31ubuntu0.1
Debain:
- Debain stretch: policykit-1 0.105-18+deb9u2
- Debain buster: policykit-1 0.105-25+deb10u1
- Debain bullseye: policykit-1 0.105-31+deb11u1
- Debain bookworm,bullseye: policykit-1 0.105-31.1
Vulnerability Detection
Linux system users can check whether the current system is affected by checking the Polkit version. The commands for mainstream Linux distributions are as follows:
CentOS:
rpm -qa polkit
Ubuntu:
rpm -qa polkit
Mitigation
1. At present, the official patch has been released to fix this vulnerability. It is recommended that affected users install it in time for protection.
Download link: https://gitlab.freedesktop.org/polkit/polkit/-/commit/a2bf5c9c83b6ae46cbd5c779d3055bff81ded683
2. At present, all mainstream Linux distributions have released security patches or updated versions to fix this vulnerability. It is recommended that users install the patch as soon as possible or refer to official measures for protection:
Linux distribution version | Official Notice |
Ubuntu | https://ubuntu.com/security/CVE-2021-4034 |
Debain | https://security-tracker.debian.org/tracker/CVE-2021-4034 |
Redhat | https://access.redhat.com/security/cve/CVE-2021-4034 |
Gentoo | https://bugs.gentoo.org/832057 |
Mageia | https://advisories.mageia.org/CVE-2021-4034.html |
Note: For Linux distributions such as CentOS, Ubuntu, Debian, etc. that use a package manager to update Polkit, you can directly run the following commands to update and repair:
CentOS:
yum clean all && yum makecache
yum update polkit -y
Ubuntu:
sudo apt-get update
sudo apt-get install policykit-1
Debian:
apt upgrade policykit-1
Temporary Mitigation
If the operating system used by the affected users has not yet released a fix, or the patch update cannot be installed temporarily, the following measures can be used for temporary protection without affecting the business.
Execute the following system command to remove the suid bit of pkexec:
chmod 0755 /usr/bin/pkexec
Statement
This advisory is only used to describe a potential risk. NSFOCUS does not provide any commitment or promise on this advisory. NSFOCUS and the author will not bear any liability for any direct and/or indirect consequences and losses caused by transmitting and/or using this advisory. NSFOCUS reserves all the rights to modify and interpret this advisory. Please include this statement paragraph when reproducing or transferring this advisory. Do not modify this advisory, add/delete any information to/from it, or use this advisory for commercial purposes without permission from NSFOCUS.
About NSFOCUS
NSFOCUS, Inc., a global network and cyber security leader, protects enterprises and carriers from advanced cyber attacks. The company’s Intelligent Hybrid Security strategy utilizes both cloud and on-premises security platforms, built on a foundation of real-time global threat intelligence, to provide multi-layered, unified and dynamic protection against advanced cyber attacks.
NSFOCUS works with Fortune Global 500 companies, including four of the world’s five largest financial institutions, organizations in insurance, retail, healthcare, critical infrastructure industries as well as government agencies. NSFOCUS has technology and channel partners in more than 60 countries, is a member of both the Microsoft Active Protections Program (MAPP), and the Cloud Security Alliance (CSA). A wholly owned subsidiary of NSFOCUS Technologies Group Co., Ltd., the company has operations in the Americas, Europe, the Middle East and Asia Pacific.