Skip to content
Access control Advisory Advanced CVE-2020-16982

Microsoft Azure Sphere mtd character device driver privilege escalation vulnerability

The mtd character device driver in Azure Sphere allows a MEMWRITE ioctl to be issued on a read-only file descriptor, bypassing file permission checks. An attacker with read access to /dev/mtd1 could write a new revision of the uid_map file, potentially assigning a higher UID to a controlled application.

Claudio Bozzato Follow

Originally disclosed on Cisco Talos

High 8.1 View original

An arbitrary flash write vulnerability exists in the mtd character device driver of Microsoft Azure Sphere 20.06. A specially crafted ioctl can bypass file permissions and allow writes to flash by unauthorized users.

Claudio Bozzato, Lilith >_> and Dave McDaniel, 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 MEMWRITE ioctl handler does not check whether the file was opened for writing (FMODE_WRITE), unlike other ioctls such as MEMERASE.

Impact

An attacker with read access to the mtd1 device could modify the uid_map to assign a higher UID to a controlled application, though UID 0 is prevented by a check in application-manager.

What the attacker needed

Read access to /dev/mtd1; ability to issue ioctl calls; reboot or service crash to apply changes

How it was found

  1. Obtain read access to the mtd1 character device (e.g., via a previous vulnerability).
  2. Issue a MEMWRITE ioctl on the read-only file descriptor to write a new revision of the uid_map file in an erased block.
  3. Reboot or cause a service crash to make the system read the modified uid_map.

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 device file in Linux can be opened for reading or writing. Normally, writing requires the file to be opened for writing, but here a special command (ioctl) called MEMWRITE skips that check. So someone who can only read the device can still write to the flash memory, which could let them change important system files.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by Claudio Bozzato

View all

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

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.