Comments on: RIO: Return Instruction Obfuscation for Bare-Metal IoT Devices with Binary Analysis

Kai Lehniger,Peter Langendörfer
2024-12-11
Abstract:This is a comment on "RIO: Return Instruction Obfuscation for Bare-Metal IoT Devices with Binary Analysis". RIO prevents finding gadgets for Return-Oriented Programming attacks by encrypting return instructions. This paper shows flaws in the design of RIO that allow for the easy retrieval of the plaintext return instructions without decrypting them. Additionally, changes are proposed to improve upon the original idea.
Cryptography and Security
What problem does this paper attempt to address?
This paper attempts to solve the security vulnerability problems existing in the RIO (Return Instruction Obfuscation) mechanism. Specifically: 1. **Background and Problem Definition**: - **ROP Attack (Return - Oriented Programming Attack)**: This is an attack method that executes malicious code fragments (called gadgets) by exploiting memory vulnerabilities to overwrite return addresses. Each gadget ends with a return instruction and pops the address of the next gadget from the stack, thus forming a gadget chain that can perform arbitrary calculations. - **RIO Mechanism**: To prevent ROP attacks, RIO encrypts all return instructions, making it impossible for attackers to find gadgets through binary analysis. This renders traditional gadget - finding algorithms ineffective because these algorithms usually start with looking for return instructions. 2. **Problems Pointed Out in the Paper**: - **Recovering Plain - text Return Instructions without Decryption**: The paper shows that encrypted return instructions can be recovered with high precision without decryption through certain methods. This means that there are serious vulnerabilities in RIO's security. - **Three Main Defects in RIO Design**: 1. **Assuming that Attackers Need to Conduct Binary Analysis**: Although attacks can be carried out without the target binary file, it does increase the difficulty. Therefore, RIO's goal is still valid. 2. **Assuming that RIO Hides the Location of Return Instructions**: The RIO initialization module itself uses the RCF module to locate return instructions, and attackers can also use this to find the location of return instructions. 3. **Unencrypted push Instructions**: The push instructions in the function prologue are not encrypted, and these instructions are usually symmetrical with the pop instructions in the epilogue. By analyzing the push instructions, attackers can deduce the pop instructions and the registers they use, thereby recovering the return address. 3. **Suggestions for Improvement**: - **Encrypt push Instructions**: By extending the encryption to push instructions, hide which registers are stored on the stack. - **Randomize push and pop Instructions**: Add a random number of extra registers to each pair of push and pop instructions, or replace each pair of push and pop instructions in the table with multiple instructions to randomize the location of the return address in each stack frame. In summary, this paper aims to reveal the security vulnerabilities in the RIO mechanism and propose improvement measures to enhance its security and prevent attackers from finding and exploiting return instructions through binary analysis.