Bounds Enforcement (IEEE TCAD 2020)

Bounds Enforcement (IEEE TCAD 2020)

This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI 10.1109/TCAD.2020.2984407, IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems Hardware Assisted Buffer Protection Mechanisms for Embedded RISC-V Asmit De, Aditya Basu, Swaroop Ghosh and Trent Jaeger System Stack foo(): ▪ Some code Abstract—RISC-V is a promising open source architecture that ▪ Push args for bar() ▪ Push return address on stack 1 targets low-power embedded devices and SoCs. However, there is ▪ Jump to bar() a dearth of practical and low-overhead security solutions in the ArgsArgstoto bar() bar() 1 3 foo() Stack Frame Stack foo() RISC-V architecture. Programs compiled using RISC-V ReturnReturn address address Frame Stack foo() toolchains are still vulnerable to code injection and code reuse Saved %ebp bar(): ▪ Some code (adversary injects 2 Local variables payload here) attacks such as buffer overflow and return-oriented programming ▪ Begin bar() epilogue actions (ROP). In this paper, we propose two hardware implemented ▪ Jump to malicious location 3 Buffer security extensions to RISC-V that provides a defense mechanism Payload Malicious 2 against such attacks. We first employ a Physically Unclonable Frame Stack bar() Function (PUF)-based randomized canary generation technique that removes the need to store the sensitive canary words in Links to malicious location 3 memory or CPU registers, thereby being more secure, while Fig. 1. Buffer overflow exploit. incurring low overheads. We implement the proposed Canary Engine in RISC-V RocketChip with Rocket Custom Coprocessor stack frame boundaries to detect potential return address (RoCC). Simulation results show 2.2% average execution overwriting. If an adversary overflows a buffer in order to overhead with a single buffer protection, while a 10X increase in overwrite the return address, the canary is also overwritten. buffer count only increases the overhead by 1.5X when protection is extended to all buffers. We further improve upon this with a Before returning in the program’s execution stack, the canary is dedicated security coprocessor FIXER, implemented on the checked, and if modified, the return address is assumed to be RoCC. FIXER enforces fine-grained control-flow integrity (CFI) compromised. This approach works if the adversary’s target is of running programs on backward edges (returns) and forward to overflow a buffer to overwrite the return address. However, edges (calls) without requiring any architectural modifications to there are scenarios where the adversary can skip over the canary the processor core. Compared to software-based solutions, FIXER using a vulnerable pointer reference, guess the canary, or learn reduces energy overhead by 60% at minimal execution time (1.5%) and area (2.9%) overheads. the canary using a disclosure vulnerability. Unfortunately, stack canaries cannot detect a buffer overflow Index Terms— Buffer overflow, PUF, Stack Canary, RISC-V if the attack payload does not actually overwrite the canary value. In a data-oriented attack, the adversary can overflow the I. INTRODUCTION buffer just enough to overwrite some sensitive variable above rogramming languages such as C which are closer to the the buffer, but not cross stack frame boundaries. Here, the P hardware provide a lot of flexibility in terms of memory and canary will not be overwritten; hence, it will not be able to IO access to allow system and device level programming. detect the attack. Fig. 2 shows a typical layout of the stack However, such languages are weakly typed and often tend to frame, where such an attack is possible. have inherent deficiencies leading to security vulnerabilities if Fig. 3 shows an example of vulnerable code for a data-flow not used with proper and secure practices. Buffer overflow (Fig. attack [5]. In this example, an adversary can send more than 1) is the most common vulnerability that can be exploited to 1000 bytes of data which the PacketRead function writes to launch a variety of attacks. In a program without bounds the packet variable. If the adversary’s payload is large checking, an adversary can overload a user input with excess enough, it will overwrite the return address which will be data that can overrun the buffer capacity and overwrite nearby detected by the canary when the stack rolls back. However, if memory locations with potentially malicious data, leading to the payload is carefully crafted, adversary can just overwrite the attacks such as return-oriented programming (ROP), function authenticated variable above the packet buffer. Then the pointer manipulation and violation of data flow integrity. check Authenticate(packet) can be bypassed and the Stack canaries [4] are sacrificial words placed on the stack at packet will be processed, without being detected by the canary. Asmit De is with The Pennsylvania State University, University Park, PA Swaroop Ghosh is with The Pennsylvania State University, University Park, 16802 USA (email: [email protected]). PA 16802 USA (e-mail: [email protected]). Aditya Basu is with The Pennsylvania State University, University Park, PA Trent Jaeger is with The Pennsylvania State University, University Park, PA 16802 USA (e-mail: [email protected]). 16802 USA (e-mail: [email protected]). 0278-0070 (c) 2020 IEEE. Personal use is permitted, but republication/redistribution requires IEEE permission. See http://www.ieee.org/publications_standards/publications/rights/index.html for more information. Authorized licensed use limited to: Penn State University. Downloaded on June 22,2020 at 19:42:38 UTC from IEEE Xplore. Restrictions apply. This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI 10.1109/TCAD.2020.2984407, IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems Address space will be a hard IP, while the dynamically reconfigurable FIXER 1. int authenticated = 0; coprocessor will be implemented on an on-chip FPGA. Such an Args to bar() 2. char packet[1000]; approach has the potential to be scaled to hybrid processor Return address 3. 4. while (!authenticated) { designs e.g., a Xeon + FPGA core [10]. The FPGA also Canary word 5. PacketRead(packet); provides the flexibility to change and update the security Saved %ebp 6. Local 7. if (Authenticate(packet)) architecture in demand to new threats, without a complete variables 8. authenticated = 1; redesign of the primary computing core. With the number of 9. } vulnerabilities rapidly increasing, it demands an efficient low- Buffer 10. Payload Malicious Malicious 11. if (authenticated) power flexible and scalable security solution that is sustainable bar() Stack Frame bar() Stack 12. ProcessPacket(packet); for long periods of time. FIXER potentially unlocks the design Fig. 2. A vulnerable stack frame Fig. 3. A vulnerable C code. capability to protect our systems from such cybersecurity layout with stack canaries. threats. Software based CFI techniques are also limited by the size of the address space, which can be overcome by FIXER’s The obvious solution is to detect a buffer overflow as soon as flexible FPGA implementation. Compared to NILE [11], it happens, and not wait for the function to end and the stack to FIXER achieves better performance. Although NILE uses an rollback in order to validate the canary. One possible way is to unmodified RISC-V core similar to FIXER, the core- place canaries at the top of every buffer. This leads to some coprocessor interface is modified for the coprocessor to tap into challenges. Canaries are held in specialized canary registers or more resources of the core. Note that, even though PUFCanary in a protected memory location in the address space. If the and FIXER both aim to protect memory, they approach the canaries are randomized, they take up some memory space or solution in different ways. PUFCanary tries to proactively several registers. This is expensive in terms of memory space, detect one of the fundamental causes of memory exploits – the especially if we try to put multiple canaries in the same stack buffer overflow itself. This requires compiler support and frame to protect every buffer. Moreover, a vulnerability in incurs more overhead than FIXER, especially if protecting saved canary locations can also lead to disclosing the canaries. multiple buffers. However, this allows protection against both The canaries also need to be validated after every write to a control-flow and data-flow attacks originating from buffer- buffer. This can be expensive if implemented in a fine-grained overflow. Hence security critical systems may opt to use manner. Existing solutions to protect programs from data-flow PUFCanary, trading in some performance. FIXER, on the other integrity are software based, e.g., performing reaching hand, implements a shadow stack and policy memory for definitions analysis [5], or enforcing compile-time memory preventing control flow violations, but it cannot prevent data- safety constraints [48], while others use specialized hardware flow attacks. The tradeoff is simpler design and better or architecture to perform tagging and metadata processing [6- performance than PUFCanary, hence this can be used for 7]. However, these techniques are expensive in terms of resource-constrained embedded systems. Table I shows a performance and/or memory requirements or require hardware qualitative comparison of PUFCanary and FIXER with the or architectural modifications to support them. state-of-the-art memory protection solutions. Both PUFCanary In this work, we present PUFCanary, a fine-grained yet and FIXER maintain high-performance with low energy, the lightweight hardware generated stack canaries to protect buffer difference being PUFCanary can also detect data-flow attacks. boundaries and can detect overflow of the buffers using PUFCanary and FIXER are both hardware agnostic, however, Physically Unclonable Function (PUF) [8].

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    13 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us