##
In 2021, a researcher named Kevin BackHouse discovered a privilege escalation vulnerability in the polkit utility. however, not all linux versions are vulnerable to polkit.
Below is an example of a vulnerable version;
The most modern versions of linux already have the correction of this vulnerability, however, older versions as mentioned above, still have this vulnerability.
 installed is vulnerable. That includes popular distributions such as RHEL 8 and Ubuntu 20.04.
Manually sending dbus messages to the dbus-daemon (effectively an API to allow different processes the ability to communicate with each other), then killing the request before it has been fully processed, we can trick polkit into authorising the command.
The **dbus-daemon** is a program running in the background which brokers messages between applications.
. This message gets given a unique ID by the dbus-daemon.
2. The attacker kills the message after polkit receives it, but before polkit has a chance to process the message. This effectively destroys the unique message ID.
3. Polkit asks the dbus-daemon for the user ID of the user who sent the message, referencing the (now deleted) message ID.
4. The dbus-daemon can't find the message ID because we killed it in step two. It handles the error by responding with an error code.
5. Polkit mishandles the error and substitutes in 0 for the user ID -- i.e. the root account of the machine.
6. Thinking that the root user requested the action, polkit allows the request to go through unchallenged.
In short, by destroying the message ID before the dbus-daemon has a chance to give polkit the correct ID, we exploit the poor error-handling in polkit to trick the utility into thinking that the request was made by the all-powerful root user.
1. Let's add a new user called _**lucas**_ , with sudo permissions, and a password of _**banana**_.
.**_
This command will manually send a dbus message to the accounts daemon, printing the response and creating a new user called _**lucas**_(string:lucas), with a description of "test vulns" (string:"test vulns") and membership of the sudo group set to true (referenced by the int32:1).
2. As this is effectively a race condition, we first need to determine how long our command will take to run. Let's try this with the first dbus message:
.
Let's try this. We need to send the dbus message, then kill it halfway through:
. We then told it to sleep for 0.005 milliseconds, then kill the process ($!). This successfully created the new user, adding them into the sudo group. We should note down at this point that the user ID of the new user in this instance is 1000.
4. We need a password hash here, so let's generate a Sha512Crypt hash for our chosen password (banana):
 and our plaintext password.
5. The 0.135 milliseconds worked, so lets try again
 for the id 1005 that was created in the steps above.
This vulnerability was publicly disclosed, and the fix was released on June 3, 2021 and was assigned **CVE-2021-3560**.
Check the update of your machine with **yum/apt update/upgrade.**
The full story
This article is one source in a clustered incident — the cluster page carries the summary, timeline and every other outlet covering it.
