Connect with our team of offensive security, AI security and pen testing experts at Black Hat Europe 2023. Learn More

Connect with our team of offensive security, AI security and pen testing experts at Black Hat Europe 2023. Learn More

Services
Capture
Managed Detection & Response

Eradicate cyberthreats with world-class intel and expertise

twi-cloud-lock-color-svg
Managed Security Services

Expand your team’s capabilities and strengthen your security posture

twi-briefcase-color-svg
Consulting & Professional Services

Tap into our global team of tenured cybersecurity specialists

twi-dashboard-color-svg
Penetration Testing

Subscription- or project-based testing, delivered by global experts

twi-database-color-svg
Database Security

Get ahead of database risk, protect data and exceed compliance requirements

twi-email-color-svg
Email Security & Management

Catch email threats others miss with layered security & maximum control

twi-managed-portal-color
Co-Managed SOC (SIEM)

Eliminate alert fatigue, focus your SecOps team, stop threats fast, and reduce cyber risk

Solutions
BY TOPIC
Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
The Trustwave Approach
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Platform
SpiderLabs Fusion Center
Security Operations Centers
Partners
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

Trustwave Threat Hunting Guide: Identifying PwnKit (CVE-2021-4034) Exploitation

The Trustwave Threat Hunting team has authored a practical guide to help the cybersecurity community address the Linux “polkit” Local Privilege Escalation vulnerability (CVE-2021-4034) by identifying common behavior in exploitation.

Overview

On January 25, 2022, Qualys released a research blog detailing a critical vulnerability (aka PwnKit) in the “polkit” component available by default in almost all Linux distributions. At the time of this writing, the Trustwave Threat Hunt team has not witnessed any attacks in the wild using this Local Privilege Escalation.

Our team of threat hunters leveraged the Endpoint Detection and Response (EDR) API across our advanced tier client environment to determine if there was activity from non-root users accessing the ‘gconv-module’ file. This action can also be performed via a normal EDR query or a File Integrity Monitor. If there are findings where non-root users are seen modifying or acting on this file, the following techniques can be used to determine if it is malicious activity indicative of PwnKit exploitation.

How to investigate the results

  1. Check the timeline of events up to two minutes before the file access or modification for any curl/wget execution.
  2. Check the timeline of events up to two minutes before the file access or modification for any shellcode execution, similar to the below:

            ./anyname       
            or
            anyname.py
            or
            anyname.sh

  1. Check the timeline of events up to one minute before the file access or modification for any compilation like this in command line:

            sh -c gcc -o payload.so -shared -fPIC payload.c

  1. Check for username after the event file write/create "gconv-modules". If it is ROOT, then this may be indicative of malicious privilege escalation events.

How the exploit works and how to verify

  1. The exploit will create two folders under the current directory; the folder name can be any random name and "GCONV_PATH="
  2. The two folders will have an exploit attempt file, which can be any random name.
  3. Once the setup is done, the exploitation starts by executing "/usr/bin/pkexec" as ROOT user permission.
  4. You can observe the remaining process will be under ROOT user. This is where the adversary is executing the commands by obtaining ROOT user-level permission.

Summary

Although Local Privilege Escalation vulnerabilities require access to the vulnerable system, do not discount this vulnerability. When paired with any simple Remote Code Execution (RCE) vulnerability, this becomes a part of a critical attack chain. Given the massive attack surface that affects most every Linux distribution, this vulnerability will have legs that make it a threat well into 2022.

For more information about PwnKit (CVE-2021-4034), please refer to our Action Response.

Not every organization has the resources or expertise to perform Threat Hunting. Trustwave offers Threat Hunting services that combine human experts and automated processes to bring you purpose-built threat hunting capabilities that help you stay ahead of advanced adversaries.

Latest SpiderLabs Blogs

The 2023 Retail Services Sector Threat Landscape: A Trustwave Threat Intelligence Briefing

The annual holiday shopping season is poised for a surge in spending, a fact well-known to retailers, consumers, and cybercriminals alike. The latter group, however, is poised to exploit any...

Read More

Pwning Electroencephalogram (EEG) Medical Devices by Default

Overall Analysis of Vulnerability Identification – Default Credentials Leading to Remote Code Execution During internal network testing, a document was discovered titled the “XL Security Site...

Read More

Hidden Data Exfiltration Using Time, Literally

I was looking at my watch last week and my attention was moved towards the seconds over at the right of the watch face, incrementing nicely along as you’d expect. Now, I don’t know if I’d just spent...

Read More