Skip to content
Memory corruption Advisory Advanced CVE-2023-3297

GHSL-2023-139: Use After Free (UAF) in accountsservice - CVE-2023-3297

A use-after-free in accountsservice occurs when a D-Bus method call triggers both an error and a normal return, causing the context object to be freed twice. A local unprivileged attacker can crash the accounts-daemon and potentially gain root privileges.

kevinbackhouse Follow

Originally disclosed on GitHub Security Lab

An unprivileged local attacker can trigger a use-after-free vulnerability in accountsservice by sending a D-Bus message to the accounts-daemon process.

kevinbackhouse, on GitHub Security Lab

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

The code calls throw_error and then also calls a completion function that both decrease the reference count on the same context object, leading to a double free and use-after-free.

Impact

Exploitation is likely to be difficult, but this bug could potentially enable a local unprivileged attacker to gain root privileges; on Ubuntu 22.04 LTS the use-after-free goes unnoticed due to the older GLib allocator.

What the attacker needed

Local unprivileged access; ability to send D-Bus messages to accounts-daemon

The fix

The text says a fix was proposed, but does not describe the fix itself.

How it was found

  1. Send a D-Bus method call to the accounts-daemon that causes user_HOME_available to fail, for example by deleting all files from the home directory.
  2. Alternatively, send a SetLanguage call with invalid characters to trigger throw_error in user_update_environment.
  3. Observe that accounts-daemon crashes with SIGSEGV on Ubuntu 23.04, but not on Ubuntu 22.04 LTS.

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 use-after-free is a memory bug where a program frees an object but then keeps using it, which can crash the program or let an attacker run their own code. Here, a local user can send a special message to a system service that manages user accounts, causing it to free the same object twice and crash. The report says this could potentially let the attacker become the root user, but exploitation is likely difficult.

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.

More by kevinbackhouse

View all

47 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.