Microsoft Azure Sphere Normal World application PACKET_MMAP unsigned code execution vulnerability
A vulnerability in Microsoft Azure Sphere's normal world allows a process with CAP_NET_RAW to create an executable memory mapping via PACKET_MMAP, which the kernel fills with attacker-controlled network data. An attacker could then execute arbitrary shellcode in the context of a compromised app.
Originally disclosed on Cisco Talos
A code execution vulnerability exists in the normal world’s signed code execution functionality of Microsoft Azure Sphere 20.07. A specially crafted AFPACKET socket can cause a process to create an executable memory mapping with controllable content.
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
Likely the kernel's PACKET_MMAP feature allows a process to map a buffer as executable while the kernel writes network data into it, bypassing the platform's W^X memory protection.
Impact
An attacker who has already compromised an app with CAP_NET_RAW could execute arbitrary unsigned code, potentially escalating privileges or bypassing platform security.
What the attacker needed
Compromised app with CAP_NET_RAW; ability to send network packets to the device
How it was found
- Create an AF_PACKET socket.
- Use setsockopt with PACKET_RX_RING to allocate a ring buffer.
- Map the buffer with PROT_READ|PROT_EXEC using mmap.
- Bind the socket to receive packets.
- Send shellcode to the device over the network.
- Locate the shellcode in the mapped buffer and jump to it.
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.
Azure Sphere is a secure platform for internet-of-things devices. Normally, it prevents memory from being both writable and executable, which stops attackers from running their own code. This report shows a way around that rule using a network feature, so an attacker who already controls a program could run unauthorised code.
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.