GHSL-2021-074: Local privilege escalation on any Linux system that uses polkit - CVE-2021-3560
An authentication bypass in polkit allowed an unprivileged user to obtain authorisation for privileged actions. The flaw occurred when a process disconnected from dbus-daemon just before a credential check, causing polkit to treat the request as coming from root.
Originally disclosed on GitHub Security Lab
There is an authentication bypass vulnerability in polkit, which enables an unprivileged user to get authorization from polkit to perform a privileged action.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the function polkit_system_bus_name_get_creds_sync returns TRUE even when an error occurs, and one caller fails to check the error, so the zero-initialised credentials are interpreted as uid 0 (root).
Impact
This issue may lead to local privilege escalation on any Linux system that uses polkit.
What the attacker needed
Local unprivileged user; polkit installed and running; ability to disconnect from dbus at precise timing
The fix
The bug was fixed by commit [redacted] on 2021-06-03.
How it was found
- An unprivileged process sends a request to polkit to perform a privileged action.
- The process disconnects from dbus-daemon just before polkit calls polkit_system_bus_name_get_creds_sync.
- dbus-daemon returns an error because the unique bus name is no longer valid.
- polkit_system_bus_name_get_creds_sync sets the error but still returns TRUE.
- The caller check_authorization_sync does not check the error and treats the user as root.
- Polkit authorises the action, allowing the unprivileged user to perform a privileged operation.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Polkit is a system service that decides whether a user is allowed to perform privileged actions, like installing software. The bug meant that if a program disconnected from the system bus at exactly the right moment, polkit mistakenly believed the request came from the root user and granted permission. This let a normal user run commands as root.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.