$\mu$XOM1: Efficient eXecute-Only Memory on ARM Cortex-M. USENIX Security, 2019.
Code injection attacks: W$\oplus$X. Since virtually all processors today are equipped with at least five basic memory permissions: read-write-execute (RWX), read-write (RW), read-execute (RX), read-only (RO) and no-access (NA). W$\oplus$X can be efficiently enforced in hardware for a memory region solely by disabling RWX.
Disclosure attacks: attemps to read part of or possibly the entire code. Code often contains intellectual properties (IPs) including core algorithems and sensitive data like cryptographic keys. Can also be abused to launch code reuse attacks (CRAs).
XOM: eXecute-Only-Memory.
Embeded devices: - Applications and kernels operates on same privilege level: - real-time constraints: mode switching is expensive 9
Cortex-M:
Intersting Exceptions feature:
pc
via memory load instructions, such as POP, LDM, LDR
, or indirect branch instructions, such as BX
.$\mu$XOM converts all memory instructions into unprivileged ones and sets the code region as privileged. As a result, converted instructions cannot access code regions, thereby effectively enforcing the XO permission onto code regions.
“The bare-metal software installed in the device is considered benign but internally holds software vulnerabilities, so that the attackers may exploit the vulnerabilities and ultimately have arbitrary memory read and write capability.”
“We do not trust any software components, including the exception handlers.”
“Event-driven nature of tiny embedded systems signifies that exception handlers can take a large portion of embedded software components10, so we cannot just assume the security of these handlers. Thus, we assume that attackers can trigger a vulnerability inside the exception handler and manipulate any data including the CPU context saved on exception entry.”
==> untrusted exception handler: LLM: Then what to protect??? How to protect??? exception handler not the protected code contents???
C1: unconvertible memory instructions: Some memory instructions cannot be changed into uprivileged memory instructions.
load/store exclusive instructions do not have unprivileged conterparts.
$\mu$XOM: analyze the code to exclude them from instrumentation. Resulting in C3, C3, C4.
C2. Malicious indirect branches: unconverted instructions can be abused by jump to them. Can be used to 1) turn off the MPU; 2) reading code directly.
C3. Malicious exception returns: Hardware based context save and restore for fast exception entry and return. Attackers can exploit a vulnerability while in exception handling mode to corrupt stack, such as return address.
pc
, they will be able to execute any instruction in the program including the unconverted load/stores.C4. Malicious data manipulation: attacker can control all data. Call MPU function by passing crafted arguments.
C5. Unintended instructions: alter control flow to execute unintended/unaligned/data-derived instructions in code region[^usfi]. immediate values in code; middle of 32-bit instructions.
Address C2, C3, C4: unconverted instructions in $\mu$XOM are instrumented with verification routines:
Address C5: replace danger sequence with secure equivalent. - e.g. LLM: ???
Inspired by Reference monitor: verify the memory access by the unconverted load/stores.
To be atomic:
sp
as an alternative to “dedicated” register;
sp
as the target of unconverted load/store (such as PPB address), then call verification routine.sp
changes by a non-constant: insert sp
check;sp
changes by a constant: (e.g. prolog/epilog), redzones: non-accessible regions around valid stack region (already on board);sp
changes in exception handler: check sp
. If not, the attack would avoid all the checks for sp
by triggering an interrupt right after they corrupt the sp
.Another way to be atomic (in Silhouette): CFI: cannot be jumped into the middle of a function; –> but interrupts.returns has to be able to jump to, and can be abused.
Code disclosure in CRA:
Readactor11: a code diversification based CRA defence with resistance to code disclosure attacks. What Readactor do:
In uXOM:
LLVM compiler; Radare2 binary analysis framework12
Solution | code size | exe time | energy |
---|---|---|---|
uXOM | 15.7% | 7.3% | 7.5% |
SFI-XOM | 50.8% | 22.7% | 22.3% |
uXOM-CRA | 19.3% | 8.6% | 9.7% |
If you could revise
the fundmental principles of
computer system design
to improve security...
... what would you change?