Skip to content
Race condition Write-up Advanced

Kernel-hack-drill and exploiting CVE-2024-50264 in the Linux kernel

A race condition in the Linux kernel's AF_VSOCK subsystem allows an unprivileged user to trigger a use-after-free write in a kernel worker by interrupting a connect() call with a signal. An attacker could exploit this to corrupt kernel memory and potentially escalate privileges, though the bug has several exploitation limitations.

a13xp0p0v.github.io

Published on a13xp0p0v.github.io

Some memory corruption bugs are much harder to exploit than others. They can involve race conditions, crash the system, and impose limitations that make a researcher's life difficult.

The author, on a13xp0p0v.github.io

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 write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the kernel fails to properly handle the socket state when a signal interrupts connect(), leading to a use-after-free write in a kernel worker.

Impact

An unprivileged attacker could exploit this use-after-free write to corrupt kernel memory and potentially escalate privileges, though the bug has several limitations that make exploitation difficult.

What the attacker needed

Unprivileged local access; no user namespaces required

How it was found

  1. Create a listening virtual socket (server vsock).
  2. Create a client vsock and call connect() to the server.
  3. Interrupt the connect() system call with a POSIX signal (e.g., signal 33 via timer).
  4. Call connect() again with a different svm_cid (VMADDR_CID_HYPERVISOR) to trigger memory corruption.
  5. The kernel schedules a worker that performs a use-after-free write on the freed virtio_vsock_sock object.

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 write-up has not been written yet. The Original tab links to the source.

A race condition is when two actions happen at the same time and the order matters, causing unexpected results. Here, a signal interrupts a network connection attempt, leaving a memory object freed but still used, which can let an attacker write to freed memory. This could allow them to take control of the system.

What is Race condition?

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.

Similar reports

View all

Same bug class and techniques, clearest first.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.