7-Year-Old Polkit Flaw Lets Unprivileged Linux Users Gain Root Access


[![Exploit to Gain Root Access](https://thehackernews.com/images/-szO1rPyr148/YMMS6mQDSJI/AAAAAAAAC1Q/dxz_XWn-9M0w7Z78ShUKaPdWj4_p1GGsgCLcBGAsYHQ/s728-e1000/root.jpg)](<https://thehackernews.com/images/-szO1rPyr148/YMMS6mQDSJI/AAAAAAAAC1Q/dxz_XWn-9M0w7Z78ShUKaPdWj4_p1GGsgCLcBGAsYHQ/s0/root.jpg>) A seven-year-old privilege escalation vulnerability discovered in the polkit system service could be exploited by a malicious unprivileged local attacker to bypass authorization and escalate permissions to the root user. Tracked as [CVE-2021-3560](<https://github.blog/2021-06-10-privilege-escalation-polkit-root-on-linux-with-bug/>) (CVSS score: 7.8), the flaw affects polkit versions between 0.113 and 0.118 and was discovered by GitHub security researcher Kevin Backhouse, who said the issue was [introduced in a code commit](<https://gitlab.freedesktop.org/polkit/polkit/-/commit/bfa5036bfb93582c5a87c44b847957479d911e38>) made on Nov. 9, 2013. Red Hat's Cedric Buissart [noted](<https://seclists.org/oss-sec/2021/q2/180>) that Debian-based distributions, based on polkit 0.105, are also vulnerable. [Polkit](<https://en.wikipedia.org/wiki/Polkit>) (née PolicyKit) is a toolkit for defining and handling authorizations in Linux distributions, and is used for allowing unprivileged processes to communicate with privileged processes. "When a requesting process disconnects from dbus-daemon just before the call to polkit_system_bus_name_get_creds_sync starts, the process cannot get a unique uid and pid of the process and it cannot verify the privileges of the requesting process," Red Hat [said](<https://access.redhat.com/security/cve/CVE-2021-3560>) in an advisory. "The highest threat from this vulnerability is to data confidentiality and integrity as well as system availability." RHEL 8, Fedora 21 (or later), Debian "Bullseye," and Ubuntu 20.04 are some of the popular Linux distributions impacted by the polkit vulnerability. The issue has been mitigated in [version 0.119](<https://www.freedesktop.org/software/polkit/releases/>), which was released on June 3. [![gain root-level access](https://thehackernews.com/images/--6FhFchuw9Q/YMMUS2bN9SI/AAAAAAAAC1Y/YlleoffcproiQJ7COuhbiO1E3vmo5bKAgCLcBGAsYHQ/s728-e1000/hacking-news.jpg)](<https://thehackernews.com/images/--6FhFchuw9Q/YMMUS2bN9SI/AAAAAAAAC1Y/YlleoffcproiQJ7COuhbiO1E3vmo5bKAgCLcBGAsYHQ/s0/hacking-news.jpg>) "The vulnerability is surprisingly easy to exploit. All it takes is a few commands in the terminal using only standard tools like [bash](<https://linux.die.net/man/1/bash>), [kill](<https://linux.die.net/man/2/kill>), and [dbus-send](<https://linux.die.net/man/1/dbus-send>)," said Backhouse in a write-up published yesterday, adding the flaw is triggered by sending a dbus-send command (say, to create a new user) but terminating the process while polkit is still in the middle of processing the request. "dbus-send" is a Linux inter-process communication (IPC) mechanism that's used to send a message to [D-Bus](<https://en.wikipedia.org/wiki/D-Bus>) message bus, allowing communication between multiple processes running concurrently on the same machine. Polkit's policy authority daemon is [implemented](<https://www.freedesktop.org/software/polkit/docs/latest/polkit.8.html>) as a service connected to the system bus to authenticate credentials securely. In killing the command, it causes an authentication bypass because polkit mishandles the terminated message and treats the request as though it came from a process with root privileges ([UID 0](<https://en.wikipedia.org/wiki/User_identifier>)), thereby immediately authorizing the request. "To trigger the vulnerable codepath, you have to disconnect at just the right moment," Backhouse said. "And because there are multiple processes involved, the timing of that 'right moment' varies from one run to the next. That's why it usually takes a few tries for the exploit to succeed. I'd guess it's also the reason why the bug wasn't previously discovered." Users are encouraged to update their Linux installations as soon as possible to remediate any potential risk arising out of the flaw. Found this article interesting? Follow THN on [Facebook](<https://www.facebook.com/thehackernews>), [Twitter __](<https://twitter.com/thehackersnews>) and [LinkedIn](<https://www.linkedin.com/company/thehackernews/>) to read more exclusive content we post.