Microsoft Azure Sphere Normal World application ptrace unsigned code execution vulnerability
A vulnerability in Microsoft Azure Sphere's normal world allows a process to use the ptrace system call to write to non-writable memory, enabling execution of unsigned code. An attacker who has already compromised an application could exploit this to run arbitrary shellcode.
Originally disclosed on Cisco Talos
A code execution vulnerability exists in the normal world’s signed code execution functionality of Microsoft Azure Sphere 20.05. A specially crafted shellcode can cause a process’ non-writable memory to be written.
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 hardware memory protection only monitors for page permission changes and not for direct writes into non-writable pages like PTRACE_POKE is capable of.
What the attacker needed
Attacker has compromised an application
How it was found
- Save the program counter register for later use.
- Fork a child process that enters an infinite loop sending heartbeats.
- In the parent, calculate the target address in the child's memory.
- Attach to the child using PTRACE_ATTACH.
- Write two NOP instructions to the child's memory using PTRACE_POKETEXT.
- Resume the child with PTRACE_CONT, causing it to exit the loop and execute the modified code.
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 platform for internet-of-things devices. Normally, memory that is writable cannot be made executable, which stops attackers from running their own code. This report shows that a debugging tool called ptrace can be used to bypass that rule and modify a running program's code, allowing an attacker to run unsigned 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.