Skip to content
Memory corruption Advisory Advanced CVE-2021-27080

Microsoft Azure Sphere mqueue inode initialization kernel code execution vulnerability

The mqueue inode allocation in Azure Sphere's kernel uses kmalloc without initializing the inode's list head, leaving it uninitialized. An attacker can poison the heap to control the uninitialized list pointer, leading to kernel code execution when the IPC namespace is destroyed.

Lilith >_> Follow

Originally disclosed on Cisco Talos

Critical 9.3 View original

A code execution vulnerability exists in the mqueue inode initialization functionality of Microsoft Azure Sphere 21.01. A specially crafted set of syscalls can lead to uninitialized kernel read, which in turn leads to code execution in kernel.

Lilith >_> and Claudio Bozzato, on Cisco Talos

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 mqueue inode allocation uses kmalloc without calling inode_init_once, leaving the i_lru list head uninitialized.

Impact

An attacker could achieve kernel code execution, potentially compromising the entire device.

What the attacker needed

Ability to create user and IPC namespaces; ability to perform kernel heap spray

The fix

The fix is to call inode_init_once after kmalloc in mqueue_alloc_inode.

How it was found

  1. Create a new user namespace and a new IPC namespace using unshare.
  2. Exit the namespace, causing the IPC namespace to be destroyed.
  3. During destruction, the mqueue filesystem is unmounted and the inode is freed.
  4. The uninitialized i_lru list is accessed, leading to a crash or code execution.

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.

In this system, when a message queue is created, a small data structure (an inode) is allocated but not fully set up. One of its fields, a list pointer, is left with whatever garbage was in memory. An attacker can arrange for that garbage to be a value they control, and when the system later tries to use that list, it can crash or run the attacker's code with high 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.

More by Lilith >_>

View all

4 more disclosed reports, best first.

More from Cisco Talos

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.