From Library Portability to Para-rehosting: Natively Executing Microcontroller Software on Commodity Hardware
Wenqiang Li, Le Guan, Jingqiang Lin, Jiameng Shi, Fengjun Li
摘要
Finding bugs in microcontroller (MCU) firmware is challenging, even for device manufacturers who own the source code. The MCU runs different instruction sets than x86 and exposes a very different development environment. This invalidates many existing sophisticated software testing tools on x86. To maintain a unified developing and testing environment, a straightforward way is to re-compile the source code into the native executable for a commodity machine (called rehosting). However, ad-hoc re-hosting is a daunting and tedious task and subject to many issues (library-dependence, kernel-dependence and hardware-dependence). In this work, we systematically explore the portability problem of MCU software and propose pararehosting to ease the porting process. Specifically, we abstract and implement a portable MCU (PMCU) using the POSIX interface. It models common functions of the MCU cores. For peripheral specific logic, we propose HAL-based peripheral function replacement, in which high-level hardware functions are replaced with an equivalent backend driver on the host. These backend drivers are invoked by well-designed para-APIs and can be reused across many MCU OSs. We categorize common HAL functions into four types and implement templates for quick backend development. Using the proposed approach, we have successfully rehosted nine MCU OSs including the widely deployed Amazon FreeRTOS, ARM Mbed OS, Zephyr and LiteOS. To demonstrate the superiority of our approach in terms of security testing, we used off-the-shelf dynamic analysis tools (AFL and ASAN) against the rehosted programs and discovered 28 previously-unknown bugs, among which 5 were confirmed by CVE and the other 19 were confirmed by vendors at the time of writing.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 9 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- QSYM : A Practical Concolic Execution Engine Tailored for Hybrid Fuzzing 引用了 Driller: Augmenting Fuzzing Through Selective Symbolic Execution
- QSYM : A Practical Concolic Execution Engine Tailored for Hybrid Fuzzing 引用了 SOK: (State of) The Art of War: Offensive Techniques in Binary Analysis
- Khost: KVM-based Near Native MCU Firmware Rehosting 引用了 Towards Automated Dynamic Analysis for Linux-based Embedded Firmware
- Khost: KVM-based Near Native MCU Firmware Rehosting 引用了 LEMIX: Enabling Testing of Embedded Applications as Linux Applications
- Khost: KVM-based Near Native MCU Firmware Rehosting 引用了 FIRM-AFL: High-Throughput Greybox Fuzzing of IoT Firmware via Augmented Process Emulation
- LEMIX: Enabling Testing of Embedded Applications as Linux Applications 引用了 Towards Automated Dynamic Analysis for Linux-based Embedded Firmware
- LEMIX: Enabling Testing of Embedded Applications as Linux Applications 引用了 FIRM-AFL: High-Throughput Greybox Fuzzing of IoT Firmware via Augmented Process Emulation
- BaseMirror: Automatic Reverse Engineering of Baseband Commands from Android's Radio Interface Layer 引用了 SOK: (State of) The Art of War: Offensive Techniques in Binary Analysis
- FIRM-AFL: High-Throughput Greybox Fuzzing of IoT Firmware via Augmented Process Emulation 引用了 QSYM : A Practical Concolic Execution Engine Tailored for Hybrid Fuzzing
- FIRM-AFL: High-Throughput Greybox Fuzzing of IoT Firmware via Augmented Process Emulation 引用了 Towards Automated Dynamic Analysis for Linux-based Embedded Firmware
- RTCON: Context-Adaptive Function-Level Fuzzing for RTOS Kernels 引用了 Towards Automated Dynamic Analysis for Linux-based Embedded Firmware
- RTCON: Context-Adaptive Function-Level Fuzzing for RTOS Kernels 引用了 FIRM-AFL: High-Throughput Greybox Fuzzing of IoT Firmware via Augmented Process Emulation
- RTCON: Context-Adaptive Function-Level Fuzzing for RTOS Kernels 引用了 SOK: (State of) The Art of War: Offensive Techniques in Binary Analysis
- SOK: (State of) The Art of War: Offensive Techniques in Binary Analysis 引用了 Driller: Augmenting Fuzzing Through Selective Symbolic Execution
引用它的顶会 Paper9
- BaseMirror: Automatic Reverse Engineering of Baseband Commands from Android's Radio Interface LayerWenqiang Li, Haohuang Wen, Zhiqiang LinCCS 2024 · 1 次引用
- RTCON: Context-Adaptive Function-Level Fuzzing for RTOS KernelsEunkyu Lee, Junyoung Park, Insu YunNDSS 2026 · 1 次引用
- Beyond Conventional Triggers: Auto-Contextualized Covert Triggers for Android Logic BombsYe Wang, Bo Luo, Fengjun LiNDSS 2026
- Khost: KVM-based Near Native MCU Firmware RehostingChunlin Wang, Yicheng Yang, Yuan Zhang, Haoyu Xiao 等USENIX Security 2026
- LEMIX: Enabling Testing of Embedded Applications as Linux ApplicationsSai Ritvik Tanksalkar, Siddharth Muralee, Srihari Danduri, Paschal C. Amusuo 等USENIX Security 2025
它引用的 Paper10
- SOK: (State of) The Art of War: Offensive Techniques in Binary AnalysisYan Shoshitaishvili, Ruoyu Wang, Christopher Salls, Nick Stephens 等S&P 2016 · 1,085 次引用
- Driller: Augmenting Fuzzing Through Selective Symbolic ExecutionNick Stephens, John Grosen, Christopher Salls, Andrew Dutcher 等NDSS 2016 · 1,021 次引用
- QSYM : A Practical Concolic Execution Engine Tailored for Hybrid FuzzingInsu Yun, Sangho Lee, Meng Xu, Yeongjin Jang 等USENIX Security 2018 · 537 次引用
- Towards Automated Dynamic Analysis for Linux-based Embedded FirmwareDaming D. Chen, Maverick Woo, David Brumley, Manuel EgeleNDSS 2016 · 428 次引用
- FIRM-AFL: High-Throughput Greybox Fuzzing of IoT Firmware via Augmented Process EmulationYaowen Zheng, Ali Davanian, Heng Yin, Chengyu Song 等USENIX Security 2019 · 279 次引用
相关 Paper
- SHiFT: Semi-hosted Fuzz Testing for Embedded ApplicationsAlejandro Mera, Changming Liu, Ruimin Sun, Engin Kirda 等USENIX Security 2024 · 15 次引用
- FlexEmu: Towards Flexible MCU Peripheral EmulationChongqing Lei, Zhen Ling, Xiangyu Xu, Shaofeng Li 等CCS 2025 · 1 次引用
- ECMO: Peripheral Transplantation to Rehost Embedded Linux KernelsMuhui Jiang, Lin Ma, Yajin Zhou, Qiang Liu 等CCS 2021 · 11 次引用
- Forming Faster Firmware FuzzersLukas Seidel, Dominik Christian Maier, Marius MuenchUSENIX Security 2023
- A Friend's Eye is A Good Mirror: Synthesizing MCU Peripheral Models from Peripheral DriversChongqing Lei, Zhen Ling, Yue Zhang, Yan Yang 等USENIX Security 2024 · 8 次引用
