Bratter: An Instruction Set Extension for Forward Control-Flow Integrity in RISC-V
Abstract
:1. Introduction
2. Background
2.1. Control Transfer Instructions
2.2. Hints Instruction
2.3. Control Status Register
3. Design and Implementation
3.1. Problem Statement
3.2. Design Goals
3.3. Overview
3.4. Branch Tag Register
3.5. Bratter Instructions
3.6. Changes in RISC-V Processor
4. Use Cases
4.1. Function Signature Check
4.2. Branch Regulation
5. Evaluation
5.1. Experimental Setup
5.2. Code Size Overhead
5.3. Execution Time Overhead
6. Related Work
6.1. Software-Based Approach
6.2. Instruction Set Extension for CFI
6.3. Trace-Based Approach
7. Discussion
8. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Burow, N.; Zhang, X.; Payer, M. SoK: Shining light on shadow stacks. In Proceedings of the 2019 IEEE Symposium on Security and Privacy (SP), San Francisco, CA, USA, 19–23 May 2019; pp. 985–999. [Google Scholar]
- Abadi, M.; Budiu, M.; Erlingsson, U.; Ligatti, J. Control-flow integrity principles, implementations, and applications. ACM Trans. Inf. Syst. Secur. (TISSEC) 2009, 13, 1–40. [Google Scholar] [CrossRef]
- Van Der Veen, V.; Göktas, E.; Contag, M.; Pawoloski, A.; Chen, X.; Rawat, S.; Bos, H.; Holz, T.; Athanasopoulos, E.; Giuffrida, C. A tough call: Mitigating advanced code-reuse attacks at the binary level. In Proceedings of the 2016 IEEE Symposium on Security and Privacy (SP), San Jose, CA, USA, 22–26 May 2016; pp. 934–953. [Google Scholar]
- ARM. Arm Armv9-A A64 Instruction Set Architecture. 2021. Available online: https://developer.arm.com/documentation/ddi0602 (accessed on 9 February 2022).
- Patel, B.V. A Technical Look at Intel’s Control-Flow Enforcement Technology. 2020. Available online: https://www.intel.com/content/www/us/en/developer/articles/technical/technical-look-control-flow-enforcement-technology.html?wapkw=control-flow%20enforcement%20technology (accessed on 9 February 2022).
- Sullivan, D.; Arias, O.; Davi, L.; Larsen, P.; Sadeghi, A.R.; Jin, Y. Strategy without tactics: Policy-agnostic hardware-enhanced control-flow integrity. In Proceedings of the 2016 53nd ACM/EDAC/IEEE Design Automation Conference (DAC), Austin, TX, USA, 5–9 June 2016; pp. 1–6. [Google Scholar]
- Davi, L.; Hanreich, M.; Paul, D.; Sadeghi, A.R.; Koeberl, P.; Sullivan, D.; Arias, O.; Jin, Y. HAFIX: Hardware-assisted flow integrity extension. In Proceedings of the 2015 52nd ACM/EDAC/IEEE Design Automation Conference (DAC), San Francisco, CA, USA, 8–12 June 2015; pp. 1–6. [Google Scholar]
- Christoulakis, N.; Christou, G.; Athanasopoulos, E.; Ioannidis, S. HCFI: Hardware-enforced control-flow integrity. In Proceedings of the Sixth ACM Conference on Data and Application Security and Privacy, Louisiana, NO, USA, 9–11 March 2016; pp. 38–49. [Google Scholar]
- De, A.; Basu, A.; Ghosh, S.; Jaeger, T. FIXER: Flow integrity extensions for embedded RISC-V. In Proceedings of the 2019 Design, Automation & Test in Europe Conference & Exhibition (DATE), Florence, Italy, 25–29 March 2019; pp. 348–353. [Google Scholar]
- Li, J.; Chen, L.; Shi, G.; Chen, K.; Meng, D. ABCFI: Fast and Lightweight Fine-Grained Hardware-Assisted Control-Flow Integrity. IEEE Trans. Comput. Aided Des. Integr. Circuits Syst. 2020, 39, 3165–3176. [Google Scholar] [CrossRef]
- Waterman, A.; Asanovic, K. The RISC-V Instruction Set Manual, Volume I: User-Level ISA; Document Version 2.2; RISC-V Foundation: San Francisco, CA, USA, 2017. [Google Scholar]
- Roemer, R.; Buchanan, E.; Shacham, H.; Savage, S. Return-oriented programming: Systems, languages, and applications. ACM Trans. Inf. Syst. Secur. (TISSEC) 2012, 15, 1–34. [Google Scholar] [CrossRef]
- Bletsch, T.; Jiang, X.; Freeh, V.W.; Liang, Z. Jump-oriented programming: A new class of code-reuse attack. In Proceedings of the 6th ACM Symposium on Information, Computer and Communications Security, Hong Kong, China, 22–24 March 2011; pp. 30–40. [Google Scholar]
- Carlini, N.; Wagner, D. ROP is still dangerous: Breaking modern defenses. In Proceedings of the 23rd USENIX Security Symposium (USENIX Security 14), San Diego, CA, USA, 20–22 August 2014; pp. 385–399. [Google Scholar]
- Guo, Y.; Chen, L.; Shi, G. Function-oriented programming: A new class of code reuse attack in c applications. In Proceedings of the 2018 IEEE Conference on Communications and Network Security (CNS), Beijing, China, 30 May–1 June 2018; pp. 1–9. [Google Scholar]
- Kayaalp, M.; Ozsoy, M.; Abu-Ghazaleh, N.; Ponomarev, D. Branch regulation: Low-overhead protection from code reuse attacks. In Proceedings of the 2012 39th Annual International Symposium on Computer Architecture (ISCA), Portland, OR, USA, 9–13 June 2012. [Google Scholar]
- llvm. llvm-Project. 2021. Available online: https://github.com/llvm/llvm-project (accessed on 9 February 2022).
- RISC-V. Spike, a RISC-V ISA Simulator. 2019. Available online: https://github.com/riscv/riscv-isa-sim (accessed on 9 February 2022).
- Pallister, J.; Hollis, S.; Bennett, J. BEEBS: Open Benchmarks for Energy Measurements on Embedded Platforms. arXiv 2013, arXiv:cs.PF/1308.5174. [Google Scholar]
- RISC-V Software Collaboration Riscv-Gnu-Toolchain. 2021. Available online: https://github.com/riscv-collab/riscv-gnu-toolchain (accessed on 9 February 2022).
- Pappas, V.; Polychronakis, M.; Keromytis, A.D. Transparent ROP exploit mitigation using indirect branch tracing. In Proceedings of the 22nd USENIX Security Symposium (USENIX Security 13), Washington, DC, USA, 14–16 August 2013; pp. 447–462. [Google Scholar]
- Cheng, Y.; Zhou, Z.; Miao, Y.; Ding, X.; Deng, R.H. ROPecker: A generic and practical approach for defending against ROP attack. In Proceedings of the 21st Network and Distributed System Security Symposium, San Diego, CA, USA, 23–26 February 2014. [Google Scholar]
- Yao, F.; Chen, J.; Venkataramani, G. Jop-alarm: Detecting jump-oriented programming-based anomalies in applications. In Proceedings of the 2013 IEEE 31st International Conference on Computer Design (ICCD), Asheville, NC, USA, 6–9 October 2013; pp. 467–470. [Google Scholar]
- Carlini, N.; Barresi, A.; Payer, M.; Wagner, D.; Gross, T.R. Control-flow bending: On the effectiveness of control-flow integrity. In Proceedings of the 24th USENIX Security Symposium (USENIX Security 15), Washington, DC, USA, 12–14 August 2015; pp. 161–176. [Google Scholar]
- Schuster, F.; Tendyck, T.; Liebchen, C.; Davi, L.; Sadeghi, A.R.; Holz, T. Counterfeit object-oriented programming: On the difficulty of preventing code reuse attacks in C++ applications. In Proceedings of the 2015 IEEE Symposium on Security and Privacy, San Jose, CA, USA, 17–21 May 2015; pp. 745–762. [Google Scholar]
- Telesklav, M.; Tauner, S. Comparative Analysis and Enhancement of CFG-based Hardware-Assisted CFI Schemes. arXiv 2021, arXiv:2103.04456. [Google Scholar]
- ARM. Embedded Trace Macrocell Architecture Specification ETMv4.0 to ETM4.6. 2020. Available online: https://developer.arm.com/documentation/ihi0064/h (accessed on 9 February 2022).
- Lee, J.; Heo, I.; Lee, Y.; Paek, Y. Efficient security monitoring with the core debug interface in an embedded processor. ACM Trans. Des. Autom. Electron. Syst. (TODAES) 2016, 22, 1–29. [Google Scholar] [CrossRef]
- Oh, H.; Yang, M.; Cho, Y.; Paek, Y. Actimon: Unified JOP and ROP detection with active function lists on an SoC FPGA. IEEE Access 2019, 7, 186517–186528. [Google Scholar] [CrossRef]
- Guide, P. Intel® 64 and ia-32 Architectures Software Developer’s Manual Volume 3B: System Programming Guide, Part 2. 2011. Available online:https://www.semanticscholar.org/paper/Intel-%C2%AE-64-and-IA-32-Architectures-Software-%E2%80%99-s-3-A-License-Disclaims/08293a1041fd2d513f2cb71b30da0434f6bb04f4 (accessed on 30 December 2021).
- Hu, H.; Qian, C.; Yagemann, C.; Chung, S.P.H.; Harris, W.R.; Kim, T.; Lee, W. Enforcing unique code target property for control-flow integrity. In Proceedings of the 2018 ACM SIGSAC Conference on Computer and Communications Security, Toronto, Canada, 15–19 October 2018; pp. 1470–1486. [Google Scholar]
- Kwon, D.; Seo, J.; Baek, S.; Kim, G.; Ahn, S.; Paek, Y. VM-CFI: Control-flow integrity for virtual machine kernel using Intel PT. In International Conference on Computational Science and Its Applications; Springer: Cham, Switzerland, 2018; pp. 127–137. [Google Scholar]
- Gu, Y.; Zhao, Q.; Zhang, Y.; Lin, Z. PT-CFI: Transparent backward-edge control flow violation detection using intel processor trace. In Proceedings of the Seventh ACM on Conference on Data and Application Security and Privacy, Scottsdale, AZ, USA, 22–24 March 2017; pp. 173–184. [Google Scholar]
- Ding, R.; Qian, C.; Song, C.; Harris, B.; Kim, T.; Lee, W. Efficient protection of path-sensitive control security. In Proceedings of the 26th USENIX Security Symposium (USENIX Security 17), Vancouver, Canada, 16–18 August 2017; pp. 131–148. [Google Scholar]
- Ge, X.; Cui, W.; Jaeger, T. Griffin: Guarding control flows using intel processor trace. ACM SIGPLAN Not. 2017, 52, 585–598. [Google Scholar] [CrossRef] [Green Version]
- Asanovic, K.; Avizienis, R.; Bachrach, J.; Beamer, S.; Biancolin, D.; Celio, C.; Cook, H.; Dabbelt, D.; Hauser, J.; Izraelevitz, A.; et al. The Rocket Chip Generator; Technical Reports UCB/EECS-2016-17; EECS Department, University of California: Berkeley, CA, USA, 2016. [Google Scholar]
- Lee, Y.; Lee, J.; Heo, I.; Hwang, D.; Paek, Y. Integration of ROP/JOP monitoring IPs in an ARM-based SoC. In Proceedings of the 2016 Design, Automation & Test in Europe Conference & Exhibition (DATE), Dresden, Germany, 14–18 March 2016; pp. 331–336. [Google Scholar]
- Chaudhari, A.; Abraham, J.A. Effective control flow integrity checks for intrusion detection. In Proceedings of the 2018 IEEE 24th International Symposium on On-Line Testing Furthermore, Robust System Design (IOLTS), Platja d’Aro, Spain, 2–4 July 2018; pp. 1–6. [Google Scholar]
Instructions | Constraints | Code Points | Purpose |
---|---|---|---|
LUI | rd = x0 | Reserved for future standard use | |
AND | rd = x0 | ||
SLLI | rd = x0 | Reserved for custom use | |
SRLI | rd = x0 |
Benchmark | the # of Added Instructions | the # of Executed Instructions | ||||||
---|---|---|---|---|---|---|---|---|
Bratter_FS | Bratter_BR | Bratter_FS | Bratter_BR | |||||
sbtag | cbtag | sbtag | cbtag | sbtag | cbtag | sbtag | cbtag | |
bitcount | 5 | 5 | 1 | 8 | 4 | 4 | 160 | 160 |
cover | 2 | 2 | 3 | 190 | 2 | 2 | 360 | 360 |
crc32 | 2 | 2 | 0 | 0 | 2050 | 2050 | 0 | 0 |
ctl-stack | 1 | 1 | 0 | 0 | 2 | 2 | 0 | 0 |
ctl-vector | 1 | 1 | 0 | 0 | 2 | 2 | 0 | 0 |
duff | 0 | 0 | 1 | 8 | 0 | 0 | 2 | 76 |
jfdctint | 1 | 1 | 0 | 0 | 2 | 2 | 0 | 0 |
lcdnum | 0 | 0 | 1 | 16 | 0 | 0 | 10 | 10 |
qurt | 3 | 1 | 0 | 0 | 6 | 6 | 0 | 0 |
sglib-dllist | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
sglib-hashtable | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
sglib-listinssort | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
sglib-rbtree | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
sha | 2 | 2 | 2 | 16 | 2 | 2 | 3070 | 3070 |
trio-sscanf | 48 | 3 | 7 | 65 | 80 | 80 | 64 | 64 |
Instruction | sbtag | cbtag | slli | srli | ld | st | div | reg | ecall | others |
---|---|---|---|---|---|---|---|---|---|---|
Cycle | 2 | 2 | 2 | 2 | 3 | 2 | 1 | 1 | 10 | 1 |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Park, S.; Kang, D.; Kang, J.; Kwon, D. Bratter: An Instruction Set Extension for Forward Control-Flow Integrity in RISC-V. Sensors 2022, 22, 1392. https://doi.org/10.3390/s22041392
Park S, Kang D, Kang J, Kwon D. Bratter: An Instruction Set Extension for Forward Control-Flow Integrity in RISC-V. Sensors. 2022; 22(4):1392. https://doi.org/10.3390/s22041392
Chicago/Turabian StylePark, Seonghwan, Dongwook Kang, Jeonghwan Kang, and Donghyun Kwon. 2022. "Bratter: An Instruction Set Extension for Forward Control-Flow Integrity in RISC-V" Sensors 22, no. 4: 1392. https://doi.org/10.3390/s22041392
APA StylePark, S., Kang, D., Kang, J., & Kwon, D. (2022). Bratter: An Instruction Set Extension for Forward Control-Flow Integrity in RISC-V. Sensors, 22(4), 1392. https://doi.org/10.3390/s22041392