GHSL-2021-1011: Double free in accountsservice - CVE-2021-3939
A double-free vulnerability in Ubuntu's accountsservice allows an unprivileged local user to crash the accounts-daemon and potentially escalate privileges. The bug is triggered by calling the SetLanguage D-Bus method multiple times after deleting the user's .pam_environment file.
Originally disclosed on GitHub Security Lab
accountsservice has a double-free bug, which can be triggered by an unprivileged local user, by calling the SetLanguage D-Bus method.
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
What the attacker needed
Local unprivileged user; ability to delete ~/.pam_environment; ability to call D-Bus method SetLanguage
The fix
The vulnerability was fixed and disclosed by Ubuntu.
How it was found
- Delete the file ~/.pam_environment to trigger the vulnerable code path.
- Call the SetLanguage D-Bus method multiple times.
- The accounts-daemon crashes due to a double-free.
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.
A double-free happens when a program frees the same memory twice, which can corrupt memory and let an attacker take control. Here, a local user can trigger this by repeatedly calling a system service method, causing the service (running as root) to crash and possibly allowing the user to gain higher privileges.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.