Polkit Local Privilege Escalation Vulnerability (CVE-2021-4034)

Posted DateJanuary 31, 2022
Posted Time 2   min Read

What is Polkit Local Privilege Escalation Vulnerability (CVE-2021-4034)?

A privilege escalation vulnerability has been disclosed in Polkit, formerly known as PolicyKit. Polkit is a SUID-root program installed by default on all major Linux distributions that is used for controlling system-wide privileges. The vulnerability exists in the Polkit’s main executable i.e., pkexec processes, leading to memory corruption. Successful exploitation of this vulnerability allows any unprivileged user to gain root privileges on the vulnerable host. This has been dubbed as “PwnKit”.

What Are the Risks?

pkexec has been vulnerable since its creation in May 2009. The vulnerability is exploitable in default configurations in most of the Linux platforms, and it is most likely to be exploited as POCs are already available in public. Exploitation happens locally as it requires access to the vulnerable system. It can also be paired with any remote code execution vulnerability to become a part of the critical attack chain.

Severity: High
CVSSv3.1: Base Score: 7.8 High
Vector:  CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
CVSSv2: Base Score: 4.6 Medium
Vector: (AV:L/AC:L/Au:N/C:P/I:P/A:P)
Exploit available in public: Yes
Exploit complexity: Low

 

Do You Need to Worry About it?

Most of the vendors have released security patches, and we strongly advise our customers to install the patches as soon as possible.

https://ubuntu.com/security/CVE-2021-4034
https://access.redhat.com/security/cve/CVE-2021-4034
https://linux.oracle.com/errata/ELSA-2022-0267.html
https://security-tracker.debian.org/tracker/CVE-2021-4034

Mitigation Steps:

  1. Apply patches released by Polkit’s authors on their GitLab.
  2. Administrators can temporarily mitigate the exploitation by removing the SUID-bit from pkexec until a patch can be put in place.

For example:
# chmod 0755 /usr/bin/pkexec

  1. On RedHat:

The following steps can be run as mitigation on systems that don’t have the Secure Boot feature enabled:

  1. Install required systemtap packages and dependencies aspointed 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 the polkit package is 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 systems 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.

Product Coverage:

Indusface AppTrana platform protects against web application layer vulnerabilities being exploited by external traffic and will be able to protect any arbitrary code execution vulnerabilities paired with the Pwnkit vulnerability.

Indusface WAS performs external scans on the server and the Pwnkit detection will not come into the scope of automated scans. But a vulnerability audit can be used to scan for local exposures by updating the credentials. It is recommended to perform credentialed vulnerability audit scans to detect this vulnerability.

Found this article interesting? Follow Indusface on FacebookTwitter, and LinkedIn to read more exclusive content we post.

Vivek Gopalan

Vivekanand Gopalan is a seasoned entrepreneur and currently serves as the Vice President of Products at Indusface. With over 12 years of experience in designing and developing technology products, he has a keen eye for building innovative solutions that solve real-life problems. In his previous role as a Product Manager at Druva, Vivek was instrumental in creating the core endpoint data protection solution which helped over 1500 enterprises protect over a million endpoints. Prior to that, he served as a Product Manager at Zighra, where he played a crucial role in reducing online and offline payment fraud by leveraging mobile telephony, collective intelligence, and implicit user authentication. Vivek is a dynamic leader who enjoys building and commercializing products that bring tangible value to customers. In 2010, before pursuing MBA, he co-founded a technology product company, Warmbluke and created a first-of-its-kind innovative Civil Engineering estimator software called ATLAS. The software was developed for both enterprise and for SaaS users. The product helps in estimating the construction cost using CAD drawings. Vivek did his MBA from Queen's University with Specialization in New Ventures. He also holds a Bachelor of Technology degree in Information Technology from Coimbatore Institute of Technology, Anna University, one of the prestigious universities in India. He is the recipient of the D.D. Monieson MBA Award, Issued by Queen's School of Business, presented to a student team which has embraced the team-learning model and applied the management tools and skills to become a peer exemplar. In his spare time, Vivek likes to go on hikes and read books.

Share Article:

Join 51000+ Security Leaders

Get weekly tips on blocking ransomware, DDoS and bot attacks and Zero-day threats.

We're committed to your privacy. indusface uses the information you provide to us to contact you about our relevant content, products, and services. You may unsubscribe from these communications at any time. For more information, check out our Privacy Policy.