Skip to content
Info disclosure Advisory Advanced

Microsoft Azure Sphere Kernel GPIO_SET_PIN_CONFIG_IOCTL information disclosure vulnerability

The GPIO_SET_PIN_CONFIG_IOCTL ioctl in Azure Sphere's kernel fails to validate the lineoffsets array indices, allowing an attacker to read kernel memory via an oracle based on the allowed_user check. This can leak the address of the gdev->descs array and the process's cred structure, potentially leading to further exploitation.

Claudio Bozzato Follow

Originally disclosed on Cisco Talos

Medium 6.7 View original

An information disclosure vulnerability exists in the GPIOSETPINCONFIGIOCTL functionality of Microsoft Azure Sphere 21.06. A specially crafted ioctl can lead to kernel memory leak.

Claudio Bozzato and Lilith >_>, 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

Impact

An attacker could leak kernel memory addresses, including the location of the cred structure, which may aid in further exploitation such as privilege escalation.

What the attacker needed

Ability to execute code on Azure Sphere; access to /dev/gpiochip0

The fix

The vulnerability was fixed by the vendor on 2021-11-09.

How it was found

  1. Craft an ioctl call to GPIO_SET_PIN_CONFIG_IOCTL with a linecount between 1 and GPIOHANDLES_MAX and arbitrary lineoffsets values.
  2. The kernel dereferences gdev->descs[lineoffsets[i]] and checks if the allowed_user field matches the current UID.
  3. By observing whether the ioctl returns EACCES or a different error, determine if the memory at that address contains the UID.
  4. Iterate over lineoffsets values (using integer wraparound) to scan kernel memory for the UID pattern.
  5. Use the oracle to locate the gdev->descs array and the process's cred structure.

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 kernel driver for GPIO pins lets programs configure pins. It trusts a list of pin numbers without checking if they are valid, so a malicious program can make the kernel read memory at almost any address. By observing whether the kernel returns an error or not, the attacker can learn where important kernel data structures are located.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by Claudio Bozzato

View all

13 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.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.